912e3d94b193e171be871a79389e926affd51272
[sdc.git] / common-be / src / main / java / org / openecomp / sdc / be / datatypes / enums / JsonPresentationFields.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
21 package org.openecomp.sdc.be.datatypes.enums;
22
23 import com.fasterxml.jackson.annotation.JsonCreator;
24 import com.fasterxml.jackson.annotation.JsonValue;
25
26 public enum JsonPresentationFields {
27
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     RESOURCE_VENDOR_MODEL_NUMBER("reourceVendorModelNumber", null),
51     SERVICE_TYPE("serviceType", null),
52     SERVICE_ROLE("serviceRole", null),
53     INSTANTIATION_TYPE("instantiationType", null),
54     CONFORMANCE_LEVEL("conformanceLevel", null),
55     ICON("icon", null),
56     TAGS("tags", null),
57     INVARIANT_UUID("invariantUuid", GraphPropertyEnum.INVARIANT_UUID),
58     CSAR_UUID("csarUuid", GraphPropertyEnum.CSAR_UUID),
59     CSAR_VERSION("csarVersion", null),
60     IMPORTED_TOSCA_CHECKSUM("importedToscaChecksum", null),
61     CONTACT_ID("contactId", null),
62     PROJECT_CODE("projectCode", null),
63     DISTRIBUTION_STATUS("distributionStatus", GraphPropertyEnum.DISTRIBUTION_STATUS),
64     DERIVED_FROM_GENERIC_TYPE("derivedFromGenericType", null),
65     DERIVED_FROM_GENERIC_VERSION("derivedFromGenericVersion", null),
66
67     ////Inputs
68     ANNOTATIONS("annotations", null),
69
70     ////Artifact
71     ARTIFACT_TYPE("artifactType", null),
72     ARTIFACT_REF("artifactRef", null),
73     ARTIFACT_REPOSITORY("artifactRepository", null),
74     ARTIFACT_CHECKSUM("artifactChecksum", null),
75     ARTIFACT_CREATOR("artifactCreator", null),
76     USER_ID_CREATOR("userIdCreator", null),
77     USER_ID_LAST_UPDATER("userIdLastUpdater", null),
78     CREATOR_FULL_NAME("creatorFullName", null),
79     UPDATER_FULL_NAME("updaterFullName", null),
80     IS_FROM_CSAR("isFromCsar", null),
81
82     ES_ID("esId", null),
83     ARTIFACT_LABEL("artifactLabel", null),
84     IS_ABSTRACT("mandatory", null),
85     ARTIFACT_DISPLAY_NAME("artifactDisplayName", null),
86     API_URL("apiUrl", null),
87     SERVICE_API("serviceApi", null),
88     ARTIFACT_VERSION("artifactVersion", null),
89     ARTIFACT_UUID("artifactUUID", null),
90     PAYLOAD_UPDATE_DATE("payloadUpdateDate", null),
91     HEAT_PARAMS_UPDATE_DATE("heatParamsUpdateDate", null),
92     GENERATED("generated", null),
93     ARTIFACT_GROUP_TYPE("artifactGroupType", null),
94     ARTIFACT_TIMEOUT("timeout", null),
95     REQUIRED_ARTIFACTS("requiredArtifacts", null),
96     DUPLICATED("duplicated", null),
97     HEAT_PARAMETERS("heatParameters", null),
98     GENERATED_FROM_ID("generatedFromId", null),
99
100
101     // end artifacts
102
103
104     //property
105     DEFINITION("definition", null),
106     DEFAULT_VALUE("defaultValue", null),
107     REQUIRED("required", null),
108     PASSWORD("password", null),
109     CONSTRAINTS("constraints", null),
110     PROPERTIES("properties", null),
111     PROPERTY("property", null),
112     SCHEMA("schema", null),
113     VALUE("value", null),
114     PARENT_UNIQUE_ID("parentUniqueId", null),
115
116     COMPONENT_INSTANCES("componentInstances", null),
117     RELATIONS("relations", null),
118
119     //attribute
120     STATUS("status", null),
121     //capability
122     VALID_SOURCE_TYPE("validSourceTypes", null),
123     CREATION_TIME("creationTime", null),
124     MODIFICATION_TIME("modificationTime", null),
125     CAPABILITY_SOURCES("capabilitySources", null),
126     MAX_OCCURRENCES("maxOccurrences", null),
127     MIN_OCCURRENCES("minOccurrences", null),
128         OWNER_TYPE                                              ("ownerType",                                   null),
129     OWNER_NAME("ownerName", null),
130     OWNER_ID("ownerId", null),
131     LEFT_OCCURRENCES("leftOccurences", null),
132     CAPABILITY_ID("capabiltyId", null),
133     PATH("path", null),
134     SOURCE("source", null),
135
136     //Requirement
137     CAPAPILITY("capability", null),
138     NODE("node", null),
139     RELATIONSHIP("relationship", null),
140     VALID_SOURCE_TYPES("validSourceTypes", null),
141     REQUIREMENT_ID("requirementId", null),
142     PARENT_NAME("parentName", null),
143     PREVIOUS_NAME("previousName", null),
144     //Relation
145     CAPABILTY_OWNER_ID("capabilityOwnerId", null),
146     REQUIREMENT_OWNER_ID("requirementOwnerId", null),
147     FROM_ID("fromId", null),
148     TO_ID("toId", null),
149     REQUIREMENT("requirement", null),
150     ORIGIN_UI("originUI",null),
151
152     //Groups
153
154     GROUP_INVARIANT_UUID("invariantUUID", null),
155     GROUP_UUID("groupUUID", null),
156     GROUP_MEMBER("members", null),
157     GROUP_ARTIFACTS("artifacts", null),
158     GROUP_ARTIFACTS_UUID("artifactsUuid", null),
159     GROUP_PROPERTIES("properties", null),
160     GROUP_UNIQUE_ID("groupUid", null),
161     POS_X("posX", null),
162     POS_Y("posY", null),
163     PROPERTY_VALUE_COUNTER("propertyValueCounter", null),
164     CUSTOMIZATION_UUID("customizationUUID", null),
165     GROUP_NAME("groupName", null),
166     GROUP_INSTANCE_ARTIFACTS("groupInstanceArtifacts", null),
167     GROUP_INSTANCE_ARTIFACTS_UUID("groupInstanceArtifactsUuid", null),
168     GROUP_INSTANCE_PROPERTIES("groupInstancesProperties", null),
169
170     //Component instance
171
172     CI_COMPONENT_UID("componentUid", null),
173     CI_POS_X("posX", null),
174     CI_POS_Y("posY", null),
175     CI_PROP_VALUE_COUNTER("propertyValueCounter", null),
176     CI_ATTR_VALUE_COUNTER("attributeValueCounter", null),
177     CI_INPUT_VALUE_COUNTER("inputValueCounter", null),
178     CI_ORIGIN_TYPE("originType", null),
179     CI_COMPONENT_NAME("componentName", null),
180     CI_COMPONENT_VERSION("componentVersion", null),
181     CI_TOSCA_COMPONENT_NAME("toscaComponentName", null),
182     CI_INVARIANT_NAME("invariantName", null),
183     CI_ICON("icon", null),
184     CI_SOURCE_MODEL_UUID("sourceModelUuid", null),
185     CI_SOURCE_MODEL_UID("sourceModelUid", null),
186     CI_SOURCE_MODEL_INVARIANT("sourceModelInvariant", null),
187     CI_SOURCE_MODEL_NAME("sourceModelName", null),
188     CI_IS_PROXY("isProxy", null),
189
190
191     //path
192     FORWARDING_PATH("forwardingPath", null),
193     FROM_NODE("fromNode", null),
194     TO_NODE("toNode", null),
195     PATH_FROM_CP("fromCP", null),
196     PATH_TO_CP("toCP", null),
197     PATH_TO_CP_ORIGIN("toCPOrigin", null),
198     PATH_FROM_CP_ORIGIN("fromCPOrigin", null),
199     PATH_NAME("pathName", null),
200     PATH_PROTOCOL("pathProtocol", null),
201     PATH_DESTINATION_PORT_NUMBER("destinationPortNumber", null),
202     PATH_ELEMENT_LIST("pathElementList", null),
203
204     TYPE_UNIQUE_ID("typeUniqueId", null),
205     METADATA("metadata", null),
206     TARGETS("targets", null),
207
208     //External Refs
209     EXTERNAL_REF("externalRef", null),
210     CREATED_FROM("createdFrom", null),
211
212     //Archive
213     IS_ARCHIVED("isArchived", GraphPropertyEnum.IS_ARCHIVED),
214     ARCHIVE_TIME("archiveTime", GraphPropertyEnum.ARCHIVE_TIME),
215     IS_VSP_ARCHIVED("isVspArchived", GraphPropertyEnum.IS_VSP_ARCHIVED),
216     CI_IS_ORIGIN_ARCHIVED("isOriginArchived", null),
217     //Interface Operation
218     IO_OPERATION_TYPE("operationType",null),
219     IO_INPUT_PARAMETERS("inputParams",null),
220     IO_OUTPUT_PARAMETERS("outputParams",null),
221     IO_PARAM_NAME("paramName", null),
222     IO_PARAM_ID("paramId", null),
223     IO_WORKFLOW_ID("workflowId", null),
224         IO_WORKFLOW_VERSION_ID("workflowVersionId", null),
225
226     //Interface
227     INTERFACE ("interface", null),
228     INTERFACE_OPERATION ("operation", null),
229     OPERATION_IMPLEMENTATION("operationImplementation",null),
230         OPERATION_INPUT("operationInput",null),
231         OPERATION_OUTPUT("operationOutput", null)
232             ;
233
234
235     private String presentation;
236     private GraphPropertyEnum storedAs;
237
238     JsonPresentationFields(String presentation, GraphPropertyEnum storedAs) {
239         this.presentation = presentation;
240         this.storedAs = storedAs;
241     }
242
243     @JsonValue
244     public String getPresentation() {
245         return presentation;
246     }
247
248     public void setPresentation(String presentation) {
249         this.presentation = presentation;
250     }
251
252     public GraphPropertyEnum getStoredAs() {
253         return storedAs;
254     }
255
256     public void setStoredAs(GraphPropertyEnum storedAs) {
257         this.storedAs = storedAs;
258     }
259
260     public static String getPresentationByGraphProperty(GraphPropertyEnum property) {
261         for (JsonPresentationFields currPresentation : JsonPresentationFields.values()) {
262             if (currPresentation.getStoredAs() == property) {
263                 return currPresentation.getPresentation();
264             }
265         }
266         return null;
267     }
268
269     @Override
270     public String toString() {
271         // TODO Auto-generated method stub
272         return presentation;
273     }
274
275     @JsonCreator
276     public static JsonPresentationFields getByPresentation(String presentation) {
277         for (JsonPresentationFields inst : JsonPresentationFields.values()) {
278             if (inst.getPresentation().equals(presentation)) {
279                 return inst;
280             }
281         }
282         return null;
283     }
284
285 }