Catalog alignment
[sdc.git] / catalog-be / src / main / java / org / openecomp / sdc / be / components / merge / instance / DataForMergeHolder.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
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
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.sdc.be.components.merge.instance;
22
23
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;
31
32 import java.util.ArrayList;
33 import java.util.Collections;
34 import java.util.HashMap;
35 import java.util.List;
36 import java.util.Map;
37 import java.util.Optional;
38
39 /**
40  * Created by chaya on 9/7/2017.
41  */
42 public class DataForMergeHolder {
43
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;
58
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<>();
68     }
69
70     List<ArtifactDefinition> getOrigComponentInstanceHeatEnvArtifacts() {
71         return origComponentInstanceHeatEnvArtifacts;
72     }
73
74     void setOrigComponentInstanceHeatEnvArtifacts(List<ArtifactDefinition> origComponentInstanceHeatEnvArtifacts) {
75         this.origComponentInstanceHeatEnvArtifacts = origComponentInstanceHeatEnvArtifacts;
76     }
77
78     List<ComponentInstanceInput> getOrigComponentInstanceInputs() {
79         return origComponentInstanceInputs;
80     }
81
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);
105         });
106     }
107
108     List<ComponentInstanceProperty> getOrigComponentInstanceProperties() {
109         return origComponentInstanceProperties;
110     }
111
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);
123         });
124     }
125
126     List<InputDefinition> getOrigComponentInputs() {
127         return origComponentInputs;
128     }
129
130     void setOrigComponentInputs(List<InputDefinition> origComponentInputs) {
131         this.origComponentInputs = origComponentInputs;
132     }
133
134     Map<String, ArtifactDefinition> getOrigComponentDeploymentArtifactsCreatedOnTheInstance(){ return this.origCompInstDeploymentArtifactsCreatedOnTheInstance;}
135
136     Map<String, ArtifactDefinition> getOrigComponentInformationalArtifactsCreatedOnTheInstance(){ return origCompInstInformationalArtifactsCreatedOnTheInstance;}
137
138     void setOrigComponentDeploymentArtifactsCreatedOnTheInstance(Map<String, ArtifactDefinition> origDeploymentArtifacts){
139         origCompInstDeploymentArtifactsCreatedOnTheInstance = origDeploymentArtifacts;
140     }
141
142     void setOrigComponentInformationalArtifactsCreatedOnTheInstance(Map<String, ArtifactDefinition> origInformationalArtifacts){
143         origCompInstInformationalArtifactsCreatedOnTheInstance = origInformationalArtifacts;
144     }
145
146     Map<String, List<String>> getOrigCompInstExternalRefs() {
147         return origComponentInstanceExternalRefs;
148     }
149
150     void setOrigComponentInstanceExternalRefs(Map<String, List<String>> origComponentInstanceExternalRefs) {
151         this.origComponentInstanceExternalRefs = origComponentInstanceExternalRefs;
152     }
153
154     void setVfRelationsInfo(ContainerRelationsMergeInfo containerRelationsMergeInfo) {
155         this.containerRelationsMergeInfo = containerRelationsMergeInfo;
156     }
157
158     ContainerRelationsMergeInfo getContainerRelationsMergeInfo() {
159         return containerRelationsMergeInfo;
160     }
161
162     List<CapabilityDefinition> getOrigInstanceCapabilities() {
163         return origInstanceCapabilities;
164     }
165
166     void setOrigInstanceCapabilities(List<CapabilityDefinition> origInstanceCapabilities) {
167         this.origInstanceCapabilities = origInstanceCapabilities;
168     }
169
170     Component getOrigInstanceNode() {
171         return origInstanceNode;
172     }
173
174     void setOrigInstanceNode(Component origInstanceNode) {
175         this.origInstanceNode = origInstanceNode;
176     }
177
178     Component getCurrInstanceNode() {
179         return currInstanceNode;
180     }
181
182     public void setCurrInstanceNode(Component currInstanceNode) {
183         this.currInstanceNode = currInstanceNode;
184     }
185
186     public String getOrigComponentInstId() {
187         return origComponentInstId;
188     }
189
190     public void setOrigComponentInstId(String origComponentInstId) {
191         this.origComponentInstId = origComponentInstId;
192     }
193
194     void setComponentInstanceDeploymentArtifactsTimeOut(Map<String,Integer> componentInstancesDeploymentArtifacts) {
195         this.componentInstanceDeploymentArtifactsTimeOut = componentInstancesDeploymentArtifacts;
196     }
197
198     public Map<String, Integer> getComponentInstanceDeploymentArtifactsTimeOut() {
199         return componentInstanceDeploymentArtifactsTimeOut;
200     }
201
202     public List<ComponentInstanceInterface> getOrigComponentInstanceInterfaces() {
203         return origComponentInstanceInterfaces;
204     }
205
206     public void setOrigComponentInstanceInterfaces(List<ComponentInstanceInterface> origComponentInstanceInterfaces) {
207         this.origComponentInstanceInterfaces = origComponentInstanceInterfaces;
208     }
209
210 }