Merge from ECOMP's repository
[vid.git] / vid-app-common / src / main / java / org / onap / vid / model / aaiTree / AAITreeNode.java
1 package org.onap.vid.model.aaiTree;
2
3 import org.apache.commons.lang3.StringUtils;
4
5 import java.util.*;
6
7 public class AAITreeNode {
8
9     private String type;
10     private int uniqueNumber;
11     private String orchestrationStatus;
12     private String provStatus;
13     private Boolean inMaint = null;
14     private String modelVersionId;
15     private String modelCustomizationId;
16     private String modelInvariantId;
17     private String id;
18     private String name;
19     private String modelVersion;
20     private String modelName;
21     private String modelCustomizationName;
22     private final List<AAITreeNode> children = Collections.synchronizedList(new LinkedList<>());
23     private Map<String, Object> additionalProperties = new HashMap<>();
24     private String keyInModel;
25     private AAITreeNode parent;
26
27     public String getType() {
28         return type;
29     }
30
31     public void setType(String type) {
32         this.type = type;
33     }
34
35     public int getUniqueNumber() {
36         return uniqueNumber;
37     }
38
39     public void setUniqueNumber(int uniqueNumber) {
40         this.uniqueNumber = uniqueNumber;
41     }
42     
43     public String getOrchestrationStatus() {
44         return orchestrationStatus;
45     }
46
47     public void setOrchestrationStatus(String orchestrationStatus) {
48         this.orchestrationStatus = orchestrationStatus;
49     }
50
51     public String getProvStatus() {
52         return provStatus;
53     }
54
55     public void setProvStatus(String provStatus) {
56         this.provStatus = provStatus;
57     }
58
59     public Boolean getInMaint() {
60         return inMaint;
61     }
62
63     public void setInMaint(Boolean inMaint) {
64         this.inMaint = inMaint;
65     }
66
67     public String getModelVersionId() {
68         return modelVersionId;
69     }
70
71     public void setModelVersionId(String modelVersionId) {
72         this.modelVersionId = modelVersionId;
73     }
74
75     public String getModelCustomizationId() {
76         return modelCustomizationId;
77     }
78
79     public void setModelCustomizationId(String modelCustomizationId) {
80         this.modelCustomizationId = modelCustomizationId;
81     }
82
83     public String getModelInvariantId() {
84         return modelInvariantId;
85     }
86
87     public void setModelInvariantId(String modelInvariantId) {
88         this.modelInvariantId = modelInvariantId;
89     }
90
91     public String getId() {
92         return id;
93     }
94
95     public void setId(String id) {
96         this.id = id;
97     }
98
99     public String getName() {
100         return name;
101     }
102
103     public void setName(String name) {
104         this.name = name;
105     }
106
107     public String getModelVersion() {
108         return modelVersion;
109     }
110
111     public void setModelVersion(String modelVersion) {
112         this.modelVersion = modelVersion;
113     }
114
115     public String getModelName() {
116         return modelName;
117     }
118
119     public void setModelName(String modelName) {
120         this.modelName = modelName;
121     }
122
123     public String getModelCustomizationName() {
124         return modelCustomizationName;
125     }
126
127     public void setModelCustomizationName(String modelCustomizationName) {
128         this.modelCustomizationName = modelCustomizationName;
129     }
130
131     public List<AAITreeNode> getChildren() {
132         return children;
133     }
134
135     public Map<String, Object> getAdditionalProperties() {
136         return additionalProperties;
137     }
138
139     public void setAdditionalProperties(Map<String, Object> additionalProperties) {
140         this.additionalProperties = additionalProperties;
141     }
142
143     public String getNodeKey() {
144         if (this.keyInModel != null) {
145             return this.keyInModel;
146         }
147
148         return StringUtils.defaultIfEmpty(this.modelVersionId, "not provided");
149     }
150
151     public String getUniqueNodeKey() {
152         return getNodeKey() + ":" + String.format("%03d", this.uniqueNumber);
153     }
154
155     public void setKeyInModel(String keyInModel) {
156         this.keyInModel = keyInModel;
157     }
158
159     public String getKeyInModel() {
160         return keyInModel;
161     }
162
163     public AAITreeNode getParent() {
164         return parent;
165     }
166
167     public void setParent(AAITreeNode parent) {
168         this.parent = parent;
169     }
170
171     public void addChildren(List<AAITreeNode> children) {
172         for (AAITreeNode child : children) {
173             child.setParent(this);
174         }
175
176         this.getChildren().addAll(children);
177     }
178 }