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 ENVIRONMENT_CONTEXT ("environmentContext", null),
46 TOSCA_RESOURCE_NAME ("toscaResourceName", GraphPropertyEnum.TOSCA_RESOURCE_NAME),
47 DESCRIPTION ("description", null),
49 DERIVED_FROM ("derivedFrom", null),
50 VENDOR_NAME ("vendorName", null),
51 VENDOR_RELEASE ("vendorRelease", null),
52 RESOURCE_VENDOR_MODEL_NUMBER ("reourceVendorModelNumber",null),
53 SERVICE_TYPE ("serviceType", null),
54 SERVICE_ROLE ("serviceRole", null),
55 CONFORMANCE_LEVEL ("conformanceLevel", null),
58 INVARIANT_UUID ("invariantUuid", GraphPropertyEnum.INVARIANT_UUID),
59 CSAR_UUID ("csarUuid", GraphPropertyEnum.CSAR_UUID),
60 CSAR_VERSION ("csarVersion", null),
61 IMPORTED_TOSCA_CHECKSUM ("importedToscaChecksum", null),
62 CONTACT_ID ("contactId", null),
63 PROJECT_CODE ("projectCode", null),
64 DISTRIBUTION_STATUS ("distributionStatus", GraphPropertyEnum.DISTRIBUTION_STATUS),
65 DERIVED_FROM_GENERIC_TYPE ("derivedFromGenericType", null),
66 DERIVED_FROM_GENERIC_VERSION ("derivedFromGenericVersion", null),
69 ARTIFACT_TYPE ("artifactType", null),
70 ARTIFACT_REF ("artifactRef", null),
71 ARTIFACT_REPOSITORY ("artifactRepository", null),
72 ARTIFACT_CHECKSUM ("artifactChecksum", null),
73 ARTIFACT_CREATOR ("artifactCreator", null),
74 USER_ID_CREATOR ("userIdCreator", null),
75 USER_ID_LAST_UPDATER ("userIdLastUpdater", null),
76 CREATOR_FULL_NAME ("creatorFullName", null),
77 UPDATER_FULL_NAME ("updaterFullName", null),
80 ARTIFACT_LABEL ("artifactLabel", null),
81 IS_ABSTRACT ("mandatory", null),
82 ARTIFACT_DISPLAY_NAME ("artifactDisplayName", null),
83 API_URL ("apiUrl", null),
84 SERVICE_API ("serviceApi", null),
85 ARTIFACT_VERSION ("artifactVersion", null),
86 ARTIFACT_UUID ("artifactUUID", null),
87 PAYLOAD_UPDATE_DATE ("payloadUpdateDate", null),
88 HEAT_PARAMS_UPDATE_DATE ("heatParamsUpdateDate", null),
89 GENERATED ("generated", null),
90 ARTIFACT_GROUP_TYPE ("artifactGroupType", null),
91 ARTIFACT_TIMEOUT ("timeout", null),
92 REQUIRED_ARTIFACTS ("requiredArtifacts", null),
93 DUPLICATED ("duplicated", null),
94 HEAT_PARAMETERS ("heatParameters", null),
95 GENERATED_FROM_ID ("generatedFromId", null),
102 DEFINITION ("definition", null),
103 DEFAULT_VALUE ("defaultValue", null),
104 REQUIRED ("required", null),
105 PASSWORD ("password", null),
106 CONSTRAINTS ("constraints", null),
107 PROPERTIES ("properties", null),
108 PROPERTY ("property", null),
109 SCHEMA ("schema", null),
110 VALUE ("value", null),
111 PARENT_UNIQUE_ID ("parentUniqueId", null),
113 COMPONENT_INSTANCES ("componentInstances", null),
114 RELATIONS ("relations", null),
117 STATUS ("status", null),
119 VALID_SOURCE_TYPE ("validSourceTypes", null),
120 CREATION_TIME ("creationTime", null),
121 MODIFICATION_TIME ("modificationTime", null),
122 CAPABILITY_SOURCES ("capabilitySources", null),
123 MAX_OCCURRENCES ("maxOccurrences", null),
124 MIN_OCCURRENCES ("minOccurrences", null),
125 OWNER_NAME ("ownerName", null),
126 OWNER_ID ("ownerId", null),
127 LEFT_OCCURRENCES ("leftOccurences", null),
128 CAPABILITY_ID ("capabiltyId", null),
130 SOURCE ("source", null),
133 CAPAPILITY ("capability", null),
135 RELATIONSHIP ("relationship", null),
136 VALID_SOURCE_TYPES ("validSourceTypes", null),
137 REQUIREMENT_ID ("requirementId", null),
138 PARENT_NAME ("parentName", null),
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),
148 GROUP_INVARIANT_UUID ("invariantUUID", null),
149 GROUP_UUID ("groupUUID", null),
150 GROUP_MEMBER ("members", null),
151 GROUP_ARTIFACTS ("artifacts", null),
152 GROUP_ARTIFACTS_UUID ("artifactsUuid", null),
153 GROUP_PROPERTIES ("properties", null),
154 GROUP_UNIQUE_ID ("groupUid", null),
155 POS_X ("posX", null),
156 POS_Y ("posY", null),
157 PROPERTY_VALUE_COUNTER ("propertyValueCounter", null),
158 CUSTOMIZATION_UUID ("customizationUUID", null),
159 GROUP_NAME ("groupName", null),
160 GROUP_INSTANCE_ARTIFACTS ("groupInstanceArtifacts", null),
161 GROUP_INSTANCE_ARTIFACTS_UUID ("groupInstanceArtifactsUuid", null),
162 GROUP_INSTANCE_PROPERTIES ("groupInstancesProperties", null),
166 CI_COMPONENT_UID ("componentUid", null),
167 CI_POS_X ("posX", null),
168 CI_POS_Y ("posY", null),
169 CI_PROP_VALUE_COUNTER ("propertyValueCounter", null),
170 CI_ATTR_VALUE_COUNTER ("attributeValueCounter", null),
171 CI_INPUT_VALUE_COUNTER ("inputValueCounter", null),
172 CI_ORIGIN_TYPE ("originType", null),
173 CI_COMPONENT_NAME ("componentName", null),
174 CI_COMPONENT_VERSION ("componentVersion", null),
175 CI_TOSCA_COMPONENT_NAME ("toscaComponentName", null),
176 CI_INVARIANT_NAME ("invariantName", null),
177 CI_ICON ("icon", null),
178 CI_SOURCE_MODEL_UUID ("sourceModelUuid", null),
179 CI_SOURCE_MODEL_UID ("sourceModelUid", null),
180 CI_SOURCE_MODEL_INVARIANT ("sourceModelInvariant", null),
181 CI_SOURCE_MODEL_NAME ("sourceModelName", null),
182 CI_IS_PROXY ("isProxy", null),
187 private String presentation;
188 private GraphPropertyEnum storedAs;
190 JsonPresentationFields(String presentation, GraphPropertyEnum storedAs) {
191 this.presentation = presentation;
192 this.storedAs = storedAs;
196 public String getPresentation() {
200 public void setPresentation(String presentation) {
201 this.presentation = presentation;
204 public GraphPropertyEnum getStoredAs() {
208 public void setStoredAs(GraphPropertyEnum storedAs) {
209 this.storedAs = storedAs;
212 public static String getPresentationByGraphProperty(GraphPropertyEnum property) {
213 for(JsonPresentationFields currPresentation : JsonPresentationFields.values()){
214 if(currPresentation.getStoredAs() == property){
215 return currPresentation.getPresentation();
222 public String toString() {
223 // TODO Auto-generated method stub
228 public static JsonPresentationFields getByPresentation(String presentation) {
229 for (JsonPresentationFields inst : JsonPresentationFields.values()) {
230 if (inst.getPresentation().equals(presentation)) {