Merge "Reorder modifiers"
[so.git] / mso-catalog-db / src / main / java / org / openecomp / mso / db / catalog / beans / VnfResource.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
4  * ================================================================================
5  * Copyright (C) 2017 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.mso.db.catalog.beans;
22
23
24 import java.io.Serializable;
25 import java.sql.Timestamp;
26 import java.text.DateFormat;
27 import java.util.HashSet;
28 import java.util.Set;
29 import java.util.List;
30 import java.util.ArrayList;
31
32 import org.openecomp.mso.db.catalog.utils.MavenLikeVersioning;
33
34 public class VnfResource extends MavenLikeVersioning implements Serializable {
35         
36         private static final long serialVersionUID = 768026109321305392L;
37
38         private String modelUuid = null;
39         private String modelInvariantUuid = null;
40         private String modelName = null;
41     private String toscaNodeType = null;
42     private String description = null;
43     private String orchestrationMode = null;
44     private String aicVersionMin = null;
45     private String aicVersionMax = null;
46     private String category = null;
47     private String subCategory = null;
48     private String heatTemplateArtifactUUId = null;
49     private Timestamp created = null;
50     private String modelVersion = null;
51     private Set<VnfResourceCustomization> vnfResourceCustomizations = new HashSet<>();
52     private Set<VfModule> vfModules = new HashSet<>();
53     private List<VfModuleCustomization> vfModuleCustomizations = new ArrayList<>();
54
55     public VnfResource () { }
56
57     public String getOrchestrationMode () {
58         return orchestrationMode;
59     }
60
61     public void setOrchestrationMode (String orchestrationMode) {
62         this.orchestrationMode = orchestrationMode;
63     }
64
65     public String getDescription () {
66         return description;
67     }
68
69     public void setDescription (String description) {
70         this.description = description;
71     }
72
73     public String getTemplateId () {
74         return heatTemplateArtifactUUId;
75     }
76
77     public void setTemplateId (String heatTemplateArtifactUUId) {
78         this.heatTemplateArtifactUUId = heatTemplateArtifactUUId;
79     }
80     public String getHeatTemplateArtifactUUId () {
81         return heatTemplateArtifactUUId;
82     }
83
84     public void setHeatTemplateArtifactUUId (String heatTemplateArtifactUUId) {
85         this.heatTemplateArtifactUUId = heatTemplateArtifactUUId;
86         }
87
88         public Timestamp getCreated() {
89                 return created;
90         }
91
92         public void setCreated(Timestamp created) {
93                 this.created = created;
94         }
95
96         public String getAicVersionMin() {
97                 return this.aicVersionMin;
98         }
99
100         public void setAicVersionMin(String aicVersionMin) {
101                 this.aicVersionMin = aicVersionMin;
102         }
103
104         public String getAicVersionMax() {
105                 return this.aicVersionMax;
106         }
107
108         public void setAicVersionMax(String aicVersionMax) {
109                 this.aicVersionMax = aicVersionMax;
110         }
111
112         
113     /**
114      * @return Returns the category.
115      */
116     public String getCategory() {
117         return category;
118     }
119
120     
121     /**
122      * @param category The category to set.
123      */
124     public void setCategory(String category) {
125         this.category = category;
126     }
127
128     
129     /**
130      * @return Returns the subCategory.
131      */
132     public String getSubCategory() {
133         return subCategory;
134     }
135
136     
137     /**
138      * @param subCategory The subCategory to set.
139      */
140     public void setSubCategory(String subCategory) {
141         this.subCategory = subCategory;
142     }
143
144     public String getModelInvariantUuid() {
145                 return this.modelInvariantUuid;
146         }
147
148         public void setModelInvariantUuid(String modelInvariantUuid) {
149                 this.modelInvariantUuid = modelInvariantUuid;
150         }
151
152         public String getModelName() {
153                 return modelName;
154         }
155
156         public void setModelName(String modelName) {
157                 this.modelName = modelName;
158         }
159
160         public String getModelUuid() {
161                 return modelUuid;
162         }
163
164         public void setModelUuid(String modelUuid) {
165                 this.modelUuid = modelUuid;
166         }
167
168         public String getModelInvariantId() {
169                 return this.modelInvariantUuid;
170         }
171
172         public String getToscaNodeType() {
173                 return toscaNodeType;
174         }
175
176         public void setToscaNodeType(String toscaNodeType) {
177                 this.toscaNodeType = toscaNodeType;
178         }
179
180         public Set<VnfResourceCustomization> getVnfResourceCustomizations() {
181                 return vnfResourceCustomizations;
182         }
183
184         public void setVnfResourceCustomizations(Set<VnfResourceCustomization> vnfResourceCustomizations) {
185                 this.vnfResourceCustomizations = vnfResourceCustomizations;
186         }
187
188         public Set<VfModule> getVfModules() {
189                 return vfModules;
190         }
191
192         public void setVfModules(Set<VfModule> vfModules) {
193                 this.vfModules = vfModules;
194         }
195
196         public List<VfModuleCustomization> getVfModuleCustomizations() {
197                 return this.vfModuleCustomizations == null ? new ArrayList<>() : this.vfModuleCustomizations;
198         }
199         public void setVfModuleCustomizations(List<VfModuleCustomization> vfModuleCustomizations) {
200                 this.vfModuleCustomizations = vfModuleCustomizations;
201         }
202         public void addVfModuleCustomization(VfModuleCustomization vfmc) {
203                 if (vfmc != null) {
204                         if (this.vfModuleCustomizations != null) {
205                                 this.vfModuleCustomizations.add(vfmc);
206                         } else {
207                                 this.vfModuleCustomizations = new ArrayList<>();
208                                 this.vfModuleCustomizations.add(vfmc);
209                         }
210         }
211         }
212
213         public void addVfModule(VfModule vfm) {
214                 if (vfm != null) {
215                         if (this.vfModules != null) {
216                                 this.vfModules.add(vfm);
217                         } else {
218                                 this.vfModules = new HashSet<>();
219                                 this.vfModules.add(vfm);
220                         }
221                 }
222         }
223         public ArrayList<VfModule> getVfModuleList() {
224                 if (this.vfModules == null || this.vfModules.size() < 1) {
225                         return null;
226         }
227                 ArrayList<VfModule> list = new ArrayList<>();
228                 list.addAll(this.vfModules);
229                 return list;
230         }
231         
232         public String getModelVersion() {
233                 return modelVersion;
234         }
235
236         public void setModelVersion(String modelVersion) {
237                 this.modelVersion = modelVersion;
238         }
239
240         @Override
241         public String toString () {
242                 StringBuilder sb = new StringBuilder();
243
244                 sb.append("VNF=");
245                 sb.append(",modelVersion=");
246                 sb.append(modelVersion);
247                 sb.append(",mode=");
248                 sb.append(orchestrationMode);
249                 sb.append(",heatTemplateArtifactUUId=");
250                 sb.append(heatTemplateArtifactUUId);
251                 sb.append(",envtId=");
252                 sb.append(",asdcUuid=");
253                 sb.append(",aicVersionMin=");
254                 sb.append(this.aicVersionMin);
255                 sb.append(",aicVersionMax=");
256                 sb.append(this.aicVersionMax);
257         sb.append(",modelInvariantUuid=");
258         sb.append(this.modelInvariantUuid);
259         sb.append(",modelVersion=");
260         sb.append(",modelCustomizationName=");
261         sb.append(",modelName=");
262         sb.append(this.modelName);
263         sb.append(",serviceModelInvariantUUID=");
264                 sb.append(",modelCustomizationUuid=");
265         sb.append(",toscaNodeType=");
266         sb.append(toscaNodeType);
267
268                 if (created != null) {
269                         sb.append(",created=");
270                         sb.append(DateFormat.getInstance().format(created));
271                 }
272                 
273                 for(VnfResourceCustomization vrc : vnfResourceCustomizations) {
274                         sb.append("/n").append(vrc.toString());
275                         }
276                 
277                 for(VfModule vfm : vfModules) {
278                         sb.append("/n").append(vfm.toString());
279                 }
280                 return sb.toString();
281     }
282
283 }