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;
23 import org.codehaus.jackson.annotate.JsonCreator;
24 import org.codehaus.jackson.annotate.JsonValue;
27 //@JsonDeserialize(using = MyDeserializer.class)
29 public enum JsonPresentationFields {
30 UNIQUE_ID ("uniqueId", GraphPropertyEnum.UNIQUE_ID),
31 HIGHEST_VERSION ("highestVersion", GraphPropertyEnum.IS_HIGHEST_VERSION),
32 LIFECYCLE_STATE ("lifecycleState", GraphPropertyEnum.STATE),
33 CREATION_DATE ("creationDate", null),
34 LAST_UPDATE_DATE ("lastUpdateDate", null),
35 SYSTEM_NAME ("systemName", GraphPropertyEnum.SYSTEM_NAME),
36 NAME ("name", GraphPropertyEnum.NAME),
37 VERSION ("version", GraphPropertyEnum.VERSION),
38 NORMALIZED_NAME ("normalizedName", GraphPropertyEnum.NORMALIZED_NAME),
39 UUID ("UUID", GraphPropertyEnum.UUID),
40 RESOURCE_TYPE ("resourceType", GraphPropertyEnum.RESOURCE_TYPE),
41 COMPONENT_TYPE ("componentType", GraphPropertyEnum.COMPONENT_TYPE),
42 IS_DELETED ("isDeleted", GraphPropertyEnum.IS_DELETED),
43 ECOMP_GENERATED_NAMING ("ecompGeneratedNaming", null),
44 NAMING_POLICY ("namingPolicy", null),
45 TOSCA_RESOURCE_NAME ("toscaResourceName", GraphPropertyEnum.TOSCA_RESOURCE_NAME),
46 DESCRIPTION ("description", null),
48 DERIVED_FROM ("derivedFrom", null),
49 VENDOR_NAME ("vendorName", null),
50 VENDOR_RELEASE ("vendorRelease", null),
51 RESOURCE_VENDOR_MODEL_NUMBER ("reourceVendorModelNumber",null),
52 SERVICE_TYPE ("serviceType", null),
53 SERVICE_ROLE ("serviceRole", null),
54 CONFORMANCE_LEVEL ("conformanceLevel", 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),
68 ARTIFACT_TYPE ("artifactType", null),
69 ARTIFACT_REF ("artifactRef", null),
70 ARTIFACT_REPOSITORY ("artifactRepository", null),
71 ARTIFACT_CHECKSUM ("artifactChecksum", null),
72 ARTIFACT_CREATOR ("artifactCreator", null),
73 USER_ID_CREATOR ("userIdCreator", null),
74 USER_ID_LAST_UPDATER ("userIdLastUpdater", null),
75 CREATOR_FULL_NAME ("creatorFullName", null),
76 UPDATER_FULL_NAME ("updaterFullName", null),
79 ARTIFACT_LABEL ("artifactLabel", null),
80 IS_ABSTRACT ("mandatory", null),
81 ARTIFACT_DISPLAY_NAME ("artifactDisplayName", null),
82 API_URL ("apiUrl", null),
83 SERVICE_API ("serviceApi", null),
84 ARTIFACT_VERSION ("artifactVersion", null),
85 ARTIFACT_UUID ("artifactUUID", null),
86 PAYLOAD_UPDATE_DATE ("payloadUpdateDate", null),
87 HEAT_PARAMS_UPDATE_DATE ("heatParamsUpdateDate", null),
88 GENERATED ("generated", null),
89 ARTIFACT_GROUP_TYPE ("artifactGroupType", null),
90 ARTIFACT_TIMEOUT ("timeout", null),
91 REQUIRED_ARTIFACTS ("requiredArtifacts", null),
92 DUPLICATED ("duplicated", null),
93 HEAT_PARAMETERS ("heatParameters", null),
94 GENERATED_FROM_ID ("generatedFromId", null),
101 DEFINITION ("definition", null),
102 DEFAULT_VALUE ("defaultValue", null),
103 REQUIRED ("required", null),
104 PASSWORD ("password", null),
105 CONSTRAINTS ("constraints", null),
106 PROPERTIES ("properties", null),
107 PROPERTY ("property", null),
108 SCHEMA ("schema", null),
109 VALUE ("value", null),
110 PARENT_UNIQUE_ID ("parentUniqueId", null),
112 COMPONENT_INSTANCES ("componentInstances", null),
113 RELATIONS ("relations", null),
116 STATUS ("status", null),
118 VALID_SOURCE_TYPE ("validSourceTypes", null),
119 CREATION_TIME ("creationTime", null),
120 MODIFICATION_TIME ("modificationTime", null),
121 CAPABILITY_SOURCES ("capabilitySources", null),
122 MAX_OCCURRENCES ("maxOccurrences", null),
123 MIN_OCCURRENCES ("minOccurrences", null),
124 OWNER_NAME ("ownerName", null),
125 OWNER_ID ("ownerId", null),
126 LEFT_OCCURRENCES ("leftOccurences", null),
127 CAPABILITY_ID ("capabiltyId", null),
129 SOURCE ("source", null),
132 CAPAPILITY ("capability", null),
134 RELATIONSHIP ("relationship", null),
135 VALID_SOURCE_TYPES ("validSourceTypes", null),
136 REQUIREMENT_ID ("requirementId", null),
137 PARENT_NAME ("parentName", null),
139 CAPABILTY_OWNER_ID ("capabilityOwnerId", null),
140 REQUIREMENT_OWNER_ID ("requirementOwnerId", null),
141 FROM_ID ("fromId", null),
142 TO_ID ("toId", null),
143 REQUIREMENT ("requirement", null),
147 GROUP_INVARIANT_UUID ("invariantUUID", null),
148 GROUP_UUID ("groupUUID", null),
149 GROUP_MEMBER ("members", null),
150 GROUP_ARTIFACTS ("artifacts", null),
151 GROUP_ARTIFACTS_UUID ("artifactsUuid", null),
152 GROUP_PROPERTIES ("properties", null),
153 GROUP_UNIQUE_ID ("groupUid", null),
154 POS_X ("posX", null),
155 POS_Y ("posY", null),
156 PROPERTY_VALUE_COUNTER ("propertyValueCounter", null),
157 CUSTOMIZATION_UUID ("customizationUUID", null),
158 GROUP_NAME ("groupName", null),
159 GROUP_INSTANCE_ARTIFACTS ("groupInstanceArtifacts", null),
160 GROUP_INSTANCE_ARTIFACTS_UUID ("groupInstanceArtifactsUuid", null),
161 GROUP_INSTANCE_PROPERTIES ("groupInstancesProperties", null),
165 CI_COMPONENT_UID ("componentUid", null),
166 CI_POS_X ("posX", null),
167 CI_POS_Y ("posY", null),
168 CI_PROP_VALUE_COUNTER ("propertyValueCounter", null),
169 CI_ATTR_VALUE_COUNTER ("attributeValueCounter", null),
170 CI_INPUT_VALUE_COUNTER ("inputValueCounter", null),
171 CI_ORIGIN_TYPE ("originType", null),
172 CI_COMPONENT_NAME ("componentName", null),
173 CI_COMPONENT_VERSION ("componentVersion", null),
174 CI_TOSCA_COMPONENT_NAME ("toscaComponentName", null),
175 CI_INVARIANT_NAME ("invariantName", null),
176 CI_ICON ("icon", null),
181 private String presentation;
182 private GraphPropertyEnum storedAs;
184 JsonPresentationFields(String presentation, GraphPropertyEnum storedAs) {
185 this.presentation = presentation;
186 this.storedAs = storedAs;
190 public String getPresentation() {
194 public void setPresentation(String presentation) {
195 this.presentation = presentation;
198 public GraphPropertyEnum getStoredAs() {
202 public void setStoredAs(GraphPropertyEnum storedAs) {
203 this.storedAs = storedAs;
206 public static String getPresentationByGraphProperty(GraphPropertyEnum property) {
207 for(JsonPresentationFields currPresentation : JsonPresentationFields.values()){
208 if(currPresentation.getStoredAs() == property){
209 return currPresentation.getPresentation();
216 public String toString() {
217 // TODO Auto-generated method stub
222 public static JsonPresentationFields getByPresentation(String presentation) {
223 for (JsonPresentationFields inst : JsonPresentationFields.values()) {
224 if (inst.getPresentation().equals(presentation)) {