2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2019 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
11 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
21 package org.openecomp.sdc.be.components.merge.instance;
24 import org.openecomp.sdc.be.model.ArtifactDefinition;
25 import org.openecomp.sdc.be.model.CapabilityDefinition;
26 import org.openecomp.sdc.be.model.Component;
27 import org.openecomp.sdc.be.model.ComponentInstanceInput;
28 import org.openecomp.sdc.be.model.ComponentInstanceInterface;
29 import org.openecomp.sdc.be.model.ComponentInstanceProperty;
30 import org.openecomp.sdc.be.model.InputDefinition;
32 import java.util.ArrayList;
33 import java.util.Collections;
34 import java.util.HashMap;
35 import java.util.List;
37 import java.util.Optional;
40 * Created by chaya on 9/7/2017.
42 public class DataForMergeHolder {
44 private List<ComponentInstanceInput> origComponentInstanceInputs;
45 private List<ComponentInstanceProperty> origComponentInstanceProperties;
46 private List<InputDefinition> origComponentInputs;
47 private Map<String, ArtifactDefinition> origCompInstDeploymentArtifactsCreatedOnTheInstance;
48 private Map<String, ArtifactDefinition> origCompInstInformationalArtifactsCreatedOnTheInstance;
49 private Map<String, List<String>> origComponentInstanceExternalRefs;
50 private List<ArtifactDefinition> origComponentInstanceHeatEnvArtifacts;
51 private ContainerRelationsMergeInfo containerRelationsMergeInfo;
52 private List<CapabilityDefinition> origInstanceCapabilities;
53 private Component origInstanceNode;
54 private Component currInstanceNode;
55 private String origComponentInstId;
56 private List<ComponentInstanceInterface> origComponentInstanceInterfaces;
57 private Map <String, Integer> componentInstanceDeploymentArtifactsTimeOut;
59 public DataForMergeHolder() {
60 origComponentInstanceInputs = new ArrayList<>();
61 origComponentInstanceProperties = new ArrayList<>();
62 origComponentInputs = new ArrayList<>();
63 origCompInstDeploymentArtifactsCreatedOnTheInstance = new HashMap<>();
64 origCompInstDeploymentArtifactsCreatedOnTheInstance = new HashMap<>();
65 origInstanceCapabilities = new ArrayList<>();
66 origComponentInstanceInterfaces = new ArrayList<>();
67 componentInstanceDeploymentArtifactsTimeOut = new HashMap<>();
70 List<ArtifactDefinition> getOrigComponentInstanceHeatEnvArtifacts() {
71 return origComponentInstanceHeatEnvArtifacts;
74 void setOrigComponentInstanceHeatEnvArtifacts(List<ArtifactDefinition> origComponentInstanceHeatEnvArtifacts) {
75 this.origComponentInstanceHeatEnvArtifacts = origComponentInstanceHeatEnvArtifacts;
78 List<ComponentInstanceInput> getOrigComponentInstanceInputs() {
79 return origComponentInstanceInputs;
82 void setOrigComponentInstanceInputs(List<ComponentInstanceInput> origComponentInstanceInputs) {
83 Optional.ofNullable(origComponentInstanceInputs).orElse(Collections.emptyList()).stream().forEach(input -> {
84 ComponentInstanceInput copyInput = new ComponentInstanceInput();
85 copyInput.setType(input.getType());
86 copyInput.setPath(input.getPath());
87 copyInput.setRules(input.getRules());
88 copyInput.setValueUniqueUid(input.getValueUniqueUid());
89 copyInput.setDefaultValue(input.getDefaultValue());
90 copyInput.setDescription(input.getDescription());
91 copyInput.setGetInputValues(input.getGetInputValues());
92 copyInput.setInputId(input.getInputId());
93 copyInput.setInputPath(input.getInputPath());
94 copyInput.setInputs(input.getInputs());
95 copyInput.setLabel(input.getLabel());
96 copyInput.setName(input.getName());
97 copyInput.setParentUniqueId(input.getParentUniqueId());
98 copyInput.setProperties(input.getProperties());
99 copyInput.setPropertyId(input.getPropertyId());
100 copyInput.setSchema(input.getSchema());
101 copyInput.setStatus(input.getStatus());
102 copyInput.setDefaultValue(input.getDefaultValue());
103 copyInput.setValue(input.getValue());
104 this.origComponentInstanceInputs.add(copyInput);
108 List<ComponentInstanceProperty> getOrigComponentInstanceProperties() {
109 return origComponentInstanceProperties;
112 void setOrigComponentInstanceProperties(List<ComponentInstanceProperty> origComponentInstanceProperties) {
113 Optional.ofNullable(origComponentInstanceProperties).orElse(Collections.emptyList()).stream().forEach(property -> {
114 ComponentInstanceProperty propertyCopy = new ComponentInstanceProperty();
115 propertyCopy.setType(property.getType());
116 propertyCopy.setName(property.getName());
117 propertyCopy.setValue(property.getValue());
118 propertyCopy.setUniqueId(property.getUniqueId());
119 propertyCopy.setDefaultValue(property.getDefaultValue());
120 propertyCopy.setInputId(property.getInputId());
121 propertyCopy.setGetInputValues(property.getGetInputValues());
122 this.origComponentInstanceProperties.add(propertyCopy);
126 List<InputDefinition> getOrigComponentInputs() {
127 return origComponentInputs;
130 void setOrigComponentInputs(List<InputDefinition> origComponentInputs) {
131 this.origComponentInputs = origComponentInputs;
134 Map<String, ArtifactDefinition> getOrigComponentDeploymentArtifactsCreatedOnTheInstance(){ return this.origCompInstDeploymentArtifactsCreatedOnTheInstance;}
136 Map<String, ArtifactDefinition> getOrigComponentInformationalArtifactsCreatedOnTheInstance(){ return origCompInstInformationalArtifactsCreatedOnTheInstance;}
138 void setOrigComponentDeploymentArtifactsCreatedOnTheInstance(Map<String, ArtifactDefinition> origDeploymentArtifacts){
139 origCompInstDeploymentArtifactsCreatedOnTheInstance = origDeploymentArtifacts;
142 void setOrigComponentInformationalArtifactsCreatedOnTheInstance(Map<String, ArtifactDefinition> origInformationalArtifacts){
143 origCompInstInformationalArtifactsCreatedOnTheInstance = origInformationalArtifacts;
146 Map<String, List<String>> getOrigCompInstExternalRefs() {
147 return origComponentInstanceExternalRefs;
150 void setOrigComponentInstanceExternalRefs(Map<String, List<String>> origComponentInstanceExternalRefs) {
151 this.origComponentInstanceExternalRefs = origComponentInstanceExternalRefs;
154 void setVfRelationsInfo(ContainerRelationsMergeInfo containerRelationsMergeInfo) {
155 this.containerRelationsMergeInfo = containerRelationsMergeInfo;
158 ContainerRelationsMergeInfo getContainerRelationsMergeInfo() {
159 return containerRelationsMergeInfo;
162 List<CapabilityDefinition> getOrigInstanceCapabilities() {
163 return origInstanceCapabilities;
166 void setOrigInstanceCapabilities(List<CapabilityDefinition> origInstanceCapabilities) {
167 this.origInstanceCapabilities = origInstanceCapabilities;
170 Component getOrigInstanceNode() {
171 return origInstanceNode;
174 void setOrigInstanceNode(Component origInstanceNode) {
175 this.origInstanceNode = origInstanceNode;
178 Component getCurrInstanceNode() {
179 return currInstanceNode;
182 public void setCurrInstanceNode(Component currInstanceNode) {
183 this.currInstanceNode = currInstanceNode;
186 public String getOrigComponentInstId() {
187 return origComponentInstId;
190 public void setOrigComponentInstId(String origComponentInstId) {
191 this.origComponentInstId = origComponentInstId;
194 void setComponentInstanceDeploymentArtifactsTimeOut(Map<String,Integer> componentInstancesDeploymentArtifacts) {
195 this.componentInstanceDeploymentArtifactsTimeOut = componentInstancesDeploymentArtifacts;
198 public Map<String, Integer> getComponentInstanceDeploymentArtifactsTimeOut() {
199 return componentInstanceDeploymentArtifactsTimeOut;
202 public List<ComponentInstanceInterface> getOrigComponentInstanceInterfaces() {
203 return origComponentInstanceInterfaces;
206 public void setOrigComponentInstanceInterfaces(List<ComponentInstanceInterface> origComponentInstanceInterfaces) {
207 this.origComponentInstanceInterfaces = origComponentInstanceInterfaces;