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