2 * ============LICENSE_START=======================================================
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
21 package org.openecomp.sdc.be.datatypes.enums;
22 import com.fasterxml.jackson.annotation.JsonCreator;
23 import com.fasterxml.jackson.annotation.JsonValue;
25 public enum JsonPresentationFields {
26 UNIQUE_ID ("uniqueId", GraphPropertyEnum.UNIQUE_ID),
27 HIGHEST_VERSION ("highestVersion", GraphPropertyEnum.IS_HIGHEST_VERSION),
28 LIFECYCLE_STATE ("lifecycleState", GraphPropertyEnum.STATE),
29 CREATION_DATE ("creationDate", null),
30 LAST_UPDATE_DATE ("lastUpdateDate", null),
31 SYSTEM_NAME ("systemName", GraphPropertyEnum.SYSTEM_NAME),
32 NAME ("name", GraphPropertyEnum.NAME),
33 VERSION ("version", GraphPropertyEnum.VERSION),
34 NORMALIZED_NAME ("normalizedName", GraphPropertyEnum.NORMALIZED_NAME),
35 UUID ("UUID", GraphPropertyEnum.UUID),
36 RESOURCE_TYPE ("resourceType", GraphPropertyEnum.RESOURCE_TYPE),
37 COMPONENT_TYPE ("componentType", GraphPropertyEnum.COMPONENT_TYPE),
38 IS_DELETED ("isDeleted", GraphPropertyEnum.IS_DELETED),
39 ECOMP_GENERATED_NAMING ("ecompGeneratedNaming", null),
40 NAMING_POLICY ("namingPolicy", null),
41 ENVIRONMENT_CONTEXT ("environmentContext", null),
42 TOSCA_RESOURCE_NAME ("toscaResourceName", GraphPropertyEnum.TOSCA_RESOURCE_NAME),
43 DESCRIPTION ("description", null),
45 DERIVED_FROM ("derivedFrom", null),
46 VENDOR_NAME ("vendorName", null),
47 VENDOR_RELEASE ("vendorRelease", null),
48 RESOURCE_VENDOR_MODEL_NUMBER ("reourceVendorModelNumber",null),
49 SERVICE_TYPE ("serviceType", null),
50 SERVICE_ROLE ("serviceRole", null),
51 CONFORMANCE_LEVEL ("conformanceLevel", null),
54 INVARIANT_UUID ("invariantUuid", GraphPropertyEnum.INVARIANT_UUID),
55 CSAR_UUID ("csarUuid", GraphPropertyEnum.CSAR_UUID),
56 CSAR_VERSION ("csarVersion", null),
57 IMPORTED_TOSCA_CHECKSUM ("importedToscaChecksum", null),
58 CONTACT_ID ("contactId", null),
59 PROJECT_CODE ("projectCode", null),
60 DISTRIBUTION_STATUS ("distributionStatus", GraphPropertyEnum.DISTRIBUTION_STATUS),
61 DERIVED_FROM_GENERIC_TYPE ("derivedFromGenericType", null),
62 DERIVED_FROM_GENERIC_VERSION ("derivedFromGenericVersion", null),
65 ARTIFACT_TYPE ("artifactType", null),
66 ARTIFACT_REF ("artifactRef", null),
67 ARTIFACT_REPOSITORY ("artifactRepository", null),
68 ARTIFACT_CHECKSUM ("artifactChecksum", null),
69 ARTIFACT_CREATOR ("artifactCreator", null),
70 USER_ID_CREATOR ("userIdCreator", null),
71 USER_ID_LAST_UPDATER ("userIdLastUpdater", null),
72 CREATOR_FULL_NAME ("creatorFullName", null),
73 UPDATER_FULL_NAME ("updaterFullName", null),
74 IS_FROM_CSAR ("isFromCsar", null),
77 ARTIFACT_LABEL ("artifactLabel", null),
78 IS_ABSTRACT ("mandatory", null),
79 ARTIFACT_DISPLAY_NAME ("artifactDisplayName", null),
80 API_URL ("apiUrl", null),
81 SERVICE_API ("serviceApi", null),
82 ARTIFACT_VERSION ("artifactVersion", null),
83 ARTIFACT_UUID ("artifactUUID", null),
84 PAYLOAD_UPDATE_DATE ("payloadUpdateDate", null),
85 HEAT_PARAMS_UPDATE_DATE ("heatParamsUpdateDate", null),
86 GENERATED ("generated", null),
87 ARTIFACT_GROUP_TYPE ("artifactGroupType", null),
88 ARTIFACT_TIMEOUT ("timeout", null),
89 REQUIRED_ARTIFACTS ("requiredArtifacts", null),
90 DUPLICATED ("duplicated", null),
91 HEAT_PARAMETERS ("heatParameters", null),
92 GENERATED_FROM_ID ("generatedFromId", null),
99 DEFINITION ("definition", null),
100 DEFAULT_VALUE ("defaultValue", null),
101 REQUIRED ("required", null),
102 PASSWORD ("password", null),
103 CONSTRAINTS ("constraints", null),
104 PROPERTIES ("properties", null),
105 PROPERTY ("property", null),
106 SCHEMA ("schema", null),
107 VALUE ("value", null),
108 PARENT_UNIQUE_ID ("parentUniqueId", null),
110 COMPONENT_INSTANCES ("componentInstances", null),
111 RELATIONS ("relations", null),
114 STATUS ("status", null),
116 VALID_SOURCE_TYPE ("validSourceTypes", null),
117 CREATION_TIME ("creationTime", null),
118 MODIFICATION_TIME ("modificationTime", null),
119 CAPABILITY_SOURCES ("capabilitySources", null),
120 MAX_OCCURRENCES ("maxOccurrences", null),
121 MIN_OCCURRENCES ("minOccurrences", null),
122 OWNER_NAME ("ownerName", null),
123 OWNER_ID ("ownerId", null),
124 LEFT_OCCURRENCES ("leftOccurences", null),
125 CAPABILITY_ID ("capabiltyId", null),
127 SOURCE ("source", null),
130 CAPAPILITY ("capability", null),
132 RELATIONSHIP ("relationship", null),
133 VALID_SOURCE_TYPES ("validSourceTypes", null),
134 REQUIREMENT_ID ("requirementId", null),
135 PARENT_NAME ("parentName", null),
138 CAPABILTY_OWNER_ID ("capabilityOwnerId", null),
139 REQUIREMENT_OWNER_ID ("requirementOwnerId", null),
140 FROM_ID ("fromId", null),
141 TO_ID ("toId", null),
142 REQUIREMENT ("requirement", null),
145 GROUP_INVARIANT_UUID ("invariantUUID", null),
146 GROUP_UUID ("groupUUID", null),
147 GROUP_MEMBER ("members", null),
148 GROUP_ARTIFACTS ("artifacts", null),
149 GROUP_ARTIFACTS_UUID ("artifactsUuid", null),
150 GROUP_PROPERTIES ("properties", null),
151 GROUP_UNIQUE_ID ("groupUid", null),
152 POS_X ("posX", null),
153 POS_Y ("posY", null),
154 PROPERTY_VALUE_COUNTER ("propertyValueCounter", null),
155 CUSTOMIZATION_UUID ("customizationUUID", null),
156 GROUP_NAME ("groupName", null),
157 GROUP_INSTANCE_ARTIFACTS ("groupInstanceArtifacts", null),
158 GROUP_INSTANCE_ARTIFACTS_UUID ("groupInstanceArtifactsUuid", null),
159 GROUP_INSTANCE_PROPERTIES ("groupInstancesProperties", null),
162 CI_COMPONENT_UID ("componentUid", null),
163 CI_POS_X ("posX", null),
164 CI_POS_Y ("posY", null),
165 CI_PROP_VALUE_COUNTER ("propertyValueCounter", null),
166 CI_ATTR_VALUE_COUNTER ("attributeValueCounter", null),
167 CI_INPUT_VALUE_COUNTER ("inputValueCounter", null),
168 CI_ORIGIN_TYPE ("originType", null),
169 CI_COMPONENT_NAME ("componentName", null),
170 CI_COMPONENT_VERSION ("componentVersion", null),
171 CI_TOSCA_COMPONENT_NAME ("toscaComponentName", null),
172 CI_INVARIANT_NAME ("invariantName", null),
173 CI_ICON ("icon", null),
174 CI_SOURCE_MODEL_UUID ("sourceModelUuid", null),
175 CI_SOURCE_MODEL_UID ("sourceModelUid", null),
176 CI_SOURCE_MODEL_INVARIANT ("sourceModelInvariant", null),
177 CI_SOURCE_MODEL_NAME ("sourceModelName", null),
178 CI_IS_PROXY ("isProxy", null),
181 FORWARDING_PATH ("forwardingPath", null),
182 FROM_NODE ("fromNode", null),
183 TO_NODE ("toNode", null),
184 PATH_FROM_CP ("fromCP", null),
185 PATH_TO_CP ("toCP", null),
186 PATH_TO_CP_ORIGIN ("toCPOrigin", null),
187 PATH_FROM_CP_ORIGIN ("fromCPOrigin", null),
188 PATH_NAME ("pathName", null),
189 PATH_PROTOCOL ("pathProtocol", null),
190 PATH_DESTINATION_PORT_NUMBER ("destinationPortNumber", null),
191 PATH_ELEMENT_LIST ("pathElementList", null),
193 TYPE_UNIQUE_ID ("typeUniqueId", null),
194 METADATA ("metadata", null),
195 TARGETS ("targets", null),
198 EXTERNAL_REF ("externalRef", null),
200 //Interface Operation
201 IO_OPERATION_TYPE("operationType",null),
202 IO_INPUT_PARAMETERS("inputParams",null),
203 IO_OUTPUT_PARAMETERS("outputParams",null),
204 IO_PARAM_NAME("paramName", null),
205 IO_PARAM_ID("paramId", null),
206 IO_WORKFLOW_ID("workflowId", null),
209 INTERFACE ("interface", null),
210 INTERFACE_OPERATION ("operation", null),
211 OPERATION_IMPLEMENTATION("operationImplementation",null),
212 OPERATION_INPUT("operationInput",null),
213 OPERATION_OUTPUT("operationOutput", null)
217 private String presentation;
218 private GraphPropertyEnum storedAs;
220 JsonPresentationFields(String presentation, GraphPropertyEnum storedAs) {
221 this.presentation = presentation;
222 this.storedAs = storedAs;
226 public String getPresentation() {
230 public void setPresentation(String presentation) {
231 this.presentation = presentation;
234 public GraphPropertyEnum getStoredAs() {
238 public void setStoredAs(GraphPropertyEnum storedAs) {
239 this.storedAs = storedAs;
242 public static String getPresentationByGraphProperty(GraphPropertyEnum property) {
243 for(JsonPresentationFields currPresentation : JsonPresentationFields.values()){
244 if(currPresentation.getStoredAs() == property){
245 return currPresentation.getPresentation();
252 public String toString() {
253 // TODO Auto-generated method stub
258 public static JsonPresentationFields getByPresentation(String presentation) {
259 for (JsonPresentationFields inst : JsonPresentationFields.values()) {
260 if (inst.getPresentation().equals(presentation)) {