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 //key - node template id which include get attribute function from this entity
45 //value - List of getAttr data
46 private Map<String, List<GetAttrFuncData>> nodesGetAttrIn;
48 //key - node template id which is pointed by this entity using get attribute function
49 //value - List of getAttr data
50 private Map<String, List<GetAttrFuncData>> nodesGetAttrOut;
52 //List of getAttr data
53 private List<GetAttrFuncData> outputParametersGetAttrIn;
56 * Gets node template id.
58 * @return the node template id
60 public String getNodeTemplateId() {
61 return nodeTemplateId;
65 * Sets node template id.
67 * @param nodeTemplateId the node template id
69 public void setNodeTemplateId(String nodeTemplateId) {
70 this.nodeTemplateId = nodeTemplateId;
74 * Gets group ids point to me.
76 * @return the group ids point to me
78 public List<String> getGroupIds() {
83 * Sets group ids point to me.
85 * @param groupIds the group ids point to me
87 public void setGroupIds(List<String> groupIds) {
88 this.groupIds = groupIds;
93 * Sets node connected to me.
95 * @param nodesConnectedIn the node connected to me
97 public void setNodesConnectedIn(Map<String, List<RequirementAssignmentData>> nodesConnectedIn) {
98 this.nodesConnectedIn = nodesConnectedIn;
102 * Add nodeConnectedIn.
104 * @param nodeTemplateId the node template id which has connection to me
105 * @param requirementId the requirement id
106 * @param requirementAssignment the requirement assignment
108 public void addNodesConnectedIn(String nodeTemplateId, String requirementId,
109 RequirementAssignment requirementAssignment) {
111 if (this.nodesConnectedIn == null) {
112 this.nodesConnectedIn = new HashMap<>();
115 this.nodesConnectedIn.computeIfAbsent(nodeTemplateId, k -> new ArrayList<>());
116 this.nodesConnectedIn.get(nodeTemplateId).add(
117 new RequirementAssignmentData(requirementId, requirementAssignment));
121 * Gets node connected to me.
123 * @return the node connected to me
125 public Map<String, List<RequirementAssignmentData>> getNodesConnectedIn() {
126 return nodesConnectedIn;
131 * Gets node connected from me.
133 * @return the node connected from me
135 public Map<String, List<RequirementAssignmentData>> getNodesConnectedOut() {
136 return nodesConnectedOut;
140 * Sets node connected from me.
142 * @param nodesConnectedOut the node connected from me
144 public void setNodesConnectedOut(Map<String, List<RequirementAssignmentData>> nodesConnectedOut) {
145 this.nodesConnectedOut = nodesConnectedOut;
149 * Add nodeConnectedOut.
151 * @param nodeTemplateId the node template id which is connected from me
152 * @param requirementId the requirement id
153 * @param requirementAssignment the requirement assignment
155 public void addNodesConnectedOut(String nodeTemplateId, String requirementId,
156 RequirementAssignment requirementAssignment) {
158 if (this.nodesConnectedOut == null) {
159 this.nodesConnectedOut = new HashMap<>();
162 this.nodesConnectedOut.computeIfAbsent(nodeTemplateId, k -> new ArrayList<>());
163 this.nodesConnectedOut.get(nodeTemplateId).add(
164 new RequirementAssignmentData(requirementId, requirementAssignment));
168 * Gets nodes get attr in.
170 * @return the get attr in
172 public Map<String, List<GetAttrFuncData>> getNodesGetAttrIn() {
173 return nodesGetAttrIn;
177 * Sets nodes get attr in.
179 * @param nodesGetAttrIn the get attr in
181 public void setNodesGetAttrIn(Map<String, List<GetAttrFuncData>> nodesGetAttrIn) {
182 this.nodesGetAttrIn = nodesGetAttrIn;
186 * Add nodes get attr in data.
188 * @param nodeTemplateId the node template id
189 * @param getAttrFuncData get attr data
191 public void addNodesGetAttrIn(String nodeTemplateId, GetAttrFuncData getAttrFuncData) {
193 if (nodesGetAttrIn == null) {
194 nodesGetAttrIn = new HashMap<>();
197 this.nodesGetAttrIn.putIfAbsent(nodeTemplateId, new ArrayList<>());
198 this.nodesGetAttrIn.get(nodeTemplateId).add(getAttrFuncData);
202 * Gets output parameters get attr from me.
204 * @return the get attr from me
206 public List<GetAttrFuncData> getOutputParametersGetAttrIn() {
207 return outputParametersGetAttrIn;
211 * Sets output parameters get attr from me.
213 * @param outputParametersGetAttrIn the output parameters get attr from me
215 public void setOutputParametersGetAttrIn(List<GetAttrFuncData> outputParametersGetAttrIn) {
216 this.outputParametersGetAttrIn = outputParametersGetAttrIn;
220 * Add output parameters get attr data.
222 * @param getAttrFuncData get attr data
224 public void addOutputParamGetAttrIn(GetAttrFuncData getAttrFuncData) {
226 if (outputParametersGetAttrIn == null) {
227 outputParametersGetAttrIn = new ArrayList<>();
230 this.outputParametersGetAttrIn.add(getAttrFuncData);
234 * Gets nodes get attr out.
236 * @return the get attr out
238 public Map<String, List<GetAttrFuncData>> getNodesGetAttrOut() {
239 return nodesGetAttrOut;
243 * Sets nodes get attr out.
245 * @param nodesGetAttrOut the get attr out
247 public void setNodesGetAttrOut(Map<String, List<GetAttrFuncData>> nodesGetAttrOut) {
248 this.nodesGetAttrOut = nodesGetAttrOut;
252 * Add nodes get attr out data.
254 * @param nodeTemplateId the node template id
255 * @param getAttrFuncData get attr data
257 public void addNodesGetAttrOut(String nodeTemplateId, GetAttrFuncData getAttrFuncData) {
259 if (nodesGetAttrOut == null) {
260 nodesGetAttrOut = new HashMap<>();
263 this.nodesGetAttrOut.putIfAbsent(nodeTemplateId, new ArrayList<>());
264 this.nodesGetAttrOut.get(nodeTemplateId).add(getAttrFuncData);
267 public void removeParamNameFromAttrFuncList(String paramName) {
269 if (outputParametersGetAttrIn == null) {
273 outputParametersGetAttrIn.removeIf(outputParameters -> paramName.equals(outputParameters.getFieldName()));