4cdf0508c75ed987f66fd8d4e4bb2acffd0b56ea
[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     IMPORTED_TOSCA_CHECKSUM("importedToscaChecksum", null),
65     CONTACT_ID("contactId", null),
66     PROJECT_CODE("projectCode", null),
67     DISTRIBUTION_STATUS("distributionStatus", GraphPropertyEnum.DISTRIBUTION_STATUS),
68     DERIVED_FROM_GENERIC_TYPE("derivedFromGenericType", null),
69     DERIVED_FROM_GENERIC_VERSION("derivedFromGenericVersion", null),
70     SERVICE_FUNCTION("serviceFunction", null),
71
72     DATA_TYPES("data_types", GraphPropertyEnum.DATA_TYPES),
73
74     ////Inputs
75     ANNOTATIONS("annotations", null),
76     ////Artifact
77     ARTIFACT_TYPE("artifactType", null),
78     ARTIFACT_REF("artifactRef", null),
79     ARTIFACT_REPOSITORY("artifactRepository", null),
80     ARTIFACT_CHECKSUM("artifactChecksum", null),
81     ARTIFACT_CREATOR("artifactCreator", null),
82     USER_ID_CREATOR("userIdCreator", null),
83     USER_ID_LAST_UPDATER("userIdLastUpdater", null),
84     CREATOR_FULL_NAME("creatorFullName", null),
85     UPDATER_FULL_NAME("updaterFullName", null),
86     IS_FROM_CSAR("isFromCsar", null),
87
88     ES_ID("esId", null),
89     ARTIFACT_LABEL("artifactLabel", null),
90     IS_ABSTRACT("mandatory", null),
91     ARTIFACT_DISPLAY_NAME("artifactDisplayName", null),
92     API_URL("apiUrl", null),
93     SERVICE_API("serviceApi", null),
94     ARTIFACT_VERSION("artifactVersion", null),
95     ARTIFACT_UUID("artifactUUID", null),
96     PAYLOAD_UPDATE_DATE("payloadUpdateDate", null),
97     HEAT_PARAMS_UPDATE_DATE("heatParamsUpdateDate", null),
98     GENERATED("generated", null),
99     ARTIFACT_GROUP_TYPE("artifactGroupType", null),
100     ARTIFACT_TIMEOUT("timeout", null),
101     REQUIRED_ARTIFACTS("requiredArtifacts", null),
102     DUPLICATED("duplicated", null),
103     HEAT_PARAMETERS("heatParameters", null),
104     GENERATED_FROM_ID("generatedFromId", null),
105
106     // end artifacts
107
108     //property
109     DEFINITION("definition", null),
110     DEFAULT_VALUE("defaultValue", null),
111     DEFAULT("default", null),
112     REQUIRED("required", null),
113     PASSWORD("password", null),
114     CONSTRAINTS("constraints", null),
115     PROPERTIES("properties", null),
116     PROPERTY("property", null),
117     SCHEMA("schema", null),
118     ENTRY_SCHEMA("entry_schema", null),
119     VALUE("value", null),
120     PARENT_UNIQUE_ID("parentUniqueId", null),
121
122     COMPONENT_INSTANCES("componentInstances", null),
123     RELATIONS("relations", null),
124
125     //attribute
126     STATUS("status", null),
127     //capability
128     VALID_SOURCE_TYPE("validSourceTypes", null),
129     CREATION_TIME("creationTime", null),
130     MODIFICATION_TIME("modificationTime", null),
131     CAPABILITY_SOURCES("capabilitySources", null),
132     MAX_OCCURRENCES("maxOccurrences", null),
133     MIN_OCCURRENCES("minOccurrences", null),
134     OWNER_TYPE("ownerType", null),
135     OWNER_NAME("ownerName", null),
136     OWNER_ID("ownerId", null),
137     LEFT_OCCURRENCES("leftOccurences", null),
138     CAPABILITY_ID("capabiltyId", null),
139     PATH("path", null),
140     SOURCE("source", null),
141
142     //Requirement
143     CAPABILITY("capability", null),
144     NODE("node", null),
145     RELATIONSHIP("relationship", null),
146     VALID_SOURCE_TYPES("validSourceTypes", null),
147     VALID_TARGET_TYPES("validTargetTypes", null),
148     REQUIREMENT_ID("requirementId", null),
149     PARENT_NAME("parentName", null),
150     PREVIOUS_NAME("previousName", null),
151     NODE_FILTER_CAPABILITIES("capabilities", null),
152     PROPERTY_FILTER_NAME("propertyName", null),
153     PROPERTY_FILTER_CONSTRAINT("propertyFilterConstraint", null),
154     EQUAL_CONSTRAINT("equal", null),
155     CONSTRAINT_VALUE("constraintValue", null),
156     CONSTRAINT_FUNCTION("constraintFunction", null),
157     NODE_FILTER("nodeFilter", null),
158     TOSCA_ID("tosca_id", null),
159
160     //Relation
161     CAPABILTY_OWNER_ID("capabilityOwnerId", null), REQUIREMENT_OWNER_ID("requirementOwnerId", null), FROM_ID("fromId", null), TO_ID("toId",
162         null), REQUIREMENT("requirement", null), ORIGIN_UI("originUI", null),
163     //Groups
164
165     GROUP_INVARIANT_UUID("invariantUUID", null),
166     GROUP_UUID("groupUUID", null),
167     GROUP_MEMBER("members", null),
168     GROUP_ARTIFACTS("artifacts", null),
169     GROUP_ARTIFACTS_UUID("artifactsUuid", null),
170     GROUP_PROPERTIES("properties", null),
171     GROUP_UNIQUE_ID("groupUid", null),
172     POS_X("posX", null),
173     POS_Y("posY", null),
174     PROPERTY_VALUE_COUNTER("propertyValueCounter", null),
175     CUSTOMIZATION_UUID("customizationUUID", null),
176     GROUP_NAME("groupName", null),
177     GROUP_INSTANCE_ARTIFACTS("groupInstanceArtifacts", null),
178     GROUP_INSTANCE_ARTIFACTS_UUID("groupInstanceArtifactsUuid", null),
179     GROUP_INSTANCE_PROPERTIES("groupInstancesProperties", null),
180
181     //Component instance
182
183     CI_COMPONENT_UID("componentUid", null),
184     CI_POS_X("posX", null),
185     CI_POS_Y("posY", null),
186     CI_PROP_VALUE_COUNTER("propertyValueCounter", null),
187     CI_ATTR_VALUE_COUNTER("attributeValueCounter", null),
188     CI_INPUT_VALUE_COUNTER("inputValueCounter", null),
189     CI_ORIGIN_TYPE("originType", null),
190     CI_COMPONENT_NAME("componentName", null),
191     CI_COMPONENT_VERSION("componentVersion", null),
192     CI_TOSCA_COMPONENT_NAME("toscaComponentName", null),
193     CI_INVARIANT_NAME("invariantName", null),
194     CI_ICON("icon", null),
195     CI_SOURCE_MODEL_UUID("sourceModelUuid", null),
196     CI_SOURCE_MODEL_UID("sourceModelUid", null),
197     CI_SOURCE_MODEL_INVARIANT("sourceModelInvariant", null),
198     CI_SOURCE_MODEL_NAME("sourceModelName", null),
199     CI_IS_PROXY("isProxy", null),
200     CI_DIRECTIVES("directives", null),
201     CI_ARTIFACTS("artifacts", null),
202
203     //path
204     FORWARDING_PATH("forwardingPath", null),
205     FROM_NODE("fromNode", null),
206     TO_NODE("toNode", null),
207     PATH_FROM_CP("fromCP", null),
208     PATH_TO_CP("toCP", null),
209     PATH_TO_CP_ORIGIN("toCPOrigin", null),
210     PATH_FROM_CP_ORIGIN("fromCPOrigin", null),
211     PATH_NAME("pathName", null),
212     PATH_PROTOCOL("pathProtocol", null),
213     PATH_DESTINATION_PORT_NUMBER("destinationPortNumber", null),
214     PATH_ELEMENT_LIST("pathElementList", null),
215
216     TYPE_UNIQUE_ID("typeUniqueId", null),
217     METADATA("metadata", null),
218     TARGETS("targets", null),
219
220     //External Refs
221     EXTERNAL_REF("externalRef", null), CREATED_FROM("createdFrom", null),
222     //Archive
223     IS_ARCHIVED("isArchived", GraphPropertyEnum.IS_ARCHIVED),
224     ARCHIVE_TIME("archiveTime", GraphPropertyEnum.ARCHIVE_TIME),
225     IS_VSP_ARCHIVED("isVspArchived", GraphPropertyEnum.IS_VSP_ARCHIVED),
226     CI_IS_ORIGIN_ARCHIVED("isOriginArchived", null),
227
228     //Interface Operation
229     IO_OPERATION_TYPE("operationType", null),
230     IO_INPUT_PARAMETERS("inputParams", null),
231     IO_OUTPUT_PARAMETERS("outputParams", null),
232     IO_PARAM_NAME("paramName", null),
233     IO_PARAM_ID("paramId", null),
234     IO_NAME("name", null),
235     IO_MANDATORY("mandatory", null),
236     IO_TYPE("type", null),
237     IO_PROPERTY("property", null),
238     IO_WORKFLOW_NAME("workflowName", null),
239     IO_WORKFLOW_VERSION("workflowVersion", null),
240     IO_WORKFLOW_ID("workflowId", null),
241     IO_WORKFLOW_VERSION_ID("workflowVersionId", null),
242     IO_WORKFLOW_ASSOCIATION_TYPE("workflowAssociationType", null),
243
244     //Interface
245     INTERFACES("interfaces", null),
246     INTERFACE_INPUT("input", null),
247     OPERATIONS("operations", null),
248     OPERATION_IMPLEMENTATION("implementation", null),
249     OPERATION_INPUTS("inputs", null),
250     OPERATION_OUTPUTS("outputs", null),
251     INPUTS("inputs", null),
252
253     GET_PROPERTY("get_property", null),
254     GET_INPUT("get_input", null),
255     GET_OPERATION_OUTPUT("get_operation_output", null),
256
257     ATTRIBUTES("attributes", null),
258
259     TOSCA_DEFINITIONS_VERSION("tosca_definitions_version", null);
260     // @formatter:on
261
262     @ToString.Include
263     private final String presentation;
264     @ToString.Exclude
265     private final GraphPropertyEnum storedAs;
266
267     public static String getPresentationByGraphProperty(GraphPropertyEnum property) {
268         for (JsonPresentationFields currPresentation : JsonPresentationFields.values()) {
269             if (currPresentation.getStoredAs() == property) {
270                 return currPresentation.getPresentation();
271             }
272         }
273         return null;
274     }
275
276     @JsonCreator
277     public static JsonPresentationFields getByPresentation(String presentation) {
278         for (JsonPresentationFields inst : JsonPresentationFields.values()) {
279             if (inst.getPresentation().equals(presentation)) {
280                 return inst;
281             }
282         }
283         return null;
284     }
285
286     @JsonValue
287     public String getPresentation() {
288         return presentation;
289     }
290 }