4545d5cdbd836bf5b85763f3e5dd4d8737b90cf1
[sdc.git] / openecomp-be / lib / openecomp-sdc-translator-lib / openecomp-sdc-translator-core / src / main / java / org / openecomp / sdc / translator / datatypes / heattotosca / unifiedmodel / consolidation / EntityConsolidationData.java
1 package org.openecomp.sdc.translator.datatypes.heattotosca.unifiedmodel.consolidation;
2
3 import org.openecomp.sdc.tosca.datatypes.model.RequirementAssignment;
4
5 import java.util.ArrayList;
6 import java.util.HashMap;
7 import java.util.List;
8 import java.util.Map;
9
10 /**
11  * The type Entity consolidation data.
12  */
13 public class EntityConsolidationData {
14
15   private String nodeTemplateId;
16
17   //groups that point to this entity node template
18   private List<String> groupIds;
19
20   // key - node template id which has connection to this entity
21   // value - List of Requirement assignment data which connect to this entity
22   private Map<String, List<RequirementAssignmentData>> nodesConnectedIn;
23
24   // key - node template id which connected from this entity
25   // List of Requirement assignment data which connect to the key node template id
26   private Map<String, List<RequirementAssignmentData>> nodesConnectedOut;
27
28   //key - node template id which include get attribute function from this entity
29   //key - node template id which include get attribute function from this entity
30   //value - List of getAttr data
31   private Map<String, List<GetAttrFuncData>> nodesGetAttrIn;
32
33   //key - node template id which is pointed by this entity using get attribute function
34   //value - List of getAttr data
35   private Map<String, List<GetAttrFuncData>> nodesGetAttrOut;
36
37   //List of getAttr data
38   private List<GetAttrFuncData> outputParametersGetAttrIn;
39
40   /**
41    * Gets node template id.
42    *
43    * @return the node template id
44    */
45   public String getNodeTemplateId() {
46     return nodeTemplateId;
47   }
48
49   /**
50    * Sets node template id.
51    *
52    * @param nodeTemplateId the node template id
53    */
54   public void setNodeTemplateId(String nodeTemplateId) {
55     this.nodeTemplateId = nodeTemplateId;
56   }
57
58   /**
59    * Gets group ids point to me.
60    *
61    * @return the group ids point to me
62    */
63   public List<String> getGroupIds() {
64     return groupIds;
65   }
66
67   /**
68    * Sets group ids point to me.
69    *
70    * @param groupIds the group ids point to me
71    */
72   public void setGroupIds(List<String> groupIds) {
73     this.groupIds = groupIds;
74   }
75
76
77   /**
78    * Sets node connected to me.
79    *
80    * @param nodesConnectedIn the node connected to me
81    */
82   public void setNodesConnectedIn(Map<String, List<RequirementAssignmentData>> nodesConnectedIn) {
83     this.nodesConnectedIn = nodesConnectedIn;
84   }
85
86   /**
87    * Add nodeConnectedIn.
88    *
89    * @param nodeTemplateId        the node template id which has connection to me
90    * @param requirementId         the requirement id
91    * @param requirementAssignment the requirement assignment
92    */
93   public void addNodesConnectedIn(String nodeTemplateId, String requirementId,
94                                   RequirementAssignment requirementAssignment) {
95     if (this.nodesConnectedIn == null) {
96       this.nodesConnectedIn = new HashMap<>();
97     }
98     this.nodesConnectedIn.computeIfAbsent(nodeTemplateId, k -> new ArrayList<>());
99     this.nodesConnectedIn.get(nodeTemplateId).add(new RequirementAssignmentData(requirementId,
100         requirementAssignment));
101   }
102
103   /**
104    * Gets node connected to me.
105    *
106    * @return the node connected to me
107    */
108   public Map<String, List<RequirementAssignmentData>> getNodesConnectedIn() {
109     return nodesConnectedIn;
110   }
111
112
113   /**
114    * Gets node connected from me.
115    *
116    * @return the node connected from me
117    */
118   public Map<String, List<RequirementAssignmentData>> getNodesConnectedOut() {
119     return nodesConnectedOut;
120   }
121
122   /**
123    * Sets node connected from me.
124    *
125    * @param nodesConnectedOut the node connected from me
126    */
127   public void setNodesConnectedOut(
128       Map<String, List<RequirementAssignmentData>> nodesConnectedOut) {
129     this.nodesConnectedOut = nodesConnectedOut;
130   }
131
132   /**
133    * Add nodeConnectedOut.
134    *
135    * @param nodeTemplateId        the node template id which is connected from me
136    * @param requirementId         the requirement id
137    * @param requirementAssignment the requirement assignment
138    */
139   public void addNodesConnectedOut(String nodeTemplateId, String requirementId,
140                                    RequirementAssignment
141                                        requirementAssignment) {
142     if (this.nodesConnectedOut == null) {
143       this.nodesConnectedOut = new HashMap<>();
144     }
145     this.nodesConnectedOut.computeIfAbsent(nodeTemplateId, k -> new ArrayList<>());
146     this.nodesConnectedOut.get(nodeTemplateId).add(new RequirementAssignmentData(requirementId,
147         requirementAssignment));
148   }
149
150   /**
151    * Gets nodes get attr in.
152    *
153    * @return the get attr in
154    */
155   public Map<String, List<GetAttrFuncData>> getNodesGetAttrIn() {
156     return nodesGetAttrIn;
157   }
158
159   /**
160    * Sets nodes get attr in.
161    *
162    * @param nodesGetAttrIn the get attr in
163    */
164   public void setNodesGetAttrIn(
165       Map<String, List<GetAttrFuncData>> nodesGetAttrIn) {
166     this.nodesGetAttrIn = nodesGetAttrIn;
167   }
168
169   /**
170    * Add nodes get attr in data.
171    *
172    * @param nodeTemplateId  the node template id
173    * @param getAttrFuncData get attr data
174    */
175   public void addNodesGetAttrIn(String nodeTemplateId, GetAttrFuncData getAttrFuncData) {
176     if (nodesGetAttrIn == null) {
177       nodesGetAttrIn = new HashMap<>();
178     }
179     this.nodesGetAttrIn.putIfAbsent(nodeTemplateId, new ArrayList<>());
180     this.nodesGetAttrIn.get(nodeTemplateId).add(getAttrFuncData);
181   }
182
183   /**
184    * Gets output parameters get attr from me.
185    *
186    * @return the get attr from me
187    */
188   public List<GetAttrFuncData> getOutputParametersGetAttrIn() {
189     return outputParametersGetAttrIn;
190   }
191
192   /**
193    * Sets output parameters get attr from me.
194    *
195    * @param outputParametersGetAttrIn the output parameters get attr from me
196    */
197   public void setOutputParametersGetAttrIn(List<GetAttrFuncData> outputParametersGetAttrIn) {
198     this.outputParametersGetAttrIn = outputParametersGetAttrIn;
199   }
200
201   /**
202    * Add output parameters get attr data.
203    *
204    * @param getAttrFuncData get attr data
205    */
206   public void addOutputParamGetAttrIn(GetAttrFuncData getAttrFuncData) {
207     if (outputParametersGetAttrIn == null) {
208       outputParametersGetAttrIn = new ArrayList<>();
209     }
210     this.outputParametersGetAttrIn.add(getAttrFuncData);
211   }
212
213   /**
214    * Gets nodes get attr out.
215    *
216    * @return the get attr out
217    */
218   public Map<String, List<GetAttrFuncData>> getNodesGetAttrOut() {
219     return nodesGetAttrOut;
220   }
221
222   /**
223    * Sets nodes get attr out.
224    *
225    * @param nodesGetAttrOut the get attr out
226    */
227   public void setNodesGetAttrOut(
228       Map<String, List<GetAttrFuncData>> nodesGetAttrOut) {
229     this.nodesGetAttrOut = nodesGetAttrOut;
230   }
231
232   /**
233    * Add nodes get attr out data.
234    *
235    * @param nodeTemplateId  the node template id
236    * @param getAttrFuncData get attr data
237    */
238   public void addNodesGetAttrOut(String nodeTemplateId, GetAttrFuncData getAttrFuncData) {
239     if (nodesGetAttrOut == null) {
240       nodesGetAttrOut = new HashMap<>();
241     }
242     this.nodesGetAttrOut.putIfAbsent(nodeTemplateId, new ArrayList<>());
243     this.nodesGetAttrOut.get(nodeTemplateId).add(getAttrFuncData);
244   }
245 }