Support instance count on node template
[sdc.git] / common-be / src / main / java / org / openecomp / sdc / be / datatypes / enums / JsonPresentationFields.java
1 /*-
2  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *      http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 package org.openecomp.sdc.be.datatypes.enums;
16
17 import com.fasterxml.jackson.annotation.JsonCreator;
18 import com.fasterxml.jackson.annotation.JsonValue;
19 import lombok.AllArgsConstructor;
20 import lombok.Getter;
21 import lombok.ToString;
22
23 @AllArgsConstructor
24 @Getter
25 @ToString(onlyExplicitlyIncluded = true)
26 public enum JsonPresentationFields {
27     // @formatter:off
28     UNIQUE_ID("uniqueId", GraphPropertyEnum.UNIQUE_ID),
29     HIGHEST_VERSION("highestVersion", GraphPropertyEnum.IS_HIGHEST_VERSION),
30     LIFECYCLE_STATE("lifecycleState", GraphPropertyEnum.STATE),
31     CREATION_DATE("creationDate", null),
32     LAST_UPDATE_DATE("lastUpdateDate", null),
33     SYSTEM_NAME("systemName", GraphPropertyEnum.SYSTEM_NAME),
34     NAME("name", GraphPropertyEnum.NAME),
35     VERSION("version", GraphPropertyEnum.VERSION),
36     NORMALIZED_NAME("normalizedName", GraphPropertyEnum.NORMALIZED_NAME),
37     UUID("UUID", GraphPropertyEnum.UUID),
38     RESOURCE_TYPE("resourceType", GraphPropertyEnum.RESOURCE_TYPE),
39     COMPONENT_TYPE("componentType", GraphPropertyEnum.COMPONENT_TYPE),
40     IS_DELETED("isDeleted", GraphPropertyEnum.IS_DELETED),
41     ECOMP_GENERATED_NAMING("ecompGeneratedNaming", null),
42     NAMING_POLICY("namingPolicy", null),
43     ENVIRONMENT_CONTEXT("environmentContext", null),
44     TOSCA_RESOURCE_NAME("toscaResourceName", GraphPropertyEnum.TOSCA_RESOURCE_NAME),
45     DESCRIPTION("description", null),
46     TYPE("type", null),
47     DERIVED_FROM("derivedFrom", null),
48     VENDOR_NAME("vendorName", null),
49     VENDOR_RELEASE("vendorRelease", null),
50     CATEGORY("category", null),
51     SUB_CATEGORY("subcategory", null),
52     RESOURCE_VENDOR("resourceVendor", null),
53     RESOURCE_VENDOR_RELEASE("resourceVendorRelease", null),
54     RESOURCE_VENDOR_MODEL_NUMBER("reourceVendorModelNumber", null),
55     SERVICE_TYPE("serviceType", null),
56     SERVICE_ROLE("serviceRole", null),
57     INSTANTIATION_TYPE("instantiationType", null),
58     CONFORMANCE_LEVEL("conformanceLevel", null),
59     ICON("icon", null),
60     TAGS("tags", null),
61     INVARIANT_UUID("invariantUuid", GraphPropertyEnum.INVARIANT_UUID),
62     CSAR_UUID("csarUuid", GraphPropertyEnum.CSAR_UUID),
63     CSAR_VERSION("csarVersion", null),
64     CSAR_VERSION_ID("csarVersionId", null),
65     IMPORTED_TOSCA_CHECKSUM("importedToscaChecksum", null),
66     CONTACT_ID("contactId", null),
67     PROJECT_CODE("projectCode", null),
68     DISTRIBUTION_STATUS("distributionStatus", GraphPropertyEnum.DISTRIBUTION_STATUS),
69     DERIVED_FROM_GENERIC_TYPE("derivedFromGenericType", null),
70     DERIVED_FROM_GENERIC_VERSION("derivedFromGenericVersion", null),
71     SERVICE_FUNCTION("serviceFunction", null),
72     MODEL("model", null),
73     DATA_TYPES("data_types", GraphPropertyEnum.DATA_TYPES),
74
75     ////Inputs
76     ANNOTATIONS("annotations", null),
77     ////Artifact
78     ARTIFACT_TYPE("artifactType", null),
79     ARTIFACT_REF("artifactRef", null),
80     ARTIFACT_REPOSITORY("artifactRepository", null),
81     ARTIFACT_CHECKSUM("artifactChecksum", null),
82     ARTIFACT_CREATOR("artifactCreator", null),
83     USER_ID_CREATOR("userIdCreator", null),
84     USER_ID_LAST_UPDATER("userIdLastUpdater", null),
85     CREATOR_FULL_NAME("creatorFullName", null),
86     UPDATER_FULL_NAME("updaterFullName", null),
87     IS_FROM_CSAR("isFromCsar", null),
88
89     ES_ID("esId", null),
90     ARTIFACT_LABEL("artifactLabel", null),
91     IS_ABSTRACT("mandatory", null),
92     ARTIFACT_DISPLAY_NAME("artifactDisplayName", null),
93     API_URL("apiUrl", null),
94     SERVICE_API("serviceApi", null),
95     ARTIFACT_VERSION("artifactVersion", null),
96     ARTIFACT_UUID("artifactUUID", null),
97     PAYLOAD_UPDATE_DATE("payloadUpdateDate", null),
98     HEAT_PARAMS_UPDATE_DATE("heatParamsUpdateDate", null),
99     GENERATED("generated", null),
100     ARTIFACT_GROUP_TYPE("artifactGroupType", null),
101     ARTIFACT_TIMEOUT("timeout", null),
102     REQUIRED_ARTIFACTS("requiredArtifacts", null),
103     DUPLICATED("duplicated", null),
104     HEAT_PARAMETERS("heatParameters", null),
105     GENERATED_FROM_ID("generatedFromId", null),
106
107     // end artifacts
108
109     //property
110     DEFINITION("definition", null),
111     DEFAULT_VALUE("defaultValue", null),
112     DEFAULT("default", null),
113     REQUIRED("required", null),
114     PASSWORD("password", null),
115     CONSTRAINTS("constraints", null),
116     PROPERTIES("properties", null),
117     PROPERTY("property", null),
118     SCHEMA("schema", null),
119     ENTRY_SCHEMA("entry_schema", null),
120     VALUE("value", null),
121     PARENT_UNIQUE_ID("parentUniqueId", null),
122
123     COMPONENT_INSTANCES("componentInstances", null),
124     RELATIONS("relations", null),
125
126     //attribute
127     STATUS("status", null),
128     //capability
129     VALID_SOURCE_TYPE("validSourceTypes", null),
130     CREATION_TIME("creationTime", null),
131     MODIFICATION_TIME("modificationTime", null),
132     CAPABILITY_SOURCES("capabilitySources", null),
133     MAX_OCCURRENCES("maxOccurrences", null),
134     MIN_OCCURRENCES("minOccurrences", null),
135     OWNER_TYPE("ownerType", null),
136     OWNER_NAME("ownerName", null),
137     OWNER_ID("ownerId", null),
138     LEFT_OCCURRENCES("leftOccurences", null),
139     CAPABILITY_ID("capabiltyId", null),
140     PATH("path", null),
141     SOURCE("source", null),
142
143     //Requirement
144     CAPABILITY("capability", null),
145     NODE("node", null),
146     RELATIONSHIP("relationship", null),
147     VALID_SOURCE_TYPES("validSourceTypes", null),
148     VALID_TARGET_TYPES("validTargetTypes", null),
149     REQUIREMENT_ID("requirementId", null),
150     PARENT_NAME("parentName", null),
151     PREVIOUS_NAME("previousName", null),
152     NODE_FILTER_CAPABILITIES("capabilities", null),
153     PROPERTY_FILTER_NAME("propertyName", null),
154     PROPERTY_FILTER_CONSTRAINT("propertyFilterConstraint", null),
155     EQUAL_CONSTRAINT("equal", null),
156     CONSTRAINT_VALUE("constraintValue", null),
157     CONSTRAINT_FUNCTION("constraintFunction", null),
158     NODE_FILTER("nodeFilter", null),
159     TOSCA_ID("tosca_id", null),
160
161     //Relation
162     CAPABILTY_OWNER_ID("capabilityOwnerId", null), REQUIREMENT_OWNER_ID("requirementOwnerId", null), FROM_ID("fromId", null), TO_ID("toId",
163         null), REQUIREMENT("requirement", null), ORIGIN_UI("originUI", null),
164     //Groups
165
166     GROUP_INVARIANT_UUID("invariantUUID", null),
167     GROUP_UUID("groupUUID", null),
168     GROUP_MEMBER("members", null),
169     GROUP_ARTIFACTS("artifacts", null),
170     GROUP_ARTIFACTS_UUID("artifactsUuid", null),
171     GROUP_PROPERTIES("properties", null),
172     GROUP_UNIQUE_ID("groupUid", null),
173     POS_X("posX", null),
174     POS_Y("posY", null),
175     PROPERTY_VALUE_COUNTER("propertyValueCounter", null),
176     CUSTOMIZATION_UUID("customizationUUID", null),
177     GROUP_NAME("groupName", null),
178     GROUP_INSTANCE_ARTIFACTS("groupInstanceArtifacts", null),
179     GROUP_INSTANCE_ARTIFACTS_UUID("groupInstanceArtifactsUuid", null),
180     GROUP_INSTANCE_PROPERTIES("groupInstancesProperties", null),
181
182     //Component instance
183
184     CI_COMPONENT_UID("componentUid", null),
185     CI_POS_X("posX", null),
186     CI_POS_Y("posY", null),
187     CI_PROP_VALUE_COUNTER("propertyValueCounter", null),
188     CI_ATTR_VALUE_COUNTER("attributeValueCounter", null),
189     CI_INPUT_VALUE_COUNTER("inputValueCounter", null),
190     CI_ORIGIN_TYPE("originType", null),
191     CI_COMPONENT_NAME("componentName", null),
192     CI_COMPONENT_VERSION("componentVersion", null),
193     CI_TOSCA_COMPONENT_NAME("toscaComponentName", null),
194     CI_INVARIANT_NAME("invariantName", null),
195     CI_ICON("icon", null),
196     CI_SOURCE_MODEL_UUID("sourceModelUuid", null),
197     CI_SOURCE_MODEL_UID("sourceModelUid", null),
198     CI_SOURCE_MODEL_INVARIANT("sourceModelInvariant", null),
199     CI_SOURCE_MODEL_NAME("sourceModelName", null),
200     CI_IS_PROXY("isProxy", null),
201     CI_DIRECTIVES("directives", null),
202     CI_ARTIFACTS("artifacts", null),
203     CI_MAX_OCCURRENCES("maxOccurrences", null),
204     CI_MIN_OCCURRENCES("minOccurrences", null),
205     CI_INSTANCE_COUNT("instanceCount", null),
206
207     //path
208     FORWARDING_PATH("forwardingPath", null),
209     FROM_NODE("fromNode", null),
210     TO_NODE("toNode", null),
211     PATH_FROM_CP("fromCP", null),
212     PATH_TO_CP("toCP", null),
213     PATH_TO_CP_ORIGIN("toCPOrigin", null),
214     PATH_FROM_CP_ORIGIN("fromCPOrigin", null),
215     PATH_NAME("pathName", null),
216     PATH_PROTOCOL("pathProtocol", null),
217     PATH_DESTINATION_PORT_NUMBER("destinationPortNumber", null),
218     PATH_ELEMENT_LIST("pathElementList", null),
219
220     TYPE_UNIQUE_ID("typeUniqueId", null),
221     METADATA("metadata", null),
222     TARGETS("targets", null),
223
224     //External Refs
225     EXTERNAL_REF("externalRef", null), CREATED_FROM("createdFrom", null),
226     //Archive
227     IS_ARCHIVED("isArchived", GraphPropertyEnum.IS_ARCHIVED),
228     ARCHIVE_TIME("archiveTime", GraphPropertyEnum.ARCHIVE_TIME),
229     IS_VSP_ARCHIVED("isVspArchived", GraphPropertyEnum.IS_VSP_ARCHIVED),
230     CI_IS_ORIGIN_ARCHIVED("isOriginArchived", null),
231
232     //Interface Operation
233     IO_OPERATION_TYPE("operationType", null),
234     IO_INPUT_PARAMETERS("inputParams", null),
235     IO_OUTPUT_PARAMETERS("outputParams", null),
236     IO_PARAM_NAME("paramName", null),
237     IO_PARAM_ID("paramId", null),
238     IO_NAME("name", null),
239     IO_MANDATORY("mandatory", null),
240     IO_TYPE("type", null),
241     IO_PROPERTY("property", null),
242     IO_WORKFLOW_NAME("workflowName", null),
243     IO_WORKFLOW_VERSION("workflowVersion", null),
244     IO_WORKFLOW_ID("workflowId", null),
245     IO_WORKFLOW_VERSION_ID("workflowVersionId", null),
246     IO_WORKFLOW_ASSOCIATION_TYPE("workflowAssociationType", null),
247
248     //Interface
249     INTERFACES("interfaces", null),
250     INTERFACE_INPUT("input", null),
251     OPERATIONS("operations", null),
252     OPERATION_IMPLEMENTATION("implementation", null),
253     OPERATION_INPUTS("inputs", null),
254     OPERATION_OUTPUTS("outputs", null),
255     INPUTS("inputs", null),
256
257     GET_PROPERTY("get_property", null),
258     GET_INPUT("get_input", null),
259     GET_OPERATION_OUTPUT("get_operation_output", null),
260
261     ATTRIBUTES("attributes", null),
262
263     TOSCA_DEFINITIONS_VERSION("tosca_definitions_version", null);
264     // @formatter:on
265
266     @ToString.Include
267     private final String presentation;
268     @ToString.Exclude
269     private final GraphPropertyEnum storedAs;
270
271     public static String getPresentationByGraphProperty(GraphPropertyEnum property) {
272         for (JsonPresentationFields currPresentation : JsonPresentationFields.values()) {
273             if (currPresentation.getStoredAs() == property) {
274                 return currPresentation.getPresentation();
275             }
276         }
277         return null;
278     }
279
280     @JsonCreator
281     public static JsonPresentationFields getByPresentation(String presentation) {
282         for (JsonPresentationFields inst : JsonPresentationFields.values()) {
283             if (inst.getPresentation().equals(presentation)) {
284                 return inst;
285             }
286         }
287         return null;
288     }
289
290     @JsonValue
291     public String getPresentation() {
292         return presentation;
293     }
294 }