summaryrefslogtreecommitdiffstats
path: root/catalog-core/catalog-mgr/src/main/java/org/openo/commontosca/catalog/model/externalservice/entity/container/ContainerServiceTemplate.java
blob: 54e02cdbd654e772a263ce07073c2c07b2cf7ec2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
/**
 * Copyright 2016 ZTE Corporation.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.openo.commontosca.catalog.model.externalservice.entity.container;

import java.util.List;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;

@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
public class ContainerServiceTemplate {
  @XmlAttribute
  private String templateid;

  @XmlAttribute
  private String templatename;

  @XmlElement(name = "BoundaryDefinitions")
  private BoundaryDefinitions boundary;

  public String getTemplateid() {
    return templateid;
  }

  public void setTemplateid(String templateid) {
    this.templateid = templateid;
  }

  public String getTemplatename() {
    return templatename;
  }

  public void setTemplatename(String templatename) {
    this.templatename = templatename;
  }

  public BoundaryDefinitions getBoundary() {
    return boundary;
  }

  public void setBoundary(BoundaryDefinitions boundary) {
    this.boundary = boundary;
  }

  @XmlRootElement
  @XmlAccessorType(XmlAccessType.NONE)
  public static class BoundaryDefinitions {
    @XmlElement(name = "Properties", namespace = "http://docs.oasis-open.org/tosca/ns/2011/12")
    private BoundaryProperties properties;

    public BoundaryProperties getProperties() {
      return properties;
    }

    public void setProperties(BoundaryProperties properties) {
      this.properties = properties;
    }

  }

  @XmlRootElement
  @XmlAccessorType(XmlAccessType.NONE)
  public static class BoundaryProperties {
    @XmlElement(name = "Properties")
    private BoundaryProperty property;

    public BoundaryProperty getProperty() {
      return property;
    }

    public void setProperty(BoundaryProperty property) {
      this.property = property;
    }
  }

  @XmlRootElement
  @XmlAccessorType(XmlAccessType.NONE)
  public static class BoundaryProperty {
    public String getTemplateVersion() {
      return templateVersion;
    }

    public void setTemplateVersion(String templateVersion) {
      this.templateVersion = templateVersion;
    }

    public String getTemplateAuthor() {
      return templateAuthor;
    }

    public void setTemplateAuthor(String templateAuthor) {
      this.templateAuthor = templateAuthor;
    }

    public String getVendor() {
      return vendor;
    }

    public void setVendor(String vendor) {
      this.vendor = vendor;
    }

    public String getVersion() {
      return version;
    }

    public void setVersion(String version) {
      this.version = version;
    }

    public String getNfvType() {
      return nfvType;
    }

    public void setNfvType(String nfvType) {
      this.nfvType = nfvType;
    }

    public String getMoc() {
      return moc;
    }

    public void setMoc(String moc) {
      this.moc = moc;
    }

    public String getFlavor() {
      return flavor;
    }

    public void setFlavor(String flavor) {
      this.flavor = flavor;
    }

    public List<StFlavor> getStFlavor() {
      return stFlavor;
    }

    public void setStFlavor(List<StFlavor> stFlavor) {
      this.stFlavor = stFlavor;
    }

    @XmlElement
    private String templateVersion;

    @XmlElement
    private String templateAuthor;

    @XmlElement
    private String vendor;

    @XmlElement
    private String version;

    @XmlElement
    private String nfvType;

    @XmlElement
    private String moc;

    @XmlElement
    private String flavor;

    @XmlElementWrapper(name = "flavorList")
    @XmlElement(name = "flavor")
    private List<StFlavor> stFlavor;
  }

  @XmlRootElement
  @XmlAccessorType(XmlAccessType.NONE)
  public static class StFlavor {
    @XmlAttribute
    private String name;

    @XmlAttribute
    private String desc;

    @XmlElementWrapper(name = "nodeList")
    @XmlElement(name = "node")
    private List<StFlavorConstituent> stFlavorConstituent;

    public String getName() {
      return name;
    }

    public void setName(String name) {
      this.name = name;
    }

    public String getDesc() {
      return desc;
    }

    public void setDesc(String desc) {
      this.desc = desc;
    }

    public List<StFlavorConstituent> getStFlavorConstituent() {
      return stFlavorConstituent;
    }

    public void setStFlavorConstituent(List<StFlavorConstituent> stFlavorConstituent) {
      this.stFlavorConstituent = stFlavorConstituent;
    }
  }

  @XmlRootElement
  @XmlAccessorType(XmlAccessType.NONE)
  public static class StFlavorConstituent {
    @XmlAttribute
    private String numberOfInstances;

    @XmlAttribute
    private String name;

    @XmlAttribute
    private String refNodeFlavor;

    @XmlAttribute
    private String affinity;

    @XmlAttribute
    private String redundancyModel;

    @XmlAttribute
    private String capability;

    public String getAffinity() {
      return affinity;
    }

    public void setAffinity(String affinity) {
      this.affinity = affinity;
    }

    public String getRedundancyModel() {
      return redundancyModel;
    }

    public void setRedundancyModel(String redundancyModel) {
      this.redundancyModel = redundancyModel;
    }

    public String getCapability() {
      return capability;
    }

    public void setCapability(String capability) {
      this.capability = capability;
    }

    public String getNumberOfInstances() {
      return numberOfInstances;
    }

    public void setNumberOfInstances(String numberOfInstances) {
      this.numberOfInstances = numberOfInstances;
    }

    public String getName() {
      return name;
    }

    public void setName(String name) {
      this.name = name;
    }

    public String getRefNodeFlavor() {
      return refNodeFlavor;
    }

    public void setRefNodeFlavor(String refNodeFlavor) {
      this.refNodeFlavor = refNodeFlavor;
    }
  }

  private Boolean propNullFlag;

  private boolean isPropNotNull() {
    if (null == propNullFlag) {
      propNullFlag =
          null != this.getBoundary() && null != this.getBoundary().getProperties()
              && null != this.getBoundary().getProperties().getProperty();
    }
    return propNullFlag;
  }

  public String getProductType() {
    return isPropNotNull() ? this.getBoundary().getProperties().getProperty().getMoc() : null;
  }

  public String getVendor() {
    return isPropNotNull() ? this.getBoundary().getProperties().getProperty().getVendor() : null;
  }

  public String getVersion() {
    return isPropNotNull() ? this.getBoundary().getProperties().getProperty().getVersion() : null;
  }

  public String getNfvtype() {
    return isPropNotNull() ? this.getBoundary().getProperties().getProperty().getNfvType() : null;
  }

  public String getFlavor() {
    return isPropNotNull() ? this.getBoundary().getProperties().getProperty().getFlavor() : null;
  }

  public List<StFlavor> getStFlavorList() {
    return isPropNotNull() ? this.getBoundary().getProperties().getProperty().getStFlavor() : null;
  }
}