Fix import VFC with attributes
[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
16 package org.openecomp.sdc.be.datatypes.enums;
17
18 import com.fasterxml.jackson.annotation.JsonCreator;
19 import com.fasterxml.jackson.annotation.JsonValue;
20 import lombok.AllArgsConstructor;
21 import lombok.Getter;
22 import lombok.ToString;
23
24 @AllArgsConstructor
25 @Getter
26 @ToString(onlyExplicitlyIncluded = true)
27 public enum JsonPresentationFields {
28
29     UNIQUE_ID("uniqueId", GraphPropertyEnum.UNIQUE_ID),
30     HIGHEST_VERSION("highestVersion", GraphPropertyEnum.IS_HIGHEST_VERSION),
31     LIFECYCLE_STATE("lifecycleState", GraphPropertyEnum.STATE),
32     CREATION_DATE("creationDate", null),
33     LAST_UPDATE_DATE("lastUpdateDate", null),
34     SYSTEM_NAME("systemName", GraphPropertyEnum.SYSTEM_NAME),
35     NAME("name", GraphPropertyEnum.NAME),
36     VERSION("version", GraphPropertyEnum.VERSION),
37     NORMALIZED_NAME("normalizedName", GraphPropertyEnum.NORMALIZED_NAME),
38     UUID("UUID", GraphPropertyEnum.UUID),
39     RESOURCE_TYPE("resourceType", GraphPropertyEnum.RESOURCE_TYPE),
40     COMPONENT_TYPE("componentType", GraphPropertyEnum.COMPONENT_TYPE),
41     IS_DELETED("isDeleted", GraphPropertyEnum.IS_DELETED),
42     ECOMP_GENERATED_NAMING("ecompGeneratedNaming", null),
43     NAMING_POLICY("namingPolicy", null),
44     ENVIRONMENT_CONTEXT("environmentContext", null),
45     TOSCA_RESOURCE_NAME("toscaResourceName", GraphPropertyEnum.TOSCA_RESOURCE_NAME),
46     DESCRIPTION("description", null),
47     TYPE("type", null),
48     DERIVED_FROM("derivedFrom", null),
49     VENDOR_NAME("vendorName", null),
50     VENDOR_RELEASE("vendorRelease", null),
51     RESOURCE_VENDOR_MODEL_NUMBER("reourceVendorModelNumber", null),
52     SERVICE_TYPE("serviceType", null),
53     SERVICE_ROLE("serviceRole", null),
54     INSTANTIATION_TYPE("instantiationType", null),
55     CONFORMANCE_LEVEL("conformanceLevel", null),
56     ICON("icon", null),
57     TAGS("tags", null),
58     INVARIANT_UUID("invariantUuid", GraphPropertyEnum.INVARIANT_UUID),
59     CSAR_UUID("csarUuid", GraphPropertyEnum.CSAR_UUID),
60     CSAR_VERSION("csarVersion", null),
61     IMPORTED_TOSCA_CHECKSUM("importedToscaChecksum", null),
62     CONTACT_ID("contactId", null),
63     PROJECT_CODE("projectCode", null),
64     DISTRIBUTION_STATUS("distributionStatus", GraphPropertyEnum.DISTRIBUTION_STATUS),
65     DERIVED_FROM_GENERIC_TYPE("derivedFromGenericType", null),
66     DERIVED_FROM_GENERIC_VERSION("derivedFromGenericVersion", null),
67     SERVICE_FUNCTION("serviceFunction", null),
68
69     DATA_TYPES("data_types", GraphPropertyEnum.DATA_TYPES),
70
71     ////Inputs
72     ANNOTATIONS("annotations", null),
73
74     ////Artifact
75     ARTIFACT_TYPE("artifactType", null),
76     ARTIFACT_REF("artifactRef", null),
77     ARTIFACT_REPOSITORY("artifactRepository", null),
78     ARTIFACT_CHECKSUM("artifactChecksum", null),
79     ARTIFACT_CREATOR("artifactCreator", null),
80     USER_ID_CREATOR("userIdCreator", null),
81     USER_ID_LAST_UPDATER("userIdLastUpdater", null),
82     CREATOR_FULL_NAME("creatorFullName", null),
83     UPDATER_FULL_NAME("updaterFullName", null),
84     IS_FROM_CSAR("isFromCsar", null),
85
86     ES_ID("esId", null),
87     ARTIFACT_LABEL("artifactLabel", null),
88     IS_ABSTRACT("mandatory", null),
89     ARTIFACT_DISPLAY_NAME("artifactDisplayName", null),
90     API_URL("apiUrl", null),
91     SERVICE_API("serviceApi", null),
92     ARTIFACT_VERSION("artifactVersion", null),
93     ARTIFACT_UUID("artifactUUID", null),
94     PAYLOAD_UPDATE_DATE("payloadUpdateDate", null),
95     HEAT_PARAMS_UPDATE_DATE("heatParamsUpdateDate", null),
96     GENERATED("generated", null),
97     ARTIFACT_GROUP_TYPE("artifactGroupType", null),
98     ARTIFACT_TIMEOUT("timeout", null),
99     REQUIRED_ARTIFACTS("requiredArtifacts", null),
100     DUPLICATED("duplicated", null),
101     HEAT_PARAMETERS("heatParameters", null),
102     GENERATED_FROM_ID("generatedFromId", null),
103
104
105     // end artifacts
106
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     VALUE("value", null),
119     PARENT_UNIQUE_ID("parentUniqueId", null),
120
121     COMPONENT_INSTANCES("componentInstances", null),
122     RELATIONS("relations", null),
123
124     //attribute
125     STATUS("status", null),
126     //capability
127     VALID_SOURCE_TYPE("validSourceTypes", null),
128     CREATION_TIME("creationTime", null),
129     MODIFICATION_TIME("modificationTime", null),
130     CAPABILITY_SOURCES("capabilitySources", null),
131     MAX_OCCURRENCES("maxOccurrences", null),
132     MIN_OCCURRENCES("minOccurrences", null),
133     OWNER_TYPE("ownerType", null),
134     OWNER_NAME("ownerName", null),
135     OWNER_ID("ownerId", null),
136     LEFT_OCCURRENCES("leftOccurences", null),
137     CAPABILITY_ID("capabiltyId", null),
138     PATH("path", null),
139     SOURCE("source", null),
140
141     //Requirement
142     CAPABILITY("capability", null),
143     NODE("node", null),
144     RELATIONSHIP("relationship", null),
145     VALID_SOURCE_TYPES("validSourceTypes", null),
146     VALID_TARGET_TYPES("validTargetTypes", null),
147     REQUIREMENT_ID("requirementId", null),
148     PARENT_NAME("parentName", null),
149     PREVIOUS_NAME("previousName", null),
150     NODE_FILTER_CAPABILITIES("capabilities", null),
151     PROPERTY_FILTER_NAME("propertyName", null),
152     PROPERTY_FILTER_CONSTRAINT("propertyFilterConstraint", null),
153     EQUAL_CONSTRAINT("equal", null),
154     CONSTRAINT_VALUE("constraintValue", null),
155     CONSTRAINT_FUNCTION("constraintFunction", null),
156     NODE_FILTER("nodeFilter", null),
157     TOSCA_ID("tosca_id", null),
158
159     //Relation
160     CAPABILTY_OWNER_ID("capabilityOwnerId", null),
161     REQUIREMENT_OWNER_ID("requirementOwnerId", null),
162     FROM_ID("fromId", null),
163     TO_ID("toId", null),
164     REQUIREMENT("requirement", null),
165     ORIGIN_UI("originUI", null),
166
167     //Groups
168
169     GROUP_INVARIANT_UUID("invariantUUID", null),
170     GROUP_UUID("groupUUID", null),
171     GROUP_MEMBER("members", null),
172     GROUP_ARTIFACTS("artifacts", null),
173     GROUP_ARTIFACTS_UUID("artifactsUuid", null),
174     GROUP_PROPERTIES("properties", null),
175     GROUP_UNIQUE_ID("groupUid", null),
176     POS_X("posX", null),
177     POS_Y("posY", null),
178     PROPERTY_VALUE_COUNTER("propertyValueCounter", null),
179     CUSTOMIZATION_UUID("customizationUUID", null),
180     GROUP_NAME("groupName", null),
181     GROUP_INSTANCE_ARTIFACTS("groupInstanceArtifacts", null),
182     GROUP_INSTANCE_ARTIFACTS_UUID("groupInstanceArtifactsUuid", null),
183     GROUP_INSTANCE_PROPERTIES("groupInstancesProperties", null),
184
185     //Component instance
186
187     CI_COMPONENT_UID("componentUid", null),
188     CI_POS_X("posX", null),
189     CI_POS_Y("posY", null),
190     CI_PROP_VALUE_COUNTER("propertyValueCounter", null),
191     CI_ATTR_VALUE_COUNTER("attributeValueCounter", null),
192     CI_INPUT_VALUE_COUNTER("inputValueCounter", null),
193     CI_ORIGIN_TYPE("originType", null),
194     CI_COMPONENT_NAME("componentName", null),
195     CI_COMPONENT_VERSION("componentVersion", null),
196     CI_TOSCA_COMPONENT_NAME("toscaComponentName", null),
197     CI_INVARIANT_NAME("invariantName", null),
198     CI_ICON("icon", null),
199     CI_SOURCE_MODEL_UUID("sourceModelUuid", null),
200     CI_SOURCE_MODEL_UID("sourceModelUid", null),
201     CI_SOURCE_MODEL_INVARIANT("sourceModelInvariant", null),
202     CI_SOURCE_MODEL_NAME("sourceModelName", null),
203     CI_IS_PROXY("isProxy", null),
204     CI_DIRECTIVES("directives", null),
205     CI_ARTIFACTS("artifacts", 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),
226     CREATED_FROM("createdFrom", null),
227
228     //Archive
229     IS_ARCHIVED("isArchived", GraphPropertyEnum.IS_ARCHIVED),
230     ARCHIVE_TIME("archiveTime", GraphPropertyEnum.ARCHIVE_TIME),
231     IS_VSP_ARCHIVED("isVspArchived", GraphPropertyEnum.IS_VSP_ARCHIVED),
232     CI_IS_ORIGIN_ARCHIVED("isOriginArchived", null),
233
234         //Interface Operation
235         IO_OPERATION_TYPE("operationType",null),
236         IO_INPUT_PARAMETERS("inputParams",null),
237         IO_OUTPUT_PARAMETERS("outputParams",null),
238     IO_PARAM_NAME("paramName", null),
239     IO_PARAM_ID("paramId", null),
240     IO_NAME("name", null),
241         IO_MANDATORY("mandatory", null),
242         IO_TYPE("type", null),
243         IO_PROPERTY("property", null),
244         IO_WORKFLOW_NAME("workflowName", null),
245         IO_WORKFLOW_VERSION("workflowVersion", null),
246         IO_WORKFLOW_ID("workflowId", null),
247         IO_WORKFLOW_VERSION_ID("workflowVersionId", null),
248     IO_WORKFLOW_ASSOCIATION_TYPE("workflowAssociationType", null),
249
250     //Interface
251     INTERFACES("interfaces", null),
252     OPERATIONS("operations", null),
253     OPERATION_IMPLEMENTATION("implementation", null),
254     OPERATION_INPUTS("inputs", null),
255     OPERATION_OUTPUTS("outputs", null),
256     INPUTS("inputs", null),
257
258     GET_PROPERTY("get_property", null),
259     GET_INPUT("get_input", null),
260     GET_OPERATION_OUTPUT("get_operation_output", null),
261
262     ATTRIBUTES("attributes", null),
263
264     TOSCA_DEFINITIONS_VERSION("tosca_definitions_version", null);
265
266     @ToString.Include
267     private final String presentation;
268     @ToString.Exclude
269     private final GraphPropertyEnum storedAs;
270
271     @JsonValue
272     public String getPresentation() {
273         return presentation;
274     }
275
276     public static String getPresentationByGraphProperty(GraphPropertyEnum property) {
277         for (JsonPresentationFields currPresentation : JsonPresentationFields.values()) {
278             if (currPresentation.getStoredAs() == property) {
279                 return currPresentation.getPresentation();
280             }
281         }
282         return null;
283     }
284
285     @JsonCreator
286     public static JsonPresentationFields getByPresentation(String presentation) {
287         for (JsonPresentationFields inst : JsonPresentationFields.values()) {
288             if (inst.getPresentation().equals(presentation)) {
289                 return inst;
290             }
291         }
292         return null;
293     }
294
295 }