2 * Copyright © 2016-2018 European Support Limited
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package org.openecomp.sdc.translator.datatypes.heattotosca.unifiedmodel.consolidation;
19 import java.util.ArrayList;
20 import java.util.HashMap;
21 import java.util.List;
23 import org.onap.sdc.tosca.datatypes.model.RequirementAssignment;
26 * The type Entity consolidation data.
28 public class EntityConsolidationData {
30 private String nodeTemplateId;
32 //groups that point to this entity node template
33 private List<String> groupIds;
35 // key - node template id which has connection to this entity
36 // value - List of Requirement assignment data which connect to this entity
37 private Map<String, List<RequirementAssignmentData>> nodesConnectedIn;
39 // key - node template id which connected from this entity
40 // List of Requirement assignment data which connect to the key node template id
41 private Map<String, List<RequirementAssignmentData>> nodesConnectedOut;
43 //key - node template id which include get attribute function from this entity
44 //value - List of getAttr data
45 private Map<String, List<GetAttrFuncData>> nodesGetAttrIn;
47 //key - node template id which is pointed by this entity using get attribute function
48 //value - List of getAttr data
49 private Map<String, List<GetAttrFuncData>> nodesGetAttrOut;
51 //List of getAttr data
52 private List<GetAttrFuncData> outputParametersGetAttrIn;
54 public String getNodeTemplateId() {
55 return nodeTemplateId;
58 public void setNodeTemplateId(String nodeTemplateId) {
59 this.nodeTemplateId = nodeTemplateId;
63 * Gets group ids point to me.
65 * @return the group ids point to me
67 public List<String> getGroupIds() {
72 * Sets group ids point to me.
74 * @param groupIds the group ids point to me
76 public void setGroupIds(List<String> groupIds) {
77 this.groupIds = groupIds;
82 * Sets node connected to me.
84 * @param nodesConnectedIn the node connected to me
86 public void setNodesConnectedIn(Map<String, List<RequirementAssignmentData>> nodesConnectedIn) {
87 this.nodesConnectedIn = nodesConnectedIn;
91 * Add nodeConnectedIn.
93 * @param nodeTemplateId the node template id which has connection to me
94 * @param requirementId the requirement id
95 * @param requirementAssignment the requirement assignment
97 public void addNodesConnectedIn(String nodeTemplateId, String requirementId,
98 RequirementAssignment requirementAssignment) {
100 if (this.nodesConnectedIn == null) {
101 this.nodesConnectedIn = new HashMap<>();
104 this.nodesConnectedIn.computeIfAbsent(nodeTemplateId, k -> new ArrayList<>());
105 this.nodesConnectedIn.get(nodeTemplateId).add(
106 new RequirementAssignmentData(requirementId, requirementAssignment));
110 * Gets node connected to me.
112 * @return the node connected to me
114 public Map<String, List<RequirementAssignmentData>> getNodesConnectedIn() {
115 return nodesConnectedIn;
120 * Gets node connected from me.
122 * @return the node connected from me
124 public Map<String, List<RequirementAssignmentData>> getNodesConnectedOut() {
125 return nodesConnectedOut;
129 * Sets node connected from me.
131 * @param nodesConnectedOut the node connected from me
133 public void setNodesConnectedOut(Map<String, List<RequirementAssignmentData>> nodesConnectedOut) {
134 this.nodesConnectedOut = nodesConnectedOut;
138 * Add nodeConnectedOut.
140 * @param nodeTemplateId the node template id which is connected from me
141 * @param requirementId the requirement id
142 * @param requirementAssignment the requirement assignment
144 public void addNodesConnectedOut(String nodeTemplateId, String requirementId,
145 RequirementAssignment requirementAssignment) {
147 if (this.nodesConnectedOut == null) {
148 this.nodesConnectedOut = new HashMap<>();
151 this.nodesConnectedOut.computeIfAbsent(nodeTemplateId, k -> new ArrayList<>());
152 this.nodesConnectedOut.get(nodeTemplateId).add(
153 new RequirementAssignmentData(requirementId, requirementAssignment));
157 * Gets nodes get attr in.
159 * @return the get attr in
161 public Map<String, List<GetAttrFuncData>> getNodesGetAttrIn() {
162 return nodesGetAttrIn;
166 * Sets nodes get attr in.
168 * @param nodesGetAttrIn the get attr in
170 public void setNodesGetAttrIn(Map<String, List<GetAttrFuncData>> nodesGetAttrIn) {
171 this.nodesGetAttrIn = nodesGetAttrIn;
175 * Add nodes get attr in data.
177 * @param nodeTemplateId the node template id
178 * @param getAttrFuncData get attr data
180 public void addNodesGetAttrIn(String nodeTemplateId, GetAttrFuncData getAttrFuncData) {
182 if (nodesGetAttrIn == null) {
183 nodesGetAttrIn = new HashMap<>();
186 this.nodesGetAttrIn.putIfAbsent(nodeTemplateId, new ArrayList<>());
187 this.nodesGetAttrIn.get(nodeTemplateId).add(getAttrFuncData);
191 * Gets output parameters get attr from me.
193 * @return the get attr from me
195 public List<GetAttrFuncData> getOutputParametersGetAttrIn() {
196 return outputParametersGetAttrIn;
200 * Sets output parameters get attr from me.
202 * @param outputParametersGetAttrIn the output parameters get attr from me
204 public void setOutputParametersGetAttrIn(List<GetAttrFuncData> outputParametersGetAttrIn) {
205 this.outputParametersGetAttrIn = outputParametersGetAttrIn;
209 * Add output parameters get attr data.
211 * @param getAttrFuncData get attr data
213 public void addOutputParamGetAttrIn(GetAttrFuncData getAttrFuncData) {
215 if (outputParametersGetAttrIn == null) {
216 outputParametersGetAttrIn = new ArrayList<>();
219 this.outputParametersGetAttrIn.add(getAttrFuncData);
223 * Gets nodes get attr out.
225 * @return the get attr out
227 public Map<String, List<GetAttrFuncData>> getNodesGetAttrOut() {
228 return nodesGetAttrOut;
232 * Sets nodes get attr out.
234 * @param nodesGetAttrOut the get attr out
236 public void setNodesGetAttrOut(Map<String, List<GetAttrFuncData>> nodesGetAttrOut) {
237 this.nodesGetAttrOut = nodesGetAttrOut;
241 * Add nodes get attr out data.
243 * @param nodeTemplateId the node template id
244 * @param getAttrFuncData get attr data
246 public void addNodesGetAttrOut(String nodeTemplateId, GetAttrFuncData getAttrFuncData) {
248 if (nodesGetAttrOut == null) {
249 nodesGetAttrOut = new HashMap<>();
252 this.nodesGetAttrOut.putIfAbsent(nodeTemplateId, new ArrayList<>());
253 this.nodesGetAttrOut.get(nodeTemplateId).add(getAttrFuncData);
256 public void removeParamNameFromAttrFuncList(String paramName) {
258 if (outputParametersGetAttrIn == null) {
262 outputParametersGetAttrIn.removeIf(outputParameters -> paramName.equals(outputParameters.getFieldName()));