c9a38d9ee2a6cacde41de52b747b19d9171da548
[vfc/nfvo/resmanagement.git] /
1 /*
2  * Copyright 2016 Huawei Technologies Co., Ltd.
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.nfvo.resmanagement.service.entity;
18
19 import java.io.Serializable;
20
21 import org.apache.commons.lang3.StringUtils;
22 import org.openo.nfvo.resmanagement.common.util.JsonUtil;
23
24 import net.sf.json.JSONObject;
25
26 /**
27  * @author l00345485
28  * @date 2016-10-27
29  */
30 public class VirtualLinkEntity implements Serializable {
31
32     /**  */
33     private String id;
34
35     /**  */
36     private String name;
37
38     /**  */
39     private String backendId;
40
41     /**  */
42     private String isPublic;
43
44     /**  */
45     private String dcName;
46
47     /**  */
48     private String vimId;
49
50     /**  */
51     private String vimName;
52
53     /**  */
54     private String physicialNet;
55
56     /**  */
57     private String nsId;
58
59     /**  */
60     private String nsName;
61
62     /**  */
63     private String description;
64
65     /**  */
66     private String networkType;
67
68     /**  */
69     private String segmentation;
70
71     /**  */
72     private String mtu;
73
74     /**  */
75     private String vlanTransparent;
76
77     /**  */
78     private String routerExternal;
79
80     /**  */
81     private String resourceProviderType;
82
83     /**  */
84     private String resourceProviderId;
85
86     private static final long serialVersionUID = 1L;
87
88     public String getId() {
89         return id;
90     }
91
92     public void setId(String id) {
93         this.id = id;
94     }
95
96     public String getName() {
97         return name;
98     }
99
100     public void setName(String name) {
101         this.name = name;
102     }
103
104     public String getBackendId() {
105         return backendId;
106     }
107
108     public void setBackendId(String backendId) {
109         this.backendId = backendId;
110     }
111
112     public String getIsPublic() {
113         return isPublic;
114     }
115
116     public void setIsPublic(String isPublic) {
117         this.isPublic = isPublic;
118     }
119
120     public String getDcName() {
121         return dcName;
122     }
123
124     public void setDcName(String dcName) {
125         this.dcName = dcName;
126     }
127
128     public String getVimId() {
129         return vimId;
130     }
131
132     public void setVimId(String vimId) {
133         this.vimId = vimId;
134     }
135
136     public String getVimName() {
137         return vimName;
138     }
139
140     public void setVimName(String vimName) {
141         this.vimName = vimName;
142     }
143
144     public String getPhysicialNet() {
145         return physicialNet;
146     }
147
148     public void setPhysicialNet(String physicialNet) {
149         this.physicialNet = physicialNet;
150     }
151
152     public String getNsId() {
153         return nsId;
154     }
155
156     public void setNsId(String nsId) {
157         this.nsId = nsId;
158     }
159
160     public String getNsName() {
161         return nsName;
162     }
163
164     public void setNsName(String nsName) {
165         this.nsName = nsName;
166     }
167
168     public String getDescription() {
169         return description;
170     }
171
172     public void setDescription(String description) {
173         this.description = description;
174     }
175
176     public String getNetworkType() {
177         return networkType;
178     }
179
180     public void setNetworkType(String networkType) {
181         this.networkType = networkType;
182     }
183
184     public String getSegmentation() {
185         return segmentation;
186     }
187
188     public void setSegmentation(String segmentation) {
189         this.segmentation = segmentation;
190     }
191
192     public String getMtu() {
193         return mtu;
194     }
195
196     public void setMtu(String mtu) {
197         this.mtu = mtu;
198     }
199
200     public String getVlanTransparent() {
201         return vlanTransparent;
202     }
203
204     public void setVlanTransparent(String vlanTransparent) {
205         this.vlanTransparent = vlanTransparent;
206     }
207
208     public String getRouterExternal() {
209         return routerExternal;
210     }
211
212     public void setRouterExternal(String routerExternal) {
213         this.routerExternal = routerExternal;
214     }
215
216     public String getResourceProviderType() {
217         return resourceProviderType;
218     }
219
220     public void setResourceProviderType(String resourceProviderType) {
221         this.resourceProviderType = resourceProviderType;
222     }
223
224     public String getResourceProviderId() {
225         return resourceProviderId;
226     }
227
228     public void setResourceProviderId(String resourceProviderId) {
229         this.resourceProviderId = resourceProviderId;
230     }
231
232     /**
233      * <br>
234      * 
235      * @param jsonObject
236      * @return
237      * @since NFVO 0.5
238      */
239     public static VirtualLinkEntity toEntity(JSONObject jsonObject) {
240         VirtualLinkEntity virtualLinkEntity = new VirtualLinkEntity();
241         virtualLinkEntity.setId(JsonUtil.getJsonFieldStr(jsonObject, "vlInstanceId"));
242         virtualLinkEntity.setName(JsonUtil.getJsonFieldStr(jsonObject, "name"));
243         virtualLinkEntity.setBackendId(JsonUtil.getJsonFieldStr(jsonObject, "backendId"));
244         virtualLinkEntity.setIsPublic(JsonUtil.getJsonFieldStr(jsonObject, "isPublic"));
245         virtualLinkEntity.setDcName(JsonUtil.getJsonFieldStr(jsonObject, "dcName"));
246         virtualLinkEntity.setVimId(JsonUtil.getJsonFieldStr(jsonObject, "vimId"));
247         virtualLinkEntity.setVimName(JsonUtil.getJsonFieldStr(jsonObject, "vimName"));
248         virtualLinkEntity.setPhysicialNet(JsonUtil.getJsonFieldStr(jsonObject, "physicialNet"));
249         virtualLinkEntity.setNsId(JsonUtil.getJsonFieldStr(jsonObject, "nsId"));
250         virtualLinkEntity.setNsName(JsonUtil.getJsonFieldStr(jsonObject, "nsName"));
251         virtualLinkEntity.setDescription(JsonUtil.getJsonFieldStr(jsonObject, "description"));
252         virtualLinkEntity.setNetworkType(JsonUtil.getJsonFieldStr(jsonObject, "networkType"));
253         virtualLinkEntity.setSegmentation(JsonUtil.getJsonFieldStr(jsonObject, "segmentation"));
254         virtualLinkEntity.setMtu(JsonUtil.getJsonFieldStr(jsonObject, "mtu"));
255         virtualLinkEntity.setVlanTransparent(JsonUtil.getJsonFieldStr(jsonObject, "vlanTransparent"));
256         virtualLinkEntity.setRouterExternal(JsonUtil.getJsonFieldStr(jsonObject, "routerExternal"));
257         virtualLinkEntity.setResourceProviderId(JsonUtil.getJsonFieldStr(jsonObject, "resourceProviderId"));
258         virtualLinkEntity.setResourceProviderType(JsonUtil.getJsonFieldStr(jsonObject, "resourceProviderType"));
259         return virtualLinkEntity;
260     }
261
262     @Override
263     public String toString() {
264         JSONObject virtualLinkResJson = new JSONObject();
265         virtualLinkResJson.put("id", StringUtils.trimToEmpty(this.getId()));
266         virtualLinkResJson.put("name", StringUtils.trimToEmpty(this.getName()));
267         virtualLinkResJson.put("backendId", StringUtils.trimToEmpty(this.getBackendId()));
268         virtualLinkResJson.put("isPublic", StringUtils.trimToEmpty(this.getIsPublic()));
269         virtualLinkResJson.put("dcName", StringUtils.trimToEmpty(this.getDcName()));
270         virtualLinkResJson.put("vimId", StringUtils.trimToEmpty(this.getVimId()));
271         virtualLinkResJson.put("vimName", StringUtils.trimToEmpty(this.getVimName()));
272         virtualLinkResJson.put("physicialNet", StringUtils.trimToEmpty(this.getPhysicialNet()));
273         virtualLinkResJson.put("nsId", StringUtils.trimToEmpty(this.getNsId()));
274         virtualLinkResJson.put("nsName", StringUtils.trimToEmpty(this.getNsName()));
275         virtualLinkResJson.put("description", StringUtils.trimToEmpty(this.getDescription()));
276         virtualLinkResJson.put("networkType", StringUtils.trimToEmpty(this.getNetworkType()));
277         virtualLinkResJson.put("segmentation", StringUtils.trimToEmpty(this.getSegmentation()));
278         virtualLinkResJson.put("mtu", StringUtils.trimToEmpty(this.getMtu()));
279         virtualLinkResJson.put("vlanTransparent", StringUtils.trimToEmpty(this.getVlanTransparent()));
280         virtualLinkResJson.put("routerExternal", StringUtils.trimToEmpty(this.getRouterExternal()));
281         virtualLinkResJson.put("resourceProviderId", StringUtils.trimToEmpty(this.getResourceProviderId()));
282         virtualLinkResJson.put("resourceProviderType", StringUtils.trimToEmpty(this.getResourceProviderType()));
283         return virtualLinkResJson.toString();
284     }
285 }