Added oparent to sdc main
[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.*;
25
26 import java.util.*;
27
28 /**
29  * Created by chaya on 9/7/2017.
30  */
31 public class DataForMergeHolder {
32
33     private List<ComponentInstanceInput> origComponentInstanceInputs;
34     private List<ComponentInstanceProperty> origComponentInstanceProperties;
35     private List<InputDefinition> origComponentInputs;
36     private Map<String, ArtifactDefinition> origCompInstDeploymentArtifactsCreatedOnTheInstance;
37     private Map<String, ArtifactDefinition> origCompInstInformationalArtifactsCreatedOnTheInstance;
38     private Map<String, List<String>> origComponentInstanceExternalRefs;
39     private List<ArtifactDefinition> origComponentInstanceHeatEnvArtifacts;
40     private ContainerRelationsMergeInfo containerRelationsMergeInfo;
41     private List<CapabilityDefinition> origInstanceCapabilities;
42     private Component origInstanceNode;
43     private Component currInstanceNode;
44     private String origComponentInstId;
45     private List<ComponentInstanceInterface> origComponentInstanceInterfaces;
46
47     public DataForMergeHolder() {
48         origComponentInstanceInputs = new ArrayList<>();
49         origComponentInstanceProperties = new ArrayList<>();
50         origComponentInputs = new ArrayList<>();
51         origCompInstDeploymentArtifactsCreatedOnTheInstance = new HashMap<>();
52         origCompInstDeploymentArtifactsCreatedOnTheInstance = new HashMap<>();
53         origInstanceCapabilities = new ArrayList<>();
54         origComponentInstanceInterfaces = new ArrayList<>();
55     }
56
57     List<ArtifactDefinition> getOrigComponentInstanceHeatEnvArtifacts() {
58         return origComponentInstanceHeatEnvArtifacts;
59     }
60
61     void setOrigComponentInstanceHeatEnvArtifacts(List<ArtifactDefinition> origComponentInstanceHeatEnvArtifacts) {
62         this.origComponentInstanceHeatEnvArtifacts = origComponentInstanceHeatEnvArtifacts;
63     }
64
65     List<ComponentInstanceInput> getOrigComponentInstanceInputs() {
66         return origComponentInstanceInputs;
67     }
68
69     void setOrigComponentInstanceInputs(List<ComponentInstanceInput> origComponentInstanceInputs) {
70         Optional.ofNullable(origComponentInstanceInputs).orElse(Collections.emptyList()).stream().forEach(input -> {
71             ComponentInstanceInput copyInput = new ComponentInstanceInput();
72             copyInput.setType(input.getType());
73             copyInput.setPath(input.getPath());
74             copyInput.setRules(input.getRules());
75             copyInput.setValueUniqueUid(input.getValueUniqueUid());
76             copyInput.setDefaultValue(input.getDefaultValue());
77             copyInput.setDescription(input.getDescription());
78             copyInput.setGetInputValues(input.getGetInputValues());
79             copyInput.setInputId(input.getInputId());
80             copyInput.setInputPath(input.getInputPath());
81             copyInput.setInputs(input.getInputs());
82             copyInput.setLabel(input.getLabel());
83             copyInput.setName(input.getName());
84             copyInput.setParentUniqueId(input.getParentUniqueId());
85             copyInput.setProperties(input.getProperties());
86             copyInput.setPropertyId(input.getPropertyId());
87             copyInput.setSchema(input.getSchema());
88             copyInput.setStatus(input.getStatus());
89             copyInput.setDefaultValue(input.getDefaultValue());
90             copyInput.setValue(input.getValue());
91             this.origComponentInstanceInputs.add(copyInput);
92         });
93     }
94
95     List<ComponentInstanceProperty> getOrigComponentInstanceProperties() {
96         return origComponentInstanceProperties;
97     }
98
99     void setOrigComponentInstanceProperties(List<ComponentInstanceProperty> origComponentInstanceProperties) {
100         Optional.ofNullable(origComponentInstanceProperties).orElse(Collections.emptyList()).stream().forEach(property -> {
101             ComponentInstanceProperty propertyCopy = new ComponentInstanceProperty();
102             propertyCopy.setType(property.getType());
103             propertyCopy.setName(property.getName());
104             propertyCopy.setValue(property.getValue());
105             propertyCopy.setUniqueId(property.getUniqueId());
106             propertyCopy.setDefaultValue(property.getDefaultValue());
107             propertyCopy.setInputId(property.getInputId());
108             propertyCopy.setGetInputValues(property.getGetInputValues());
109             this.origComponentInstanceProperties.add(propertyCopy);
110         });
111     }
112
113     List<InputDefinition> getOrigComponentInputs() {
114         return origComponentInputs;
115     }
116
117     void setOrigComponentInputs(List<InputDefinition> origComponentInputs) {
118         this.origComponentInputs = origComponentInputs;
119     }
120
121     Map<String, ArtifactDefinition> getOrigComponentDeploymentArtifactsCreatedOnTheInstance(){ return this.origCompInstDeploymentArtifactsCreatedOnTheInstance;}
122
123     Map<String, ArtifactDefinition> getOrigComponentInformationalArtifactsCreatedOnTheInstance(){ return origCompInstInformationalArtifactsCreatedOnTheInstance;}
124
125     void setOrigComponentDeploymentArtifactsCreatedOnTheInstance(Map<String, ArtifactDefinition> origDeploymentArtifacts){
126         origCompInstDeploymentArtifactsCreatedOnTheInstance = origDeploymentArtifacts;
127     }
128
129     void setOrigComponentInformationalArtifactsCreatedOnTheInstance(Map<String, ArtifactDefinition> origInformationalArtifacts){
130         origCompInstInformationalArtifactsCreatedOnTheInstance = origInformationalArtifacts;
131     }
132
133     Map<String, List<String>> getOrigCompInstExternalRefs() {
134         return origComponentInstanceExternalRefs;
135     }
136
137     void setOrigComponentInstanceExternalRefs(Map<String, List<String>> origComponentInstanceExternalRefs) {
138         this.origComponentInstanceExternalRefs = origComponentInstanceExternalRefs;
139     }
140
141     void setVfRelationsInfo(ContainerRelationsMergeInfo containerRelationsMergeInfo) {
142         this.containerRelationsMergeInfo = containerRelationsMergeInfo;
143     }
144
145     ContainerRelationsMergeInfo getContainerRelationsMergeInfo() {
146         return containerRelationsMergeInfo;
147     }
148
149     List<CapabilityDefinition> getOrigInstanceCapabilities() {
150         return origInstanceCapabilities;
151     }
152
153     void setOrigInstanceCapabilities(List<CapabilityDefinition> origInstanceCapabilities) {
154         this.origInstanceCapabilities = origInstanceCapabilities;
155     }
156
157     Component getOrigInstanceNode() {
158         return origInstanceNode;
159     }
160
161     void setOrigInstanceNode(Component origInstanceNode) {
162         this.origInstanceNode = origInstanceNode;
163     }
164
165     Component getCurrInstanceNode() {
166         return currInstanceNode;
167     }
168
169     public void setCurrInstanceNode(Component currInstanceNode) {
170         this.currInstanceNode = currInstanceNode;
171     }
172
173     public String getOrigComponentInstId() {
174         return origComponentInstId;
175     }
176
177     public void setOrigComponentInstId(String origComponentInstId) {
178         this.origComponentInstId = origComponentInstId;
179     }
180
181     public List<ComponentInstanceInterface> getOrigComponentInstanceInterfaces() {
182         return origComponentInstanceInterfaces;
183     }
184
185     public void setOrigComponentInstanceInterfaces(List<ComponentInstanceInterface> origComponentInstanceInterfaces) {
186         this.origComponentInstanceInterfaces = origComponentInstanceInterfaces;
187     }
188 }