1 package org.openecomp.sdc.be.components.merge.instance;
3 import java.util.ArrayList;
4 import java.util.Collections;
5 import java.util.HashMap;
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;
17 * Created by chaya on 9/7/2017.
19 public class DataForMergeHolder {
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;
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<>();
41 public List<ArtifactDefinition> getOrigComponentInstanceHeatEnvArtifacts() {
42 return origComponentInstanceHeatEnvArtifacts;
45 public void setOrigComponentInstanceHeatEnvArtifacts(List<ArtifactDefinition> origComponentInstanceHeatEnvArtifacts) {
46 this.origComponentInstanceHeatEnvArtifacts = origComponentInstanceHeatEnvArtifacts;
49 public List<ComponentInstanceInput> getOrigComponentInstanceInputs() {
50 return origComponentInstanceInputs;
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);
79 public List<ComponentInstanceProperty> getOrigComponentInstanceProperties() {
80 return origComponentInstanceProperties;
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);
97 public List<InputDefinition> getOrigComponentInputs() {
98 return origComponentInputs;
101 public void setOrigComponentInputs(List<InputDefinition> origComponentInputs) {
102 this.origComponentInputs = origComponentInputs;
105 public Map<String, ArtifactDefinition> getOrigComponentDeploymentArtifactsCreatedOnTheInstance(){ return this.origCompInstDeploymentArtifactsCreatedOnTheInstance;}
107 public Map<String, ArtifactDefinition> getOrigComponentInformationalArtifactsCreatedOnTheInstance(){ return origCompInstInformationalArtifactsCreatedOnTheInstance;}
109 public void setOrigComponentDeploymentArtifactsCreatedOnTheInstance(Map<String, ArtifactDefinition> origDeploymentArtifacts){
110 origCompInstDeploymentArtifactsCreatedOnTheInstance = origDeploymentArtifacts;
113 public void setOrigComponentInformationalArtifactsCreatedOnTheInstance(Map<String, ArtifactDefinition> origInformationalArtifacts){
114 origCompInstInformationalArtifactsCreatedOnTheInstance = origInformationalArtifacts;
117 public void setVfRelationsInfo(VfRelationsMergeInfo vfRelationsMergeInfo) {
118 this.vfRelationsMergeInfo = vfRelationsMergeInfo;
121 public VfRelationsMergeInfo getVfRelationsMergeInfo() {
122 return vfRelationsMergeInfo;
125 public List<CapabilityDefinition> getOrigInstanceCapabilities() {
126 return origInstanceCapabilities;
129 public void setOrigInstanceCapabilities(List<CapabilityDefinition> origInstanceCapabilities) {
130 this.origInstanceCapabilities = origInstanceCapabilities;
133 public Component getOrigInstanceNode() {
134 return origInstanceNode;
137 public void setOrigInstanceNode(Component origInstanceNode) {
138 this.origInstanceNode = origInstanceNode;
141 public String getOrigComponentInstId() {
142 return origComponentInstId;
145 public void setOrigComponentInstId(String origComponentInstId) {
146 this.origComponentInstId = origComponentInstId;