d7abfdc0d1af85409c5c9d0a67a0f94b6a422bd7
[aai/aai-common.git] / aai-core / src / main / java / org / openecomp / aai / serialization / db / EdgeRule.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * org.openecomp.aai
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.aai.serialization.db;
22
23 import java.util.HashMap;
24 import java.util.Map;
25
26 import org.apache.tinkerpop.gremlin.structure.Direction;
27
28 public class EdgeRule {
29
30         private String label = "";
31         private MultiplicityRule multiplicityRule = null;
32         private Direction direction = null;
33         private Map<String, String> edgeProperties = null;
34         private final String IS_PARENT = "isParent";
35         private final String USES_RESOURCE  = "usesResource";
36         private final String HAS_DEL_TARGET = "hasDelTarget";
37         private final String SVC_INFRA = "SVC-INFRA";
38         
39         /**
40          * Instantiates a new edge rule.
41          */
42         public EdgeRule() {
43                 edgeProperties = new HashMap<>();
44         }
45         
46         /**
47          * Gets the label.
48          *
49          * @return the label
50          */
51         public String getLabel() {
52                 return label;
53         }
54         
55         /**
56          * Sets the label.
57          *
58          * @param label the new label
59          */
60         public void setLabel(String label) {
61                 this.label = label;
62         }
63         
64         /**
65          * Gets the multiplicity rule.
66          *
67          * @return the multiplicity rule
68          */
69         public MultiplicityRule getMultiplicityRule() {
70                 return multiplicityRule;
71         }
72         
73         /**
74          * Sets the multiplicity rule.
75          *
76          * @param multiplicityRule the new multiplicity rule
77          */
78         public void setMultiplicityRule(MultiplicityRule multiplicityRule) {
79                 this.multiplicityRule = multiplicityRule;
80         }
81         
82         /**
83          * Gets the direction.
84          *
85          * @return the direction
86          */
87         public Direction getDirection() {
88                 return direction;
89         }
90         
91         /**
92          * Sets the direction.
93          *
94          * @param direction the new direction
95          */
96         public void setDirection(Direction direction) {
97                 this.direction = direction;
98         }
99         
100         /**
101          * Gets the checks if is parent.
102          *
103          * @return the checks if is parent
104          */
105         public String getIsParent() {
106                 return this.getProp(this.IS_PARENT);
107         }
108         
109         /**
110          * Sets the checks if is parent.
111          *
112          * @param isParent the new checks if is parent
113          */
114         public void setIsParent(String isParent) {
115                 this.setProp(this.IS_PARENT, isParent);
116         }
117         
118         /**
119          * Gets the uses resource.
120          *
121          * @return the uses resource
122          */
123         public String getUsesResource() {
124                 return this.getProp(this.USES_RESOURCE);
125         }
126         
127         /**
128          * Sets the uses resource.
129          *
130          * @param usesResource the new uses resource
131          */
132         public void setUsesResource(String usesResource) {
133                 this.setProp(this.USES_RESOURCE, usesResource);
134         }
135         
136         /**
137          * Gets the checks for del target.
138          *
139          * @return the checks for del target
140          */
141         public String getHasDelTarget() {
142                 return this.getProp(this.HAS_DEL_TARGET);
143         }
144         
145         /**
146          * Sets the checks for del target.
147          *
148          * @param hasDelTarget the new checks for del target
149          */
150         public void setHasDelTarget(String hasDelTarget) {
151                 this.setProp(this.HAS_DEL_TARGET, hasDelTarget);
152         }
153         
154         /**
155          * Gets the service infrastructure.
156          *
157          * @return the service infrastructure
158          */
159         public String getServiceInfrastructure() {
160                 return this.getProp(this.SVC_INFRA);
161         }
162         
163         /**
164          * Sets the service infrastructure.
165          *
166          * @param serviceInfrastructure the new service infrastructure
167          */
168         public void setServiceInfrastructure(String serviceInfrastructure) {
169                 this.setProp(this.SVC_INFRA, serviceInfrastructure);
170         }
171         
172         /**
173          * Gets the edge properties.
174          *
175          * @return the edge properties
176          */
177         public Map<String, String> getEdgeProperties() {
178                 return this.edgeProperties;
179         }
180         
181         /**
182          * Sets the prop.
183          *
184          * @param key the key
185          * @param value the value
186          */
187         private void setProp(String key, String value) {
188                 this.edgeProperties.put(key, value);
189         }
190         
191         /**
192          * Gets the prop.
193          *
194          * @param key the key
195          * @return the prop
196          */
197         private String getProp(String key) {
198                 return this.edgeProperties.get(key);
199         }
200         
201         
202 }