cf35145753e42513a0a140b674df43d0f69d1a52
[vfc/nfvo/catalog.git] /
1 /**
2  * Copyright 2016 [ZTE] and others.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 package org.openo.commontosca.catalog.model.externalservice.entity.container;
18
19 import java.util.List;
20
21 import javax.xml.bind.annotation.XmlAccessType;
22 import javax.xml.bind.annotation.XmlAccessorType;
23 import javax.xml.bind.annotation.XmlAttribute;
24 import javax.xml.bind.annotation.XmlElement;
25 import javax.xml.bind.annotation.XmlElementWrapper;
26 import javax.xml.bind.annotation.XmlRootElement;
27
28 @XmlRootElement
29 @XmlAccessorType(XmlAccessType.NONE)
30 public class ContainerServiceTemplate {
31   @XmlAttribute
32   private String templateid;
33
34   @XmlAttribute
35   private String templatename;
36
37   @XmlElement(name = "BoundaryDefinitions")
38   private BoundaryDefinitions boundary;
39
40   public String getTemplateid() {
41     return templateid;
42   }
43
44   public void setTemplateid(String templateid) {
45     this.templateid = templateid;
46   }
47
48   public String getTemplatename() {
49     return templatename;
50   }
51
52   public void setTemplatename(String templatename) {
53     this.templatename = templatename;
54   }
55
56   public BoundaryDefinitions getBoundary() {
57     return boundary;
58   }
59
60   public void setBoundary(BoundaryDefinitions boundary) {
61     this.boundary = boundary;
62   }
63
64   @XmlRootElement
65   @XmlAccessorType(XmlAccessType.NONE)
66   public static class BoundaryDefinitions {
67     @XmlElement(name = "Properties", namespace = "http://docs.oasis-open.org/tosca/ns/2011/12")
68     private BoundaryProperties properties;
69
70     public BoundaryProperties getProperties() {
71       return properties;
72     }
73
74     public void setProperties(BoundaryProperties properties) {
75       this.properties = properties;
76     }
77
78   }
79
80   @XmlRootElement
81   @XmlAccessorType(XmlAccessType.NONE)
82   public static class BoundaryProperties {
83     @XmlElement(name = "Properties")
84     private BoundaryProperty property;
85
86     public BoundaryProperty getProperty() {
87       return property;
88     }
89
90     public void setProperty(BoundaryProperty property) {
91       this.property = property;
92     }
93   }
94
95   @XmlRootElement
96   @XmlAccessorType(XmlAccessType.NONE)
97   public static class BoundaryProperty {
98     public String getTemplateVersion() {
99       return templateVersion;
100     }
101
102     public void setTemplateVersion(String templateVersion) {
103       this.templateVersion = templateVersion;
104     }
105
106     public String getTemplateAuthor() {
107       return templateAuthor;
108     }
109
110     public void setTemplateAuthor(String templateAuthor) {
111       this.templateAuthor = templateAuthor;
112     }
113
114     public String getVendor() {
115       return vendor;
116     }
117
118     public void setVendor(String vendor) {
119       this.vendor = vendor;
120     }
121
122     public String getVersion() {
123       return version;
124     }
125
126     public void setVersion(String version) {
127       this.version = version;
128     }
129
130     public String getNfvType() {
131       return nfvType;
132     }
133
134     public void setNfvType(String nfvType) {
135       this.nfvType = nfvType;
136     }
137
138     public String getMoc() {
139       return moc;
140     }
141
142     public void setMoc(String moc) {
143       this.moc = moc;
144     }
145
146     public String getFlavor() {
147       return flavor;
148     }
149
150     public void setFlavor(String flavor) {
151       this.flavor = flavor;
152     }
153
154     public List<StFlavor> getStFlavor() {
155       return stFlavor;
156     }
157
158     public void setStFlavor(List<StFlavor> stFlavor) {
159       this.stFlavor = stFlavor;
160     }
161
162     @XmlElement
163     private String templateVersion;
164
165     @XmlElement
166     private String templateAuthor;
167
168     @XmlElement
169     private String vendor;
170
171     @XmlElement
172     private String version;
173
174     @XmlElement
175     private String nfvType;
176
177     @XmlElement
178     private String moc;
179
180     @XmlElement
181     private String flavor;
182
183     @XmlElementWrapper(name = "flavorList")
184     @XmlElement(name = "flavor")
185     private List<StFlavor> stFlavor;
186   }
187
188   @XmlRootElement
189   @XmlAccessorType(XmlAccessType.NONE)
190   public static class StFlavor {
191     @XmlAttribute
192     private String name;
193
194     @XmlAttribute
195     private String desc;
196
197     @XmlElementWrapper(name = "nodeList")
198     @XmlElement(name = "node")
199     private List<StFlavorConstituent> stFlavorConstituent;
200
201     public String getName() {
202       return name;
203     }
204
205     public void setName(String name) {
206       this.name = name;
207     }
208
209     public String getDesc() {
210       return desc;
211     }
212
213     public void setDesc(String desc) {
214       this.desc = desc;
215     }
216
217     public List<StFlavorConstituent> getStFlavorConstituent() {
218       return stFlavorConstituent;
219     }
220
221     public void setStFlavorConstituent(List<StFlavorConstituent> stFlavorConstituent) {
222       this.stFlavorConstituent = stFlavorConstituent;
223     }
224   }
225
226   @XmlRootElement
227   @XmlAccessorType(XmlAccessType.NONE)
228   public static class StFlavorConstituent {
229     @XmlAttribute
230     private String numberOfInstances;
231
232     @XmlAttribute
233     private String name;
234
235     @XmlAttribute
236     private String refNodeFlavor;
237
238     @XmlAttribute
239     private String affinity;
240
241     @XmlAttribute
242     private String redundancyModel;
243
244     @XmlAttribute
245     private String capability;
246
247     public String getAffinity() {
248       return affinity;
249     }
250
251     public void setAffinity(String affinity) {
252       this.affinity = affinity;
253     }
254
255     public String getRedundancyModel() {
256       return redundancyModel;
257     }
258
259     public void setRedundancyModel(String redundancyModel) {
260       this.redundancyModel = redundancyModel;
261     }
262
263     public String getCapability() {
264       return capability;
265     }
266
267     public void setCapability(String capability) {
268       this.capability = capability;
269     }
270
271     public String getNumberOfInstances() {
272       return numberOfInstances;
273     }
274
275     public void setNumberOfInstances(String numberOfInstances) {
276       this.numberOfInstances = numberOfInstances;
277     }
278
279     public String getName() {
280       return name;
281     }
282
283     public void setName(String name) {
284       this.name = name;
285     }
286
287     public String getRefNodeFlavor() {
288       return refNodeFlavor;
289     }
290
291     public void setRefNodeFlavor(String refNodeFlavor) {
292       this.refNodeFlavor = refNodeFlavor;
293     }
294   }
295
296   private Boolean propNullFlag;
297
298   private boolean isPropNotNull() {
299     if (null == propNullFlag) {
300       propNullFlag =
301           null != this.getBoundary() && null != this.getBoundary().getProperties()
302               && null != this.getBoundary().getProperties().getProperty();
303     }
304     return propNullFlag;
305   }
306
307   public String getProductType() {
308     return isPropNotNull() ? this.getBoundary().getProperties().getProperty().getMoc() : null;
309   }
310
311   public String getVendor() {
312     return isPropNotNull() ? this.getBoundary().getProperties().getProperty().getVendor() : null;
313   }
314
315   public String getVersion() {
316     return isPropNotNull() ? this.getBoundary().getProperties().getProperty().getVersion() : null;
317   }
318
319   public String getNfvtype() {
320     return isPropNotNull() ? this.getBoundary().getProperties().getProperty().getNfvType() : null;
321   }
322
323   public String getFlavor() {
324     return isPropNotNull() ? this.getBoundary().getProperties().getProperty().getFlavor() : null;
325   }
326
327   public List<StFlavor> getStFlavorList() {
328     return isPropNotNull() ? this.getBoundary().getProperties().getProperty().getStFlavor() : null;
329   }
330 }