f7165c12b0c11b724d2cfb5c951568a1a885a678
[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 package org.openo.commontosca.catalog.model.externalservice.entity.containerEntity;
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(
221                 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 = null != this.getBoundary()
301                     && 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()
309                 .getProperty().getMoc() : null;
310     }
311
312     public String getVendor() {
313         return isPropNotNull() ? this.getBoundary().getProperties()
314                 .getProperty().getVendor() : null;
315     }
316
317     public String getVersion() {
318         return isPropNotNull() ? this.getBoundary().getProperties()
319                 .getProperty().getVersion() : null;
320     }
321
322     public String getNfvtype() {
323         return isPropNotNull() ? this.getBoundary().getProperties()
324                 .getProperty().getNfvType() : null;
325     }
326
327     public String getFlavor() {
328         return isPropNotNull() ? this.getBoundary().getProperties()
329                 .getProperty().getFlavor() : null;
330     }
331
332     public List<STFlavor> getSTFlavorList() {
333         return isPropNotNull() ? this.getBoundary().getProperties()
334                 .getProperty().getStFlavor() : null;
335     }
336 }