Added new files requied for operation
[sdc.git] / common-be / src / main / java / org / openecomp / sdc / be / datatypes / enums / JsonPresentationFields.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
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
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
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=========================================================
19  */
20
21 package org.openecomp.sdc.be.datatypes.enums;
22 import com.fasterxml.jackson.annotation.JsonCreator;
23 import com.fasterxml.jackson.annotation.JsonValue;
24
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),
44         TYPE                                                    ("type",                                        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),
52         ICON                                                    ("icon",                                        null),
53         TAGS                                                    ("tags",                                        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),
63
64         ////Artifact
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),
75         
76         ES_ID                                                   ("esId",                                        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),
93         
94         
95         // end artifacts
96         
97         
98         //property
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),
109         
110         COMPONENT_INSTANCES                             ("componentInstances",                  null),
111         RELATIONS                                               ("relations",                                   null),
112         
113         //attribute
114         STATUS                                                  ("status",                                              null),                  
115         //capability
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),
126         PATH                                                    ("path",                                                null),
127         SOURCE                                                  ("source",                                              null),
128         
129         //Requirement
130         CAPAPILITY                                              ("capability",                                  null),
131         NODE                                                    ("node",                                                null),          
132         RELATIONSHIP                                    ("relationship",                                null),
133         VALID_SOURCE_TYPES                              ("validSourceTypes",                    null),
134         REQUIREMENT_ID                                  ("requirementId",                               null),
135         PARENT_NAME                                             ("parentName",                                  null),
136
137         //Relation
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),
143                 
144         //Groups
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),
160         
161         //Component instance
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),
179         
180         //path
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),
192         
193         TYPE_UNIQUE_ID                                  ("typeUniqueId", null),
194         METADATA                                                ("metadata", null),
195         TARGETS                                                 ("targets", null),
196
197         //External Refs
198         EXTERNAL_REF                                    ("externalRef", null),
199
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),
207
208         //Interface
209         INTERFACE ("interface", null),
210         INTERFACE_OPERATION ("operation", null),
211         OPERATION_IMPLEMENTATION("operationImplementation",null),
212         OPERATION_INPUT("operationInput",null)
213         ;
214         
215
216         private String presentation;
217         private GraphPropertyEnum storedAs;
218
219         JsonPresentationFields(String presentation, GraphPropertyEnum storedAs) {
220                 this.presentation = presentation;
221                 this.storedAs = storedAs;
222         }
223
224         @JsonValue
225         public String getPresentation() {
226                 return presentation;
227         }
228
229         public void setPresentation(String presentation) {
230                 this.presentation = presentation;
231         }
232
233         public GraphPropertyEnum getStoredAs() {
234                 return storedAs;
235         }
236         
237         public void setStoredAs(GraphPropertyEnum storedAs) {
238                 this.storedAs = storedAs;
239         }
240
241         public static String getPresentationByGraphProperty(GraphPropertyEnum property) {
242                 for(JsonPresentationFields currPresentation : JsonPresentationFields.values()){
243                         if(currPresentation.getStoredAs() == property){
244                                 return currPresentation.getPresentation();
245                         }
246                 }
247                 return null;
248         }
249         
250         @Override
251         public String toString() {
252                 // TODO Auto-generated method stub
253                 return presentation;
254         }
255
256         @JsonCreator
257         public static JsonPresentationFields getByPresentation(String presentation) {
258                 for (JsonPresentationFields inst : JsonPresentationFields.values()) {
259                         if (inst.getPresentation().equals(presentation)) {
260                                 return inst;
261                         }
262                 }
263                 return null;
264         }
265         
266 }