Revert "Interface operation feature enhancements"
[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     CAPAPILITY("capability", null),
133     NODE("node", null),
134     RELATIONSHIP("relationship", null),
135     VALID_SOURCE_TYPES("validSourceTypes", null),
136     REQUIREMENT_ID("requirementId", null),
137     PARENT_NAME("parentName", null),
138     PREVIOUS_NAME("previousName", null),
139     //Relation
140     CAPABILTY_OWNER_ID("capabilityOwnerId", null),
141     REQUIREMENT_OWNER_ID("requirementOwnerId", null),
142     FROM_ID("fromId", null),
143     TO_ID("toId", null),
144     REQUIREMENT("requirement", null),
145     ORIGIN_UI("originUI",null),
146
147     //Groups
148
149     GROUP_INVARIANT_UUID("invariantUUID", null),
150     GROUP_UUID("groupUUID", null),
151     GROUP_MEMBER("members", null),
152     GROUP_ARTIFACTS("artifacts", null),
153     GROUP_ARTIFACTS_UUID("artifactsUuid", null),
154     GROUP_PROPERTIES("properties", null),
155     GROUP_UNIQUE_ID("groupUid", null),
156     POS_X("posX", null),
157     POS_Y("posY", null),
158     PROPERTY_VALUE_COUNTER("propertyValueCounter", null),
159     CUSTOMIZATION_UUID("customizationUUID", null),
160     GROUP_NAME("groupName", null),
161     GROUP_INSTANCE_ARTIFACTS("groupInstanceArtifacts", null),
162     GROUP_INSTANCE_ARTIFACTS_UUID("groupInstanceArtifactsUuid", null),
163     GROUP_INSTANCE_PROPERTIES("groupInstancesProperties", null),
164
165     //Component instance
166
167     CI_COMPONENT_UID("componentUid", null),
168     CI_POS_X("posX", null),
169     CI_POS_Y("posY", null),
170     CI_PROP_VALUE_COUNTER("propertyValueCounter", null),
171     CI_ATTR_VALUE_COUNTER("attributeValueCounter", null),
172     CI_INPUT_VALUE_COUNTER("inputValueCounter", null),
173     CI_ORIGIN_TYPE("originType", null),
174     CI_COMPONENT_NAME("componentName", null),
175     CI_COMPONENT_VERSION("componentVersion", null),
176     CI_TOSCA_COMPONENT_NAME("toscaComponentName", null),
177     CI_INVARIANT_NAME("invariantName", null),
178     CI_ICON("icon", null),
179     CI_SOURCE_MODEL_UUID("sourceModelUuid", null),
180     CI_SOURCE_MODEL_UID("sourceModelUid", null),
181     CI_SOURCE_MODEL_INVARIANT("sourceModelInvariant", null),
182     CI_SOURCE_MODEL_NAME("sourceModelName", null),
183     CI_IS_PROXY("isProxy", null),
184
185
186     //path
187     FORWARDING_PATH("forwardingPath", null),
188     FROM_NODE("fromNode", null),
189     TO_NODE("toNode", null),
190     PATH_FROM_CP("fromCP", null),
191     PATH_TO_CP("toCP", null),
192     PATH_TO_CP_ORIGIN("toCPOrigin", null),
193     PATH_FROM_CP_ORIGIN("fromCPOrigin", null),
194     PATH_NAME("pathName", null),
195     PATH_PROTOCOL("pathProtocol", null),
196     PATH_DESTINATION_PORT_NUMBER("destinationPortNumber", null),
197     PATH_ELEMENT_LIST("pathElementList", null),
198
199     TYPE_UNIQUE_ID("typeUniqueId", null),
200     METADATA("metadata", null),
201     TARGETS("targets", null),
202
203     //External Refs
204     EXTERNAL_REF("externalRef", null),
205     CREATED_FROM("createdFrom", null),
206
207     //Archive
208     IS_ARCHIVED("isArchived", GraphPropertyEnum.IS_ARCHIVED),
209     ARCHIVE_TIME("archiveTime", GraphPropertyEnum.ARCHIVE_TIME),
210     IS_VSP_ARCHIVED("isVspArchived", GraphPropertyEnum.IS_VSP_ARCHIVED),
211     CI_IS_ORIGIN_ARCHIVED("isOriginArchived", null),
212
213         //Interface Operation
214         IO_OPERATION_TYPE("operationType",null),
215         IO_INPUT_PARAMETERS("inputParams",null),
216         IO_OUTPUT_PARAMETERS("outputParams",null),
217         IO_NAME("name", null),
218         IO_MANDATORY("mandatory", null),
219         IO_TYPE("type", null),
220         IO_PROPERTY("property", null),
221         IO_WORKFLOW_ID("workflowId", null),
222         IO_WORKFLOW_VERSION_ID("workflowVersionId", null),
223     IO_WORKFLOW_ASSOCIATION_TYPE("workflowAssociationType", null),
224
225     //Interface
226     INTERFACE ("interface", null),
227     INTERFACE_OPERATION ("operation", null),
228     OPERATION_IMPLEMENTATION("operationImplementation",null),
229         OPERATION_INPUT("operationInput",null),
230         OPERATION_OUTPUT("operationOutput", null)
231             ;
232
233
234     private String presentation;
235     private GraphPropertyEnum storedAs;
236
237     JsonPresentationFields(String presentation, GraphPropertyEnum storedAs) {
238         this.presentation = presentation;
239         this.storedAs = storedAs;
240     }
241
242     @JsonValue
243     public String getPresentation() {
244         return presentation;
245     }
246
247     public void setPresentation(String presentation) {
248         this.presentation = presentation;
249     }
250
251     public GraphPropertyEnum getStoredAs() {
252         return storedAs;
253     }
254
255     public void setStoredAs(GraphPropertyEnum storedAs) {
256         this.storedAs = storedAs;
257     }
258
259     public static String getPresentationByGraphProperty(GraphPropertyEnum property) {
260         for (JsonPresentationFields currPresentation : JsonPresentationFields.values()) {
261             if (currPresentation.getStoredAs() == property) {
262                 return currPresentation.getPresentation();
263             }
264         }
265         return null;
266     }
267
268     @Override
269     public String toString() {
270         // TODO Auto-generated method stub
271         return presentation;
272     }
273
274     @JsonCreator
275     public static JsonPresentationFields getByPresentation(String presentation) {
276         for (JsonPresentationFields inst : JsonPresentationFields.values()) {
277             if (inst.getPresentation().equals(presentation)) {
278                 return inst;
279             }
280         }
281         return null;
282     }
283
284 }