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 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),
76 ARTIFACT_LABEL ("artifactLabel", null),
77 IS_ABSTRACT ("mandatory", null),
78 ARTIFACT_DISPLAY_NAME ("artifactDisplayName", null),
79 API_URL ("apiUrl", null),
80 SERVICE_API ("serviceApi", null),
81 ARTIFACT_VERSION ("artifactVersion", null),
82 ARTIFACT_UUID ("artifactUUID", null),
83 PAYLOAD_UPDATE_DATE ("payloadUpdateDate", null),
84 HEAT_PARAMS_UPDATE_DATE ("heatParamsUpdateDate", null),
85 GENERATED ("generated", null),
86 ARTIFACT_GROUP_TYPE ("artifactGroupType", null),
87 ARTIFACT_TIMEOUT ("timeout", null),
88 REQUIRED_ARTIFACTS ("requiredArtifacts", null),
89 DUPLICATED ("duplicated", null),
90 HEAT_PARAMETERS ("heatParameters", null),
91 GENERATED_FROM_ID ("generatedFromId", null),
98 DEFINITION ("definition", null),
99 DEFAULT_VALUE ("defaultValue", null),
100 REQUIRED ("required", null),
101 PASSWORD ("password", null),
102 CONSTRAINTS ("constraints", null),
103 PROPERTIES ("properties", null),
104 PROPERTY ("property", null),
105 SCHEMA ("schema", null),
106 VALUE ("value", null),
107 PARENT_UNIQUE_ID ("parentUniqueId", null),
109 COMPONENT_INSTANCES ("componentInstances", null),
110 RELATIONS ("relations", null),
113 STATUS ("status", null),
115 VALID_SOURCE_TYPE ("validSourceTypes", null),
116 CREATION_TIME ("creationTime", null),
117 MODIFICATION_TIME ("modificationTime", null),
118 CAPABILITY_SOURCES ("capabilitySources", null),
119 MAX_OCCURRENCES ("maxOccurrences", null),
120 MIN_OCCURRENCES ("minOccurrences", null),
121 OWNER_NAME ("ownerName", null),
122 OWNER_ID ("ownerId", null),
123 LEFT_OCCURRENCES ("leftOccurences", null),
124 CAPABILITY_ID ("capabiltyId", null),
126 SOURCE ("source", null),
129 CAPAPILITY ("capability", null),
131 RELATIONSHIP ("relationship", null),
132 VALID_SOURCE_TYPES ("validSourceTypes", null),
133 REQUIREMENT_ID ("requirementId", null),
136 CAPABILTY_OWNER_ID ("capabilityOwnerId", null),
137 REQUIREMENT_OWNER_ID ("requirementOwnerId", null),
138 FROM_ID ("fromId", null),
139 TO_ID ("toId", null),
140 REQUIREMENT ("requirement", null),
144 GROUP_INVARIANT_UUID ("invariantUUID", null),
145 GROUP_UUID ("groupUUID", null),
146 GROUP_MEMBER ("members", null),
147 GROUP_ARTIFACTS ("artifacts", null),
148 GROUP_ARTIFACTS_UUID ("artifactsUuid", null),
149 GROUP_PROPERTIES ("properties", null),
150 GROUP_UNIQUE_ID ("groupUid", null),
151 POS_X ("posX", null),
152 POS_Y ("posY", null),
153 PROPERTY_VALUE_COUNTER ("propertyValueCounter", null),
154 CUSTOMIZATION_UUID ("customizationUUID", null),
155 GROUP_NAME ("groupName", null),
156 GROUP_INSTANCE_ARTIFACTS ("groupInstanceArtifacts", null),
157 GROUP_INSTANCE_ARTIFACTS_UUID ("groupInstanceArtifactsUuid", null),
158 GROUP_INSTANCE_PROPERTIES ("groupInstancesProperties", null),
163 private String presentation;
164 private GraphPropertyEnum storedAs;
166 JsonPresentationFields(String presentation, GraphPropertyEnum storedAs) {
167 this.presentation = presentation;
168 this.storedAs = storedAs;
172 public String getPresentation() {
176 public void setPresentation(String presentation) {
177 this.presentation = presentation;
180 public GraphPropertyEnum getStoredAs() {
184 public void setStoredAs(GraphPropertyEnum storedAs) {
185 this.storedAs = storedAs;
188 public static String getPresentationByGraphProperty(GraphPropertyEnum property) {
189 for(JsonPresentationFields currPresentation : JsonPresentationFields.values()){
190 if(currPresentation.getStoredAs() == property){
191 return currPresentation.getPresentation();
198 public String toString() {
199 // TODO Auto-generated method stub
204 public static JsonPresentationFields getByPresentation(String presentation) {
205 for (JsonPresentationFields inst : JsonPresentationFields.values()) {
206 if (inst.getPresentation().equals(presentation)) {