eab8ca0fc2eafbf8fcdd59b4232bc6148cec5044
[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 org.apache.commons.lang3.StringUtils;
20 import org.openo.nfvo.resmanagement.common.util.JsonUtil;
21
22 import net.sf.json.JSONObject;
23
24 /**
25  *
26  * Location entity class.<br>
27  * <p>
28  * </p>
29  *
30  * @author
31  * @version     NFVO 0.5  Sep 10, 2016
32  */
33 public class LocationEntity {
34
35     /**
36      * This field was generated by MyBatis Generator. This field corresponds to
37      * the database column location.ID
38      *
39      * @mbggenerated
40      */
41     private String id;
42
43     /**
44      * This field was generated by MyBatis Generator. This field corresponds to
45      * the database column location.COUNTRY
46      *
47      * @mbggenerated
48      */
49     private String country;
50
51     /**
52      * This field was generated by MyBatis Generator. This field corresponds to
53      * the database column location.LOCATION
54      *
55      * @mbggenerated
56      */
57     private String location;
58
59     /**
60      * This field was generated by MyBatis Generator. This field corresponds to
61      * the database column location.LATITUDE
62      *
63      * @mbggenerated
64      */
65     private String latitude;
66
67     /**
68      * This field was generated by MyBatis Generator. This field corresponds to
69      * the database column location.LONGITUDE
70      *
71      * @mbggenerated
72      */
73     private String longitude;
74
75     private String description;
76
77     /**
78      * This method was generated by MyBatis Generator. This method returns the
79      * value of the database column location.ID
80      *
81      * @return the value of location.ID
82      * @mbggenerated
83      */
84     public String getId() {
85         return id;
86     }
87
88     /**
89      * This method was generated by MyBatis Generator. This method sets the
90      * value of the database column location.ID
91      *
92      * @param id
93      *            the value for location.ID
94      * @mbggenerated
95      */
96     public void setId(String id) {
97         this.id = id == null ? null : id.trim();
98     }
99
100     /**
101      * This method was generated by MyBatis Generator. This method returns the
102      * value of the database column location.COUNTRY
103      *
104      * @return the value of location.COUNTRY
105      * @mbggenerated
106      */
107     public String getCountry() {
108         return country;
109     }
110
111     /**
112      * This method was generated by MyBatis Generator. This method sets the
113      * value of the database column location.COUNTRY
114      *
115      * @param country
116      *            the value for location.COUNTRY
117      * @mbggenerated
118      */
119     public void setCountry(String country) {
120         this.country = country == null ? null : country.trim();
121     }
122
123     /**
124      * This method was generated by MyBatis Generator. This method returns the
125      * value of the database column location.LOCATION
126      *
127      * @return the value of location.LOCATION
128      * @mbggenerated
129      */
130     public String getLocation() {
131         return location;
132     }
133
134     /**
135      * This method was generated by MyBatis Generator. This method sets the
136      * value of the database column location.LOCATION
137      *
138      * @param location
139      *            the value for location.LOCATION
140      * @mbggenerated
141      */
142     public void setLocation(String location) {
143         this.location = location == null ? null : location.trim();
144     }
145
146     /**
147      * This method was generated by MyBatis Generator. This method returns the
148      * value of the database column location.LATITUDE
149      *
150      * @return the value of location.LATITUDE
151      * @mbggenerated
152      */
153     public String getLatitude() {
154         return latitude;
155     }
156
157     /**
158      * This method was generated by MyBatis Generator. This method sets the
159      * value of the database column location.LATITUDE
160      *
161      * @param latitude
162      *            the value for location.LATITUDE
163      * @mbggenerated
164      */
165     public void setLatitude(String latitude) {
166         this.latitude = latitude == null ? null : latitude.trim();
167     }
168
169     /**
170      * This method was generated by MyBatis Generator. This method returns the
171      * value of the database column location.LONGITUDE
172      *
173      * @return the value of location.LONGITUDE
174      * @mbggenerated
175      */
176     public String getLongitude() {
177         return longitude;
178     }
179
180     /**
181      * This method was generated by MyBatis Generator. This method sets the
182      * value of the database column location.LONGITUDE
183      *
184      * @param longitude
185      *            the value for location.LONGITUDE
186      * @mbggenerated
187      */
188     public void setLongitude(String longitude) {
189         this.longitude = longitude == null ? null : longitude.trim();
190     }
191
192     /**
193      * @return Returns the description.
194      */
195     public String getDescription() {
196         return description;
197     }
198
199     /**
200      * @param description The description to set.
201      */
202     public void setDescription(String description) {
203         this.description = description == null ? null : description.trim();
204     }
205
206     /**
207      *
208      * To Entity.<br>
209      *
210      * @param jsonObject
211      * @return
212      * @since  NFVO 0.5
213      */
214     public static LocationEntity toEntity(JSONObject jsonObject) {
215         LocationEntity sodoresesEntity = new LocationEntity();
216         sodoresesEntity.setId(JsonUtil.getJsonFieldStr(jsonObject, "id"));
217         sodoresesEntity.setCountry(JsonUtil.getJsonFieldStr(jsonObject, "country"));
218         sodoresesEntity.setLocation(JsonUtil.getJsonFieldStr(jsonObject, "location"));
219         sodoresesEntity.setLatitude(JsonUtil.getJsonFieldStr(jsonObject, "latitude"));
220         sodoresesEntity.setLongitude(JsonUtil.getJsonFieldStr(jsonObject, "longitude"));
221         sodoresesEntity.setDescription(JsonUtil.getJsonFieldStr(jsonObject, "description"));
222         return sodoresesEntity;
223     }
224
225     @Override
226     public String toString() {
227         JSONObject locationJson = new JSONObject();
228         locationJson.put("id", StringUtils.trimToEmpty(this.getId()));
229         locationJson.put("country", StringUtils.trimToEmpty(this.getCountry()));
230         locationJson.put("location", StringUtils.trimToEmpty(this.getLocation()));
231         locationJson.put("latitude", StringUtils.trimToEmpty(this.getLatitude()));
232         locationJson.put("longitude", StringUtils.trimToEmpty(this.getLongitude()));
233         locationJson.put("description", StringUtils.trimToEmpty(this.getDescription()));
234         return locationJson.toString();
235     }
236 }