re base code
[sdc.git] / catalog-dao / src / main / java / org / openecomp / sdc / be / dao / neo4j / GraphEdgePropertiesDictionary.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.dao.neo4j;
22
23 import java.util.ArrayList;
24 import java.util.List;
25
26 public enum GraphEdgePropertiesDictionary {
27
28         // field name class type
29         // stored in graph
30         STATE("state", String.class), 
31         NAME("name", String.class), 
32         GROUP_TYPE("groupType", String.class), 
33         SOURCE("source", String.class), 
34         OWNER_ID("ownerId", String.class), 
35         REQUIRED_OCCURRENCES("requiredOccurrences", String.class), 
36         LEFT_OCCURRENCES("leftOccurrences", String.class), 
37         GET_INPUT_INDEX("get_input_index", String.class);
38
39         private String property;
40         private Class clazz;
41
42         GraphEdgePropertiesDictionary(String property, Class clazz) {
43                 this.property = property;
44                 this.clazz = clazz;
45         }
46
47         public String getProperty() {
48                 return property;
49         }
50
51         public void setProperty(String property) {
52                 this.property = property;
53         }
54
55         public Class getClazz() {
56                 return clazz;
57         }
58
59         public void setClazz(Class clazz) {
60                 this.clazz = clazz;
61         }
62
63         public static List<String> getAllProperties() {
64
65                 List<String> arrayList = new ArrayList<>();
66
67                 for (GraphEdgePropertiesDictionary graphProperty : GraphEdgePropertiesDictionary.values()) {
68                         arrayList.add(graphProperty.getProperty());
69                 }
70
71                 return arrayList;
72         }
73
74         public static GraphEdgePropertiesDictionary getByName(String property) {
75                 for (GraphEdgePropertiesDictionary inst : GraphEdgePropertiesDictionary.values()) {
76                         if (inst.getProperty().equals(property)) {
77                                 return inst;
78                         }
79                 }
80                 return null;
81         }
82 }