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