2 * Copyright 2016 Huawei Technologies Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 package org.openo.nfvo.resmanagement.service.entity;
19 import org.apache.commons.lang3.StringUtils;
20 import org.openo.nfvo.resmanagement.common.util.JsonUtil;
22 import net.sf.json.JSONObject;
26 * Location entity class.<br>
31 * @version NFVO 0.5 Sep 10, 2016
33 public class LocationEntity {
36 * This field was generated by MyBatis Generator. This field corresponds to
37 * the database column location.ID
44 * This field was generated by MyBatis Generator. This field corresponds to
45 * the database column location.COUNTRY
49 private String country;
52 * This field was generated by MyBatis Generator. This field corresponds to
53 * the database column location.LOCATION
57 private String location;
60 * This field was generated by MyBatis Generator. This field corresponds to
61 * the database column location.LATITUDE
65 private String latitude;
68 * This field was generated by MyBatis Generator. This field corresponds to
69 * the database column location.LONGITUDE
73 private String longitude;
75 private String description;
78 * This method was generated by MyBatis Generator. This method returns the
79 * value of the database column location.ID
81 * @return the value of location.ID
84 public String getId() {
89 * This method was generated by MyBatis Generator. This method sets the
90 * value of the database column location.ID
93 * the value for location.ID
96 public void setId(String id) {
97 this.id = id == null ? null : id.trim();
101 * This method was generated by MyBatis Generator. This method returns the
102 * value of the database column location.COUNTRY
104 * @return the value of location.COUNTRY
107 public String getCountry() {
112 * This method was generated by MyBatis Generator. This method sets the
113 * value of the database column location.COUNTRY
116 * the value for location.COUNTRY
119 public void setCountry(String country) {
120 this.country = country == null ? null : country.trim();
124 * This method was generated by MyBatis Generator. This method returns the
125 * value of the database column location.LOCATION
127 * @return the value of location.LOCATION
130 public String getLocation() {
135 * This method was generated by MyBatis Generator. This method sets the
136 * value of the database column location.LOCATION
139 * the value for location.LOCATION
142 public void setLocation(String location) {
143 this.location = location == null ? null : location.trim();
147 * This method was generated by MyBatis Generator. This method returns the
148 * value of the database column location.LATITUDE
150 * @return the value of location.LATITUDE
153 public String getLatitude() {
158 * This method was generated by MyBatis Generator. This method sets the
159 * value of the database column location.LATITUDE
162 * the value for location.LATITUDE
165 public void setLatitude(String latitude) {
166 this.latitude = latitude == null ? null : latitude.trim();
170 * This method was generated by MyBatis Generator. This method returns the
171 * value of the database column location.LONGITUDE
173 * @return the value of location.LONGITUDE
176 public String getLongitude() {
181 * This method was generated by MyBatis Generator. This method sets the
182 * value of the database column location.LONGITUDE
185 * the value for location.LONGITUDE
188 public void setLongitude(String longitude) {
189 this.longitude = longitude == null ? null : longitude.trim();
193 * @return Returns the description.
195 public String getDescription() {
200 * @param description The description to set.
202 public void setDescription(String description) {
203 this.description = description == null ? null : description.trim();
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;
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();