summaryrefslogtreecommitdiffstats
path: root/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/ProductOperation.java
blob: 2a8192421bdeec50c6e5f9e171fe453020dede8c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
/*-
 * ============LICENSE_START=======================================================
 * SDC
 * ================================================================================
 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
 * ================================================================================
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * ============LICENSE_END=========================================================
 */

package org.openecomp.sdc.be.model.operations.impl;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.stream.Collectors;
import java.util.Set;

import com.thinkaurelius.titan.core.TitanTransaction;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.openecomp.sdc.be.dao.api.ActionStatus;
import org.openecomp.sdc.be.dao.graph.datatype.GraphEdge;
import org.openecomp.sdc.be.dao.graph.datatype.GraphRelation;
import org.openecomp.sdc.be.dao.neo4j.GraphEdgeLabels;
import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary;
import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
import org.openecomp.sdc.be.datatypes.category.CategoryDataDefinition;
import org.openecomp.sdc.be.datatypes.category.GroupingDataDefinition;
import org.openecomp.sdc.be.datatypes.category.SubCategoryDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.ProductMetadataDataDefinition;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.FilterKeyEnum;
import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
import org.openecomp.sdc.be.model.*;
import org.openecomp.sdc.be.model.category.CategoryDefinition;
import org.openecomp.sdc.be.model.category.GroupingDefinition;
import org.openecomp.sdc.be.model.category.SubCategoryDefinition;
import org.openecomp.sdc.be.model.operations.api.IProductOperation;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.resources.data.ComponentMetadataData;
import org.openecomp.sdc.be.resources.data.ProductMetadataData;
import org.openecomp.sdc.be.resources.data.ServiceMetadataData;
import org.openecomp.sdc.be.resources.data.UserData;
import org.openecomp.sdc.be.resources.data.category.CategoryData;
import org.openecomp.sdc.be.resources.data.category.GroupingData;
import org.openecomp.sdc.be.resources.data.category.SubCategoryData;
import org.openecomp.sdc.common.util.ValidationUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.thinkaurelius.titan.core.TitanGraph;

import fj.data.Either;

@org.springframework.stereotype.Component("product-operation")
public class ProductOperation extends ComponentOperation implements IProductOperation {

	private static Logger log = LoggerFactory.getLogger(ProductOperation.class.getName());

	public ProductOperation() {
		log.debug("ProductOperation created");
	}

	@Override
	protected ComponentMetadataData getMetaDataFromComponent(Component component) {
		return getProductMetadataDataFromProduct((Product) component);
	}

	@SuppressWarnings("unchecked")
	@Override
	public <T> Either<T, StorageOperationStatus> getComponent(String id, boolean inTransaction) {
		return (Either<T, StorageOperationStatus>) getProduct(id, inTransaction);
	}

	// public <T> Either<T, StorageOperationStatus> getComponent_tx(String id,
	// boolean inTransaction) {
	// return (Either<T, StorageOperationStatus>) getProduct_tx(id,
	// inTransaction);
	// }

	@SuppressWarnings("unchecked")
	@Override
	protected <T> Either<T, StorageOperationStatus> getComponentByNameAndVersion(String name, String version,
			Map<String, Object> additionalParams, boolean inTransaction) {
		return (Either<T, StorageOperationStatus>) getByNamesAndVersion(GraphPropertiesDictionary.NAME.getProperty(),
				name, version, additionalParams, inTransaction);
	}

	@Override
	public <T> Either<T, StorageOperationStatus> getLightComponent(String id, boolean inTransaction) {
		return getLightComponent(id, NodeTypeEnum.Product, inTransaction);
	}

	@Override
	public <T> Either<List<T>, StorageOperationStatus> getFilteredComponents(Map<FilterKeyEnum, String> filters,
			boolean inTransaction) {
		return getFilteredComponents(filters, inTransaction, NodeTypeEnum.Product);
	}

	private Product convertProductDataToProduct(ProductMetadataData productData) {
		ProductMetadataDefinition productMetadataDefinition = new ProductMetadataDefinition(
				(ProductMetadataDataDefinition) productData.getMetadataDataDefinition());

		Product product = new Product(productMetadataDefinition);

		return product;
	}

	@SuppressWarnings("unchecked")
	@Override
	public <T> Either<T, StorageOperationStatus> updateComponent(T component, boolean inTransaction) {
		return (Either<T, StorageOperationStatus>) updateComponent((Component) component, inTransaction,
				titanGenericDao, Product.class, NodeTypeEnum.Product);
	}

	@SuppressWarnings("unchecked")
	@Override
	public Either<Component, StorageOperationStatus> deleteComponent(String id, boolean inTransaction) {
		return (Either<Component, StorageOperationStatus>) (Either<?, StorageOperationStatus>) deleteProduct(id,
				inTransaction);
	}

	@Override
	public Either<List<ArtifactDefinition>, StorageOperationStatus> getAdditionalArtifacts(String resourceId,
			boolean recursively, boolean inTransaction) {
		// TODO Auto-generated method stub
		return null;
	}

	@SuppressWarnings("unchecked")
	@Override
	public <T extends org.openecomp.sdc.be.model.Component> Either<T, StorageOperationStatus> getComponent(String id,
			Class<T> clazz) {
		return (Either<T, StorageOperationStatus>) getProduct(id, false);
	}

	@Override
	/**
	 * Deletes the product node
	 */
	public Either<Product, StorageOperationStatus> deleteProduct(String productId, boolean inTransaction) {

		Either<Product, StorageOperationStatus> result = Either.right(StorageOperationStatus.GENERAL_ERROR);

		try {

			Either<TitanGraph, TitanOperationStatus> graphResult = titanGenericDao.getGraph();
			if (graphResult.isRight()) {
				result = Either
						.right(DaoStatusConverter.convertTitanStatusToStorageStatus(graphResult.right().value()));
				return result;
			}

			Either<ProductMetadataData, TitanOperationStatus> productNode = titanGenericDao.getNode(
					UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.Product), productId, ProductMetadataData.class);
			if (productNode.isRight()) {
				TitanOperationStatus status = productNode.right().value();
				log.error("Failed to find product {}. Status is {}", productId, status);
				result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
				return result;
			}

			Either<Product, StorageOperationStatus> productRes = getProduct(productId, true);
			if (productRes.isRight()) {
				StorageOperationStatus status = productRes.right().value();
				log.error("Failed to find product {}", productId, status);
				result = Either.right(status);
				return result;
			}
			Product product = productRes.left().value();

			Either<List<ComponentInstance>, StorageOperationStatus> deleteAllInstancesRes = componentInstanceOperation
					.deleteAllComponentInstances(productId, NodeTypeEnum.Product, true);
			log.debug("After deleting instances under product {}. Result is {}", productId, deleteAllInstancesRes);
			if (deleteAllInstancesRes.isRight()) {
				StorageOperationStatus status = deleteAllInstancesRes.right().value();
				if (status != StorageOperationStatus.NOT_FOUND) {
					log.error("Failed to delete instances under product {}. Status is {}", productId, status);
					result = Either.right(status);
					return result;
				}
			}

			Either<ProductMetadataData, TitanOperationStatus> deleteProductNodeRes = titanGenericDao
					.deleteNode(productNode.left().value(), ProductMetadataData.class);
			if (deleteProductNodeRes.isRight()) {
				TitanOperationStatus status = deleteProductNodeRes.right().value();
				log.error("Failed to delete product node {}. Status is {}", productId, status);
				result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
				return result;
			}

			result = Either.left(product);

			return result;

		} finally {
			if (false == inTransaction) {
				if (result == null || result.isRight()) {
					log.error("deleteProduct operation : Going to execute rollback on graph.");
					titanGenericDao.rollback();
				} else {
					log.debug("deleteProduct operation : Going to execute commit on graph.");
					titanGenericDao.commit();
				}
			}
		}

	}

	@Override
	public Either<List<Product>, StorageOperationStatus> getProductCatalogData(boolean inTransaction) {

		long start = System.currentTimeMillis();
		try {
			/*
			 * Map<String, Object> propertiesToMatch = new HashMap<>();
			 * 
			 * propertiesToMatch.put(GraphPropertiesDictionary.STATE.getProperty
			 * (), LifecycleStateEnum.CERTIFIED.name());
			 * Either<List<ProductMetadataData>, TitanOperationStatus>
			 * lastVersionNodes = getLastVersion(NodeTypeEnum.Product,
			 * propertiesToMatch, ProductMetadataData.class); if
			 * (lastVersionNodes.isRight() && lastVersionNodes.right().value()
			 * != TitanOperationStatus.NOT_FOUND) { return
			 * Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus
			 * (lastVersionNodes.right().value())); } List<ProductMetadataData>
			 * notCertifiedHighest = (lastVersionNodes.isLeft() ?
			 * lastVersionNodes.left().value() : new
			 * ArrayList<ProductMetadataData>());
			 * 
			 * propertiesToMatch.put(GraphPropertiesDictionary.
			 * IS_HIGHEST_VERSION.getProperty(), true);
			 * Either<List<ProductMetadataData>, TitanOperationStatus>
			 * componentsNodes =
			 * titanGenericDao.getByCriteria(NodeTypeEnum.Product,
			 * propertiesToMatch, ProductMetadataData.class); if
			 * (componentsNodes.isRight() && componentsNodes.right().value() !=
			 * TitanOperationStatus.NOT_FOUND) { return
			 * Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus
			 * (componentsNodes.right().value())); } List<ProductMetadataData>
			 * certifiedHighest = (componentsNodes.isLeft() ?
			 * componentsNodes.left().value() : new
			 * ArrayList<ProductMetadataData>()); Set<String> names = new
			 * HashSet<String>(); for (ProductMetadataData data :
			 * notCertifiedHighest) { String name =
			 * data.getMetadataDataDefinition().getName(); names.add(name); }
			 * 
			 * for (ProductMetadataData data : certifiedHighest) { String
			 * productName = data.getMetadataDataDefinition().getName(); if
			 * (!names.contains(productName)) { notCertifiedHighest.add(data); }
			 * }
			 */
			Either<List<ProductMetadataData>, TitanOperationStatus> listOfHighestComponents = this
					.getListOfHighestComponents(NodeTypeEnum.Product, ProductMetadataData.class);
			if (listOfHighestComponents.isRight()
					&& listOfHighestComponents.right().value() != TitanOperationStatus.NOT_FOUND) {
				return Either.right(
						DaoStatusConverter.convertTitanStatusToStorageStatus(listOfHighestComponents.right().value()));
			}

			List<ProductMetadataData> notCertifiedHighest = listOfHighestComponents.left().value();

			List<Product> result = new ArrayList<>();

			if (notCertifiedHighest != null && false == notCertifiedHighest.isEmpty()) {

				// fetch from cache
				long startFetchAllFromCache = System.currentTimeMillis();

				Map<String, Long> components = notCertifiedHighest.stream()
						.collect(Collectors.toMap(p -> p.getMetadataDataDefinition().getUniqueId(),
								p -> p.getMetadataDataDefinition().getLastUpdateDate()));

				Either<ImmutablePair<List<Component>, Set<String>>, ActionStatus> componentsFromCacheForCatalog = this
						.getComponentsFromCacheForCatalog(components, ComponentTypeEnum.PRODUCT);
				if (componentsFromCacheForCatalog.isLeft()) {
					ImmutablePair<List<Component>, Set<String>> immutablePair = componentsFromCacheForCatalog.left()
							.value();
					List<Component> list = immutablePair.getLeft();
					if (list != null) {
						for (Component component : list) {
							result.add((Product) component);
						}
						List<String> addedUids = list.stream()
								.map(p -> p.getComponentMetadataDefinition().getMetadataDataDefinition().getUniqueId())
								.collect(Collectors.toList());
						notCertifiedHighest = notCertifiedHighest.stream()
								.filter(p -> false == addedUids.contains(p.getMetadataDataDefinition().getUniqueId()))
								.collect(Collectors.toList());
					}
				}
				long endFetchAllFromCache = System.currentTimeMillis();
				log.debug("Fetch all catalog products metadata from cache took {} ms",
						(endFetchAllFromCache - startFetchAllFromCache));
				log.debug("The number of products added to catalog from cache is {}", result.size());

				log.debug("The number of products needed to be fetch as light component is {}",
						notCertifiedHighest.size());

				for (ProductMetadataData data : notCertifiedHighest) {
					Either<Product, StorageOperationStatus> component = getLightComponent(
							data.getMetadataDataDefinition().getUniqueId(), inTransaction);
					if (component.isRight()) {
						log.debug("Failed to get product for id = {}, error : {}. skip product", data.getUniqueId(),
								component.right().value());
					} else {
						// get all versions
						Product product = component.left().value();
						// setAllVersions(product);

						result.add(product);
					}
				}
			}
			return Either.left(result);
		} finally {
			if (false == inTransaction) {
				titanGenericDao.commit();
			}
			log.debug("Fetch all catalog products took {} ms", (System.currentTimeMillis() - start));
		}
	}

	@Override
	public Either<Product, StorageOperationStatus> createProduct(Product product) {
		return createProduct(product, false);
	}

	@Override
	public Either<Product, StorageOperationStatus> createProduct(Product product, boolean inTransaction) {
		Either<Product, StorageOperationStatus> result = null;

		try {

			ProductMetadataData productData = getProductMetadataDataFromProduct(product);
			addComponentInternalFields(productData);
			String uniqueId = (String) productData.getUniqueId();
			generateUUID(product);

			String userId = product.getCreatorUserId();

			Either<UserData, TitanOperationStatus> findUser = findUser(userId);

			if (findUser.isRight()) {
				TitanOperationStatus status = findUser.right().value();
				log.error("Cannot find user {} in the graph. status is {}", userId, status);
				return sendError(status, StorageOperationStatus.USER_NOT_FOUND);
			}

			UserData creatorUserData = findUser.left().value();
			UserData updaterUserData = creatorUserData;
			String updaterUserId = product.getLastUpdaterUserId();
			if (updaterUserId != null && !updaterUserId.equals(userId)) {
				findUser = findUser(updaterUserId);
				if (findUser.isRight()) {
					TitanOperationStatus status = findUser.right().value();
					log.error("Cannot find user {} in the graph. status is {}", userId, status);
					return sendError(status, StorageOperationStatus.USER_NOT_FOUND);
				} else {
					updaterUserData = findUser.left().value();
				}
			}

			log.trace("Creating tags for product {}", uniqueId);
			StorageOperationStatus storageOperationStatus = createTagsForComponent(product);
			if (storageOperationStatus != StorageOperationStatus.OK) {
				return Either.right(storageOperationStatus);
			}

			log.trace("Finding groupings for product {}", uniqueId);
			Either<List<GroupingData>, StorageOperationStatus> findGroupingsForComponent = findGroupingsForComponent(
					NodeTypeEnum.ProductGrouping, product);
			if (findGroupingsForComponent.isRight()) {
				return Either.right(findGroupingsForComponent.right().value());
			}
			List<GroupingData> groupingDataToAssociate = findGroupingsForComponent.left().value();

			log.debug("try to create product node on graph for id {}", uniqueId);
			Either<ProductMetadataData, TitanOperationStatus> createNode = titanGenericDao.createNode(productData,
					ProductMetadataData.class);
			if (createNode.isRight()) {
				TitanOperationStatus status = createNode.right().value();
				log.error("Error returned after creating product data node {}. Status returned is {}", productData,
						status);
				result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
				return result;
			}
			log.debug("product node created on graph for id {}", productData.getUniqueId());

			TitanOperationStatus associateMetadata = associateMetadataToComponent(productData, creatorUserData,
					updaterUserData, null, null);
			if (associateMetadata != TitanOperationStatus.OK) {
				result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(associateMetadata));
				return result;
			}

			TitanOperationStatus associateCategories = associateCategoriesToProduct(productData,
					groupingDataToAssociate);
			if (associateCategories != TitanOperationStatus.OK) {
				result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(associateCategories));
				return result;
			}

			result = getProduct(uniqueId, true);
			if (result.isRight()) {
				log.error("Cannot get full product from the graph. status is {}", result.right().value());
				return Either.right(result.right().value());
			}

			if (log.isDebugEnabled()) {
				String json = prettyJson.toJson(result.left().value());
				log.debug("Product retrieved is {}", json);
			}

			return result;

		} finally {
			if (false == inTransaction) {
				if (result == null || result.isRight()) {
					log.debug("Going to execute rollback on graph.");
					titanGenericDao.rollback();
				} else {
					log.debug("Going to execute commit on graph.");
					titanGenericDao.commit();
				}
			}
		}
	}

	private TitanOperationStatus associateCategoriesToProduct(ProductMetadataData productData,
			List<GroupingData> groupingDataToAssociate) {
		for (GroupingData groupingData : groupingDataToAssociate) {
			GraphEdgeLabels groupingLabel = GraphEdgeLabels.CATEGORIZED_TO;
			Either<GraphRelation, TitanOperationStatus> result = titanGenericDao.createRelation(productData,
					groupingData, groupingLabel, null);
			log.debug("After associating grouping {} to product {}. Edge type is {}", groupingData, productData,
					groupingLabel);
			if (result.isRight()) {
				return result.right().value();
			}
		}
		log.trace("All groupings associated succesfully to product {}", productData);
		return TitanOperationStatus.OK;
	}

	private TitanOperationStatus dissociateCategoriesFromProduct(ProductMetadataData productData,
			List<GroupingData> groupingDataToDissociate) {
		for (GroupingData groupingData : groupingDataToDissociate) {
			GraphEdgeLabels groupingLabel = GraphEdgeLabels.CATEGORIZED_TO;
			Either<GraphRelation, TitanOperationStatus> result = titanGenericDao.deleteRelation(productData,
					groupingData, groupingLabel);
			log.debug("After dissociating grouping {} from product {}. Edge type is {}", groupingData, productData,
					groupingLabel);
			if (result.isRight()) {
				return result.right().value();
			}
		}
		log.trace("All groupings dissociated succesfully from product {}", productData);
		return TitanOperationStatus.OK;
	}

	private Either<Product, StorageOperationStatus> getProduct(String uniqueId, boolean inTransaction) {
		ComponentParametersView componentParametersView = new ComponentParametersView();
		return getProduct(uniqueId, componentParametersView, inTransaction);
	}

	private Either<Product, StorageOperationStatus> getProduct(String uniqueId,
			ComponentParametersView componentParametersView, boolean inTransaction) {
		Product product = null;
		Either<Product, StorageOperationStatus> result = null;
		try {

			NodeTypeEnum productNodeType = NodeTypeEnum.Product;
			NodeTypeEnum compInstNodeType = NodeTypeEnum.Service;

			Either<ProductMetadataData, StorageOperationStatus> getComponentByLabel = getComponentByLabelAndId(uniqueId,
					productNodeType, ProductMetadataData.class);
			if (getComponentByLabel.isRight()) {
				result = Either.right(getComponentByLabel.right().value());
				return result;
			}
			ProductMetadataData productData = getComponentByLabel.left().value();

			// Try to fetch resource from the cache. The resource will be
			// fetched only if the time on the cache equals to
			// the time on the graph.
			Either<Product, ActionStatus> componentFromCacheIfUpToDate = this.getComponentFromCacheIfUpToDate(uniqueId,
					productData, componentParametersView, Product.class, ComponentTypeEnum.PRODUCT);
			if (componentFromCacheIfUpToDate.isLeft()) {
				Product cachedProduct = componentFromCacheIfUpToDate.left().value();
				log.debug("Product {} with uid {} was fetched from cache.", cachedProduct.getName(),
						cachedProduct.getUniqueId());
				return Either.left(cachedProduct);
			}

			product = convertProductDataToProduct(productData);

			TitanOperationStatus status = null;
			if (false == componentParametersView.isIgnoreUsers()) {
				status = setComponentCreatorFromGraph(product, uniqueId, productNodeType);
				if (status != TitanOperationStatus.OK) {
					result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
					return result;
				}

				status = setComponentLastModifierFromGraph(product, uniqueId, productNodeType);
				if (status != TitanOperationStatus.OK) {
					result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
					return result;

				}
			}
			if (false == componentParametersView.isIgnoreCategories()) {
				status = setComponentCategoriesFromGraph(product);
				if (status != TitanOperationStatus.OK) {
					result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
					return result;
				}
			}

			if (false == componentParametersView.isIgnoreComponentInstances()
					|| false == componentParametersView.isIgnoreComponentInstancesProperties()
					|| false == componentParametersView.isIgnoreCapabilities()
					|| false == componentParametersView.isIgnoreRequirements()) {
				status = setComponentInstancesFromGraph(uniqueId, product, productNodeType, compInstNodeType);
				if (status != TitanOperationStatus.OK) {
					result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
					return result;

				}
			}
			if (false == componentParametersView.isIgnoreComponentInstancesProperties()) {
				status = setComponentInstancesPropertiesFromGraph(uniqueId, product);
				if (status != TitanOperationStatus.OK) {
					result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
					return result;
				}
			}
			if (false == componentParametersView.isIgnoreCapabilities()) {
				status = setCapabilitiesFromGraph(uniqueId, product, NodeTypeEnum.Product);
				if (status != TitanOperationStatus.OK) {
					result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
					return result;
				}
			}
			if (false == componentParametersView.isIgnoreRequirements()) {
				status = setRequirementsFromGraph(uniqueId, product, NodeTypeEnum.Product);
				if (status != TitanOperationStatus.OK) {
					result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
					return result;
				}
			}

			if (false == componentParametersView.isIgnoreAllVersions()) {
				status = setAllVersions(product);
				if (status != TitanOperationStatus.OK) {
					return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
				}
			}

			result = Either.left(product);
			return result;

		} finally {
			if (false == inTransaction) {
				if (result == null || result.isRight()) {
					titanGenericDao.rollback();
				} else {
					titanGenericDao.commit();
				}
			}
		}
	}

	// private Either<Product, StorageOperationStatus> getProduct_tx(String
	// uniqueId, boolean inTransaction) {
	// Product product = null;
	// Either<Product, StorageOperationStatus> result = null;
	// try {
	//
	// NodeTypeEnum productNodeType = NodeTypeEnum.Product;
	// NodeTypeEnum compInstNodeType = NodeTypeEnum.Service;
	//
	// Either<ProductMetadataData, StorageOperationStatus> getComponentByLabel =
	// getComponentByLabelAndId_tx(uniqueId, productNodeType,
	// ProductMetadataData.class);
	// if (getComponentByLabel.isRight()) {
	// result = Either.right(getComponentByLabel.right().value());
	// return result;
	// }
	// ProductMetadataData productData = getComponentByLabel.left().value();
	// product = convertProductDataToProduct(productData);
	//
	// TitanOperationStatus status = setComponentCreatorFromGraph(product,
	// uniqueId, productNodeType);
	// if (status != TitanOperationStatus.OK) {
	// result =
	// Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
	// return result;
	// }
	//
	// status = setComponentLastModifierFromGraph(product, uniqueId,
	// productNodeType);
	// if (status != TitanOperationStatus.OK) {
	// result =
	// Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
	// return result;
	//
	// }
	// status = setComponentCategoriesFromGraph(product);
	// if (status != TitanOperationStatus.OK) {
	// result =
	// Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
	// return result;
	// }
	//
	// status = setComponentInstancesFromGraph(uniqueId, product,
	// productNodeType, compInstNodeType);
	// if (status != TitanOperationStatus.OK) {
	// result =
	// Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
	// return result;
	//
	// }
	//
	// status = setComponentInstancesPropertiesFromGraph(uniqueId, product);
	// if (status != TitanOperationStatus.OK) {
	// result =
	// Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
	// return result;
	// }
	//
	// status = setCapabilitiesFromGraph(uniqueId, product,
	// NodeTypeEnum.Product);
	// if (status != TitanOperationStatus.OK) {
	// result =
	// Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
	// return result;
	// }
	//
	// status = setRequirementsFromGraph( uniqueId, product,
	// NodeTypeEnum.Product);;
	// if (status != TitanOperationStatus.OK) {
	// result =
	// Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
	// return result;
	// }
	//
	//
	// status = setAllVersions(product);
	// if (status != TitanOperationStatus.OK) {
	// return
	// Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
	// }
	//
	// result = Either.left(product);
	// return result;
	//
	// } finally {
	// if (false == inTransaction) {
	// if (result == null || result.isRight()) {
	// titanGenericDao.rollback();
	// } else {
	// titanGenericDao.commit();
	// }
	// }
	// }
	// }

	private TitanOperationStatus setAllVersions(Product product) {
		Either<Map<String, String>, TitanOperationStatus> res = getVersionList(NodeTypeEnum.Product,
				product.getVersion(), product, ProductMetadataData.class);
		if (res.isRight()) {
			return res.right().value();
		}
		product.setAllVersions(res.left().value());
		return TitanOperationStatus.OK;
	}

	private Either<Product, StorageOperationStatus> sendError(TitanOperationStatus status,
			StorageOperationStatus statusIfNotFound) {
		Either<Product, StorageOperationStatus> result;
		if (status == TitanOperationStatus.NOT_FOUND) {
			result = Either.right(statusIfNotFound);
			return result;
		} else {
			result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
			return result;
		}
	}

	@Override
	TitanOperationStatus setComponentCategoriesFromGraph(Component component) {
		Product product = (Product) component;
		// Building the cat->subcat->grouping triples
		Either<List<ImmutablePair<GroupingData, GraphEdge>>, TitanOperationStatus> childrenNodes = titanGenericDao
				.getChildrenNodes(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.Product), product.getUniqueId(),
						GraphEdgeLabels.CATEGORIZED_TO, NodeTypeEnum.ProductGrouping, GroupingData.class);
		if (childrenNodes.isRight()) {
			if (childrenNodes.right().value() != TitanOperationStatus.NOT_FOUND) {
				log.debug("Error when finding groupings for this product, error {}", childrenNodes.right().value());
				return childrenNodes.right().value();
			} else {
				log.debug("No groupings found for this product - this might be normal");
				return TitanOperationStatus.OK;
			}
		}
		Map<CategoryDefinition, Map<SubCategoryDefinition, List<GroupingDefinition>>> categoriesDataStructure = new HashMap<>();

		List<ImmutablePair<GroupingData, GraphEdge>> valueList = childrenNodes.left().value();
		for (ImmutablePair<GroupingData, GraphEdge> groupPair : valueList) {
			GroupingData groupingData = groupPair.getLeft();
			Either<ImmutablePair<SubCategoryData, GraphEdge>, TitanOperationStatus> parentSubCat = titanGenericDao
					.getParentNode(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.ProductGrouping),
							(String) groupingData.getUniqueId(), GraphEdgeLabels.GROUPING,
							NodeTypeEnum.ProductSubcategory, SubCategoryData.class);
			if (parentSubCat.isRight()) {
				log.debug("Cannot find subcategory for grouping {}", groupingData.getUniqueId());
				return parentSubCat.right().value();
			}
			SubCategoryData subCatData = parentSubCat.left().value().getLeft();
			Either<ImmutablePair<CategoryData, GraphEdge>, TitanOperationStatus> parentCat = titanGenericDao
					.getParentNode(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.ProductSubcategory),
							(String) subCatData.getUniqueId(), GraphEdgeLabels.SUB_CATEGORY,
							NodeTypeEnum.ProductCategory, CategoryData.class);
			if (parentCat.isRight()) {
				log.debug("Cannot find category for subcategory {}", subCatData.getUniqueId());
				return parentCat.right().value();
			}

			// Building data structure of categories hierarchy
			CategoryDataDefinition categoryDefinition = parentCat.left().value().getLeft().getCategoryDataDefinition();
			SubCategoryDataDefinition subDefinition = subCatData.getSubCategoryDataDefinition();
			GroupingDataDefinition groupingDefinition = groupingData.getGroupingDataDefinition();

			CategoryDefinition categoryDef = new CategoryDefinition(categoryDefinition);
			SubCategoryDefinition subDef = new SubCategoryDefinition(subDefinition);
			GroupingDefinition groupingDef = new GroupingDefinition(groupingDefinition);

			if (log.isDebugEnabled()) {
				log.debug("Found category {} -> subcategory {} -> grouping {} for product {}",			
					categoryDefinition.getUniqueId(), subCatData.getUniqueId(), groupingData.getUniqueId(),
					product.getUniqueId());
			}
			Map<SubCategoryDefinition, List<GroupingDefinition>> subMap = categoriesDataStructure.get(categoryDef);
			if (subMap == null) {
				subMap = new HashMap<>();
				categoriesDataStructure.put(categoryDef, subMap);
			}
			List<GroupingDefinition> groupList = subMap.get(subDef);
			if (groupList == null) {
				groupList = new ArrayList<>();
				subMap.put(subDef, groupList);
			}
			groupList.add(groupingDef);
		}
		convertToCategoriesList(product, categoriesDataStructure);
		return TitanOperationStatus.OK;
	}

	private void convertToCategoriesList(Product product,
			Map<CategoryDefinition, Map<SubCategoryDefinition, List<GroupingDefinition>>> categoriesDataStructure) {
		List<CategoryDefinition> categoryDataList = product.getCategories();
		if (categoryDataList == null) {
			categoryDataList = new ArrayList<CategoryDefinition>();
		}
		for (Entry<CategoryDefinition, Map<SubCategoryDefinition, List<GroupingDefinition>>> triple : categoriesDataStructure
				.entrySet()) {
			CategoryDefinition categoryDefinition = triple.getKey();
			List<SubCategoryDefinition> subList = new ArrayList<>();
			categoryDefinition.setSubcategories(subList);
			Map<SubCategoryDefinition, List<GroupingDefinition>> value = triple.getValue();

			for (Entry<SubCategoryDefinition, List<GroupingDefinition>> pair : value.entrySet()) {
				SubCategoryDefinition subCategoryDefinition = pair.getKey();
				List<GroupingDefinition> list = pair.getValue();
				subList.add(subCategoryDefinition);
				subCategoryDefinition.setGroupings(list);
			}
			categoryDataList.add(categoryDefinition);
		}
		product.setCategories(categoryDataList);
		log.debug("Fetched categories for product {}, categories: {}", product.getUniqueId(),
				Arrays.toString(categoryDataList.toArray()));
	}

	private ProductMetadataData getProductMetadataDataFromProduct(Product product) {
		ProductMetadataData productMetadata = new ProductMetadataData(
				(ProductMetadataDataDefinition) product.getComponentMetadataDefinition().getMetadataDataDefinition());
		return productMetadata;
	}

	@Override
	public boolean isComponentExist(String id) {
		return isComponentExist(id, NodeTypeEnum.Product);
	}

	// @SuppressWarnings("unchecked")
	// @Override
	// public <T> Either<T, StorageOperationStatus> cloneComponent(T other,
	// String version, boolean inTransaction) {
	// return (Either<T, StorageOperationStatus>) cloneProduct((Product)other,
	// version, inTransaction);
	// }

	@SuppressWarnings("unchecked")
	@Override
	public <T> Either<T, StorageOperationStatus> cloneComponent(T other, String version,
			LifecycleStateEnum targetLifecycle, boolean inTransaction) {
		return (Either<T, StorageOperationStatus>) cloneProduct((Product) other, version, targetLifecycle,
				inTransaction);
	}

	private Either<Product, StorageOperationStatus> cloneProduct(Product other, String version,
			LifecycleStateEnum targetLifecycle, boolean inTransaction) {
		Either<Product, StorageOperationStatus> result = null;

		try {
			String origProductId = other.getUniqueId();
			other.setVersion(version);
			other.setUniqueId(null);

			Either<Integer, StorageOperationStatus> counterStatus = getComponentInstanceCoutner(origProductId,
					NodeTypeEnum.Product);
			if (counterStatus.isRight()) {
				StorageOperationStatus status = counterStatus.right().value();
				log.error("failed to get resource instance counter on product {}. status={}", origProductId,
						counterStatus);
				result = Either.right(status);
				return result;
			}

			Either<Product, StorageOperationStatus> createProductMD = createProduct(other, inTransaction);
			if (createProductMD.isRight()) {
				StorageOperationStatus status = createProductMD.right().value();
				log.debug("Failed to clone product. status= {}", status);
				result = Either.right(status);
				return result;
			}
			Product product = createProductMD.left().value();

			Either<ImmutablePair<List<ComponentInstance>, Map<String, String>>, StorageOperationStatus> cloneInstances = componentInstanceOperation.cloneAllComponentInstancesFromContainerComponent(origProductId, product,
					NodeTypeEnum.Product, NodeTypeEnum.Service, targetLifecycle, null);
			if (cloneInstances.isRight()) {
				result = Either.right(cloneInstances.right().value());
				return result;
			}

			Either<Integer, StorageOperationStatus> setResourceInstanceCounter = setComponentInstanceCounter(
					product.getUniqueId(), NodeTypeEnum.Product, counterStatus.left().value(), inTransaction);
			if (setResourceInstanceCounter.isRight()) {
				StorageOperationStatus status = setResourceInstanceCounter.right().value();
				log.error("failed to set resource instance counter on product {}. status={}", product.getUniqueId(),
						setResourceInstanceCounter);
				result = Either.right(status);
				return result;
			}

			result = this.getProduct(product.getUniqueId(), inTransaction);
			if (result.isRight()) {
				log.error("Cannot get full product from the graph. status is {}", result.right().value());
				return Either.right(result.right().value());
			}

			if (log.isDebugEnabled()) {
				String json = prettyJson.toJson(result.left().value());
				log.debug("Product retrieved is {}", json);
			}

			return result;
		} finally {
			if (false == inTransaction) {
				if (result == null || result.isRight()) {
					log.debug("Going to execute rollback on graph.");
					titanGenericDao.rollback();
				} else {
					log.debug("Going to execute commit on graph.");
					titanGenericDao.commit();
				}
			}
		}
	}

	private Either<Product, StorageOperationStatus> getByNamesAndVersion(String nameKey, String nameValue,
			String version, Map<String, Object> additionalParams, boolean inTransaction) {
		Map<String, Object> props = new HashMap<String, Object>();
		props.put(nameKey, nameValue);
		props.put(GraphPropertiesDictionary.VERSION.getProperty(), version);
		props.put(GraphPropertiesDictionary.LABEL.getProperty(), NodeTypeEnum.Product.getName());
		if (additionalParams != null && !additionalParams.isEmpty()) {
			props.putAll(additionalParams);
		}

		Either<List<ProductMetadataData>, TitanOperationStatus> byCriteria = titanGenericDao
				.getByCriteria(NodeTypeEnum.Product, props, ProductMetadataData.class);

		if (byCriteria.isRight()) {
			return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(byCriteria.right().value()));
		}
		List<ProductMetadataData> dataList = byCriteria.left().value();
		if (dataList != null && !dataList.isEmpty()) {
			if (dataList.size() > 1) {
				log.debug("More that one instance of product for name {} and version {}", nameValue, version);
				return Either.right(StorageOperationStatus.GENERAL_ERROR);
			}
			ProductMetadataData productData = dataList.get(0);
			Either<Product, StorageOperationStatus> product = getProduct(
					productData.getMetadataDataDefinition().getUniqueId(), inTransaction);
			if (product.isRight()) {
				log.debug("Failed to fetch product, name {} id {}", productData.getMetadataDataDefinition().getName(),
						productData.getMetadataDataDefinition().getUniqueId());
			}
			return product;
		}
		return Either.right(StorageOperationStatus.NOT_FOUND);
	}

	@Override
	public Product getDefaultComponent() {
		return new Product();
	}

	@Override
	protected <T extends org.openecomp.sdc.be.model.Component> StorageOperationStatus updateDerived(
			org.openecomp.sdc.be.model.Component component, org.openecomp.sdc.be.model.Component currentComponent,
			ComponentMetadataData componentData, Class<T> clazz) {
		log.debug("Derived class isn't supported for product");
		return StorageOperationStatus.OK;
	}

	@Override
	public Either<Integer, StorageOperationStatus> increaseAndGetComponentInstanceCounter(String componentId,
			boolean inTransaction) {
		return increaseAndGetComponentInstanceCounter(componentId, NodeTypeEnum.Product, inTransaction);
	}

	@Override
	protected StorageOperationStatus validateCategories(Component currentComponent, Component component,
			ComponentMetadataData componentData, NodeTypeEnum type) {
		// As agreed with Ella, update categories - delete old and create new
		StorageOperationStatus status = StorageOperationStatus.OK;
		List<CategoryDefinition> newcategories = component.getCategories();
		List<CategoryDefinition> currentcategories = currentComponent.getCategories();
		if (newcategories != null) {
			if (currentcategories != null && !currentcategories.isEmpty()) {
				Either<List<GroupingData>, StorageOperationStatus> findGroupingsForComponent = findGroupingsForComponent(
						NodeTypeEnum.ProductGrouping, currentComponent);
				if (findGroupingsForComponent.isRight()) {
					status = findGroupingsForComponent.right().value();
				}
				List<GroupingData> groupingDataToDissociate = findGroupingsForComponent.left().value();
				TitanOperationStatus titanStatus = dissociateCategoriesFromProduct((ProductMetadataData) componentData,
						groupingDataToDissociate);
				if (titanStatus != TitanOperationStatus.OK) {
					status = DaoStatusConverter.convertTitanStatusToStorageStatus(titanStatus);
				}
			}
			if (!newcategories.isEmpty()) {
				Either<List<GroupingData>, StorageOperationStatus> findGroupingsForComponent = findGroupingsForComponent(
						NodeTypeEnum.ProductGrouping, component);
				if (findGroupingsForComponent.isRight()) {
					status = findGroupingsForComponent.right().value();
				}
				List<GroupingData> groupingDataToAssociate = findGroupingsForComponent.left().value();
				TitanOperationStatus titanStatus = associateCategoriesToProduct((ProductMetadataData) componentData,
						groupingDataToAssociate);
				if (titanStatus != TitanOperationStatus.OK) {
					status = DaoStatusConverter.convertTitanStatusToStorageStatus(titanStatus);
				}
			}
		}
		return status;
	}

	@SuppressWarnings("unchecked")
	public Either<List<Product>, StorageOperationStatus> getFollowed(String userId,
			Set<LifecycleStateEnum> lifecycleStates, Set<LifecycleStateEnum> lastStateStates, boolean inTransaction) {
		return (Either<List<Product>, StorageOperationStatus>) (Either<?, StorageOperationStatus>) getFollowedComponent(
				userId, lifecycleStates, lastStateStates, inTransaction, titanGenericDao, NodeTypeEnum.Product);
	}

	@Override
	public Either<Component, StorageOperationStatus> getMetadataComponent(String id, boolean inTransaction) {
		return getMetadataComponent(id, NodeTypeEnum.Product, inTransaction);
	}

	@Override
	Component convertComponentMetadataDataToComponent(ComponentMetadataData componentMetadataData) {
		return convertProductDataToProduct((ProductMetadataData) componentMetadataData);
	}

	@Override
	public Either<Boolean, StorageOperationStatus> validateComponentNameExists(String productName) {
		return validateComponentNameUniqueness(productName, titanGenericDao, NodeTypeEnum.Product);
	}

	@SuppressWarnings("unchecked")
	@Override
	public Either<Component, StorageOperationStatus> markComponentToDelete(Component componentToDelete,
			boolean inTransaction) {
		// markComponentToDelete is not defined yet for products
		return (Either<Component, StorageOperationStatus>) (Either<?, StorageOperationStatus>) deleteProduct(
				componentToDelete.getUniqueId(), inTransaction);
	}

	@Override
	public void rollback() {
		titanGenericDao.rollback();

	}

	@Override
	public void commit() {
		titanGenericDao.commit();
	}

	@Override
	public Either<Boolean, StorageOperationStatus> isComponentInUse(String componentId) {
		return isComponentInUse(componentId, NodeTypeEnum.Product);
	}

	@Override
	public Either<List<String>, StorageOperationStatus> getAllComponentsMarkedForDeletion() {
		// markForDeletion for products is not implemented yet
		return Either.left(new ArrayList<>());
	}

	public Either<Product, StorageOperationStatus> getProductByNameAndVersion(String productName, String productVersion,
			boolean inTransaction) {
		return getByNamesAndVersion(GraphPropertiesDictionary.NORMALIZED_NAME.getProperty(),
				ValidationUtils.normaliseComponentName(productName), productVersion, null, inTransaction);
	}

	@SuppressWarnings("unchecked")
	@Override
	public <T> Either<T, StorageOperationStatus> getComponent(String id,
			ComponentParametersView componentParametersView, boolean inTransaction) {
		return (Either<T, StorageOperationStatus>) getProduct(id, false);
	}

	public Either<Product, StorageOperationStatus> updateProduct(Product product, boolean inTransaction,
			ComponentParametersView filterResultView) {
		return (Either<Product, StorageOperationStatus>) updateComponentFilterResult(product, inTransaction,
				titanGenericDao, product.getClass(), NodeTypeEnum.Service, filterResultView);
	}

	@Override
	protected <T> Either<T, StorageOperationStatus> updateComponentFilterResult(T component, boolean inTransaction,
			ComponentParametersView filterResultView) {
		return (Either<T, StorageOperationStatus>) updateProduct((Product) component, inTransaction, filterResultView);
	}
}