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