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