Sync Integ to Master
[sdc.git] / catalog-be / src / main / java / org / openecomp / sdc / be / components / merge / instance / DataForMergeHolder.java
1 package org.openecomp.sdc.be.components.merge.instance;
2
3 import java.util.ArrayList;
4 import java.util.Collections;
5 import java.util.HashMap;
6 import java.util.List;
7 import java.util.Map;
8 import java.util.Optional;
9 import org.openecomp.sdc.be.model.ArtifactDefinition;
10 import org.openecomp.sdc.be.model.CapabilityDefinition;
11 import org.openecomp.sdc.be.model.Component;
12 import org.openecomp.sdc.be.model.ComponentInstanceInput;
13 import org.openecomp.sdc.be.model.ComponentInstanceProperty;
14 import org.openecomp.sdc.be.model.InputDefinition;
15
16 /**
17  * Created by chaya on 9/7/2017.
18  */
19 public class DataForMergeHolder {
20
21     private List<ComponentInstanceInput> origComponentInstanceInputs;
22     private List<ComponentInstanceProperty> origComponentInstanceProperties;
23     private List<InputDefinition> origComponentInputs;
24     private Map<String, ArtifactDefinition> origCompInstDeploymentArtifactsCreatedOnTheInstance;
25     private Map<String, ArtifactDefinition> origCompInstInformationalArtifactsCreatedOnTheInstance;
26     private List<ArtifactDefinition> origComponentInstanceHeatEnvArtifacts;
27     private VfRelationsMergeInfo vfRelationsMergeInfo;
28     private List<CapabilityDefinition> origInstanceCapabilities;
29     private Component origInstanceNode;
30     private String origComponentInstId;
31
32     public DataForMergeHolder() {
33         origComponentInstanceInputs = new ArrayList<>();
34         origComponentInstanceProperties = new ArrayList<>();
35         origComponentInputs = new ArrayList<>();
36         origCompInstDeploymentArtifactsCreatedOnTheInstance = new HashMap<>();
37         origCompInstDeploymentArtifactsCreatedOnTheInstance = new HashMap<>();
38         origInstanceCapabilities = new ArrayList<>();
39     }
40
41     public List<ArtifactDefinition> getOrigComponentInstanceHeatEnvArtifacts() {
42         return origComponentInstanceHeatEnvArtifacts;
43     }
44
45     public void setOrigComponentInstanceHeatEnvArtifacts(List<ArtifactDefinition> origComponentInstanceHeatEnvArtifacts) {
46         this.origComponentInstanceHeatEnvArtifacts = origComponentInstanceHeatEnvArtifacts;
47     }
48
49     public List<ComponentInstanceInput> getOrigComponentInstanceInputs() {
50         return origComponentInstanceInputs;
51     }
52
53     public void setOrigComponentInstanceInputs(List<ComponentInstanceInput> origComponentInstanceInputs) {
54         Optional.ofNullable(origComponentInstanceInputs).orElse(Collections.emptyList()).stream().forEach(input -> {
55             ComponentInstanceInput copyInput = new ComponentInstanceInput();
56             copyInput.setType(input.getType());
57             copyInput.setPath(input.getPath());
58             copyInput.setRules(input.getRules());
59             copyInput.setValueUniqueUid(input.getValueUniqueUid());
60             copyInput.setDefaultValue(input.getDefaultValue());
61             copyInput.setDescription(input.getDescription());
62             copyInput.setGetInputValues(input.getGetInputValues());
63             copyInput.setInputId(input.getInputId());
64             copyInput.setInputPath(input.getInputPath());
65             copyInput.setInputs(input.getInputs());
66             copyInput.setLabel(input.getLabel());
67             copyInput.setName(input.getName());
68             copyInput.setParentUniqueId(input.getParentUniqueId());
69             copyInput.setProperties(input.getProperties());
70             copyInput.setPropertyId(input.getPropertyId());
71             copyInput.setSchema(input.getSchema());
72             copyInput.setStatus(input.getStatus());
73             copyInput.setDefaultValue(input.getDefaultValue());
74             copyInput.setValue(input.getValue());
75             this.origComponentInstanceInputs.add(copyInput);
76         });
77     }
78
79     public List<ComponentInstanceProperty> getOrigComponentInstanceProperties() {
80         return origComponentInstanceProperties;
81     }
82
83     public void setOrigComponentInstanceProperties(List<ComponentInstanceProperty> origComponentInstanceProperties) {
84         Optional.ofNullable(origComponentInstanceProperties).orElse(Collections.emptyList()).stream().forEach(property -> {
85             ComponentInstanceProperty propertyCopy = new ComponentInstanceProperty();
86             propertyCopy.setType(property.getType());
87             propertyCopy.setName(property.getName());
88             propertyCopy.setValue(property.getValue());
89             propertyCopy.setUniqueId(property.getUniqueId());
90             propertyCopy.setDefaultValue(property.getDefaultValue());
91             propertyCopy.setInputId(property.getInputId());
92             propertyCopy.setGetInputValues(property.getGetInputValues());
93             this.origComponentInstanceProperties.add(propertyCopy);
94         });
95     }
96
97     public List<InputDefinition> getOrigComponentInputs() {
98         return origComponentInputs;
99     }
100
101     public void setOrigComponentInputs(List<InputDefinition> origComponentInputs) {
102         this.origComponentInputs = origComponentInputs;
103     }
104
105     public Map<String, ArtifactDefinition> getOrigComponentDeploymentArtifactsCreatedOnTheInstance(){ return this.origCompInstDeploymentArtifactsCreatedOnTheInstance;}
106
107     public Map<String, ArtifactDefinition> getOrigComponentInformationalArtifactsCreatedOnTheInstance(){ return origCompInstInformationalArtifactsCreatedOnTheInstance;}
108
109     public void setOrigComponentDeploymentArtifactsCreatedOnTheInstance(Map<String, ArtifactDefinition> origDeploymentArtifacts){
110         origCompInstDeploymentArtifactsCreatedOnTheInstance = origDeploymentArtifacts;
111     }
112
113     public void setOrigComponentInformationalArtifactsCreatedOnTheInstance(Map<String, ArtifactDefinition> origInformationalArtifacts){
114         origCompInstInformationalArtifactsCreatedOnTheInstance = origInformationalArtifacts;
115     }
116
117     public void setVfRelationsInfo(VfRelationsMergeInfo vfRelationsMergeInfo) {
118         this.vfRelationsMergeInfo = vfRelationsMergeInfo;
119     }
120
121     public VfRelationsMergeInfo getVfRelationsMergeInfo() {
122         return vfRelationsMergeInfo;
123     }
124
125     public List<CapabilityDefinition> getOrigInstanceCapabilities() {
126         return origInstanceCapabilities;
127     }
128
129     public void setOrigInstanceCapabilities(List<CapabilityDefinition> origInstanceCapabilities) {
130         this.origInstanceCapabilities = origInstanceCapabilities;
131     }
132
133     public Component getOrigInstanceNode() {
134         return origInstanceNode;
135     }
136
137     public void setOrigInstanceNode(Component origInstanceNode) {
138         this.origInstanceNode = origInstanceNode;
139     }
140
141     public String getOrigComponentInstId() {
142         return origComponentInstId;
143     }
144
145     public void setOrigComponentInstId(String origComponentInstId) {
146         this.origComponentInstId = origComponentInstId;
147     }
148 }