ebc563268eb1fb7524cabbd0e509d2f4050cb7a9
[sdc.git] / catalog-model / src / main / java / org / openecomp / sdc / be / model / operations / api / IElementOperation.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20 package org.openecomp.sdc.be.model.operations.api;
21
22 import fj.data.Either;
23 import java.util.ArrayList;
24 import java.util.List;
25 import java.util.Map;
26 import org.openecomp.sdc.be.config.Configuration;
27 import org.openecomp.sdc.be.dao.api.ActionStatus;
28 import org.openecomp.sdc.be.dao.graph.datatype.GraphNode;
29 import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
30 import org.openecomp.sdc.be.model.ArtifactType;
31 import org.openecomp.sdc.be.model.BaseType;
32 import org.openecomp.sdc.be.model.PropertyScope;
33 import org.openecomp.sdc.be.model.Tag;
34 import org.openecomp.sdc.be.model.category.CategoryDefinition;
35 import org.openecomp.sdc.be.model.category.GroupingDefinition;
36 import org.openecomp.sdc.be.model.category.SubCategoryDefinition;
37 import org.openecomp.sdc.be.resources.data.CategoryData;
38
39 public interface IElementOperation {
40
41     Either<List<CategoryDefinition>, ActionStatus> getAllResourceCategories();
42
43     Either<List<CategoryDefinition>, ActionStatus> getAllServiceCategories();
44
45     Either<List<CategoryDefinition>, ActionStatus> getAllProductCategories();
46
47     Either<List<Tag>, ActionStatus> getAllTags();
48
49     Either<List<PropertyScope>, ActionStatus> getAllPropertyScopes();
50
51     List<ArtifactType> getAllArtifactTypes();
52
53     Either<Configuration.HeatDeploymentArtifactTimeout, ActionStatus> getDefaultHeatTimeout();
54
55     <T extends GraphNode> Either<CategoryData, StorageOperationStatus> getCategoryData(String name, NodeTypeEnum type, Class<T> clazz);
56
57     <T extends GraphNode> Either<org.openecomp.sdc.be.resources.data.category.CategoryData, StorageOperationStatus> getNewCategoryData(String name,
58                                                                                                                                        NodeTypeEnum type,
59                                                                                                                                        Class<T> clazz);
60
61     Either<Map<String, String>, ActionStatus> getResourceTypesMap();
62
63     Either<CategoryDefinition, ActionStatus> createCategory(CategoryDefinition category, NodeTypeEnum nodeType);
64
65     Either<CategoryDefinition, ActionStatus> createCategory(CategoryDefinition category, NodeTypeEnum nodeType, boolean inTransaction);
66
67     Either<CategoryDefinition, ActionStatus> updateCategory(CategoryDefinition category, NodeTypeEnum nodeType);
68
69     Either<CategoryDefinition, ActionStatus> updateCategory(CategoryDefinition category, NodeTypeEnum nodeType, boolean inTransaction);
70
71     Either<CategoryDefinition, ActionStatus> deleteCategory(NodeTypeEnum nodeType, String categoryId);
72
73     Either<SubCategoryDefinition, ActionStatus> deleteSubCategory(NodeTypeEnum nodeType, String subCategoryId);
74
75     Either<Boolean, ActionStatus> isCategoryUniqueForType(NodeTypeEnum nodeType, String normalizedName);
76
77     Either<SubCategoryDefinition, ActionStatus> createSubCategory(String categoryId, SubCategoryDefinition subCategory, NodeTypeEnum nodeType);
78
79     Either<SubCategoryDefinition, ActionStatus> createSubCategory(String categoryId, SubCategoryDefinition subCategory, NodeTypeEnum nodeType,
80                                                                   boolean inTransaction);
81
82     Either<SubCategoryDefinition, ActionStatus> updateSubCategory(String subCategoryId, SubCategoryDefinition subCategory, NodeTypeEnum nodeType);
83
84     Either<SubCategoryDefinition, ActionStatus> updateSubCategory(String subCategoryId, SubCategoryDefinition subCategory, NodeTypeEnum nodeType,
85                                                                   boolean inTransaction);
86
87     Either<List<CategoryDefinition>, ActionStatus> getAllCategories(NodeTypeEnum nodeType, boolean inTransaction);
88     
89     List<BaseType> getServiceBaseTypes(String categoryName, String modelName);
90
91     /**
92      * Checks if a category requires a base type.
93      *
94      * @param categoryName the category name
95      * @return {@code true} if a base type is required, {@code false} otherwise.
96      */
97     boolean isBaseTypeRequired(String categoryName);
98
99     Either<CategoryDefinition, ActionStatus> getCategory(NodeTypeEnum nodeType, String categoryId);
100
101     Either<SubCategoryDefinition, ActionStatus> getSubCategoryUniqueForType(NodeTypeEnum nodeType, String normalizedName);
102
103     Either<Boolean, ActionStatus> isSubCategoryUniqueForCategory(NodeTypeEnum nodeType, String subCategoryNormName, String parentCategoryId);
104
105     Either<GroupingDefinition, ActionStatus> createGrouping(String subCategoryId, GroupingDefinition grouping, NodeTypeEnum nodeType);
106
107     Either<GroupingDefinition, ActionStatus> deleteGrouping(NodeTypeEnum nodeType, String groupingId);
108
109     Either<SubCategoryDefinition, ActionStatus> getSubCategory(NodeTypeEnum nodeType, String subCategoryId);
110
111     Either<Boolean, ActionStatus> isGroupingUniqueForSubCategory(NodeTypeEnum nodeType, String groupingNormName, String parentSubCategoryId);
112
113     Either<GroupingDefinition, ActionStatus> getGroupingUniqueForType(NodeTypeEnum nodeType, String groupingNormalizedName);
114 }