Change the header to SO
[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;
39         private String modelInvariantUuid;
40         private String modelName;
41     private String toscaNodeType;
42     private String description;
43     private String orchestrationMode;
44     private String aicVersionMin;
45     private String aicVersionMax;
46     private String heatTemplateArtifactUUId;
47     private Timestamp created;
48     private String modelVersion;
49     private Set<VnfResourceCustomization> vnfResourceCustomizations;
50     private Set<VfModule> vfModules;
51     private List<VfModule> vfModuleList;
52     private List<VfModuleCustomization> vfModuleCustomizations;
53
54     public VnfResource () { }
55
56     public String getOrchestrationMode () {
57         return orchestrationMode;
58     }
59
60     public void setOrchestrationMode (String orchestrationMode) {
61         this.orchestrationMode = orchestrationMode;
62     }
63
64     public String getDescription () {
65         return description;
66     }
67
68     public void setDescription (String description) {
69         this.description = description;
70     }
71
72     public String getTemplateId () {
73         return heatTemplateArtifactUUId;
74     }
75
76     public void setTemplateId (String heatTemplateArtifactUUId) {
77         this.heatTemplateArtifactUUId = heatTemplateArtifactUUId;
78     }
79     public String getHeatTemplateArtifactUUId () {
80         return heatTemplateArtifactUUId;
81     }
82
83     public void setHeatTemplateArtifactUUId (String heatTemplateArtifactUUId) {
84         this.heatTemplateArtifactUUId = heatTemplateArtifactUUId;
85         }
86
87         public Timestamp getCreated() {
88                 return created;
89         }
90
91         public void setCreated(Timestamp created) {
92                 this.created = created;
93         }
94
95         public String getAicVersionMin() {
96                 return this.aicVersionMin;
97         }
98
99         public void setAicVersionMin(String aicVersionMin) {
100                 this.aicVersionMin = aicVersionMin;
101         }
102
103         public String getAicVersionMax() {
104                 return this.aicVersionMax;
105         }
106
107         public void setAicVersionMax(String aicVersionMax) {
108                 this.aicVersionMax = aicVersionMax;
109         }
110
111         public String getModelInvariantUuid() {
112                 return this.modelInvariantUuid;
113         }
114
115         public void setModelInvariantUuid(String modelInvariantUuid) {
116                 this.modelInvariantUuid = modelInvariantUuid;
117         }
118
119         public String getModelName() {
120                 return modelName;
121         }
122
123         public void setModelName(String modelName) {
124                 this.modelName = modelName;
125         }
126
127         public String getModelUuid() {
128                 return modelUuid;
129         }
130
131         public void setModelUuid(String modelUuid) {
132                 this.modelUuid = modelUuid;
133         }
134
135         public String getModelInvariantId() {
136                 return this.modelInvariantUuid;
137         }
138
139         public String getToscaNodeType() {
140                 return toscaNodeType;
141         }
142
143         public void setToscaNodeType(String toscaNodeType) {
144                 this.toscaNodeType = toscaNodeType;
145         }
146
147         public Set<VnfResourceCustomization> getVnfResourceCustomizations() {
148                 return vnfResourceCustomizations;
149         }
150
151         public void setVnfResourceCustomizations(Set<VnfResourceCustomization> vnfResourceCustomizations) {
152                 this.vnfResourceCustomizations = vnfResourceCustomizations;
153         }
154
155         public Set<VfModule> getVfModules() {
156                 return vfModules;
157         }
158
159         public void setVfModules(Set<VfModule> vfModules) {
160                 this.vfModules = vfModules;
161         }
162
163         public List<VfModuleCustomization> getVfModuleCustomizations() {
164                 return this.vfModuleCustomizations == null ? new ArrayList<VfModuleCustomization>() : this.vfModuleCustomizations;
165         }
166         public void setVfModuleCustomizations(ArrayList<VfModuleCustomization> vfModuleCustomizations) {
167                 this.vfModuleCustomizations = vfModuleCustomizations;
168         }
169         public void addVfModuleCustomization(VfModuleCustomization vfmc) {
170                 if (vfmc != null) {
171                         if (this.vfModuleCustomizations != null) {
172                                 this.vfModuleCustomizations.add(vfmc);
173                         } else {
174                                 this.vfModuleCustomizations = new ArrayList<VfModuleCustomization>();
175                                 this.vfModuleCustomizations.add(vfmc);
176                         }
177         }
178         }
179
180         public void addVfModule(VfModule vfm) {
181                 if (vfm != null) {
182                         if (this.vfModules != null) {
183                                 this.vfModules.add(vfm);
184                         } else {
185                                 this.vfModules = new HashSet<VfModule>();
186                                 this.vfModules.add(vfm);
187                         }
188                 }
189         }
190         public ArrayList<VfModule> getVfModuleList() {
191                 if (this.vfModules == null || this.vfModules.size() < 1) {
192                         return null;
193         }
194                 ArrayList<VfModule> list = new ArrayList<VfModule>();
195                 for (VfModule vfm : this.vfModules) {
196                         list.add(vfm);
197         }
198                 return list;
199         }
200         
201         public String getModelVersion() {
202                 return modelVersion;
203         }
204
205         public void setModelVersion(String modelVersion) {
206                 this.modelVersion = modelVersion;
207         }
208
209         @Override
210         public String toString () {
211                 StringBuffer buf = new StringBuffer();
212
213                 buf.append("VNF=");
214                 buf.append(",modelVersion=");
215                 buf.append(modelVersion);
216                 buf.append(",mode=");
217                 buf.append(orchestrationMode);
218                 buf.append(",heatTemplateArtifactUUId=");
219                 buf.append(heatTemplateArtifactUUId);
220                 buf.append(",envtId=");
221                 buf.append(",asdcUuid=");
222                 buf.append(",aicVersionMin=");
223                 buf.append(this.aicVersionMin);
224                 buf.append(",aicVersionMax=");
225                 buf.append(this.aicVersionMax);
226         buf.append(",modelInvariantUuid=");
227         buf.append(this.modelInvariantUuid);
228         buf.append(",modelVersion=");
229         buf.append(",modelCustomizationName=");
230         buf.append(",modelName=");
231         buf.append(this.modelName);
232         buf.append(",serviceModelInvariantUUID=");
233                 buf.append(",modelCustomizationUuid=");
234         buf.append(",toscaNodeType=");
235         buf.append(toscaNodeType);
236
237                 if (created != null) {
238                         buf.append(",created=");
239                         buf.append(DateFormat.getInstance().format(created));
240                 }
241                 
242                 for(VnfResourceCustomization vrc : vnfResourceCustomizations) {
243                         buf.append("/n" + vrc.toString());
244                         }
245                 
246                 for(VfModule vfm : vfModules) {
247                         buf.append("/n" + vfm.toString());
248                 }
249                 return buf.toString();
250     }
251
252 }