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 java.io.Serializable;
21 import org.apache.commons.lang3.StringUtils;
22 import org.openo.nfvo.resmanagement.common.util.JsonUtil;
24 import net.sf.json.JSONObject;
30 public class VnfStatusEntity implements Serializable {
33 private String vnfInstanceId;
42 private String vnfmId;
45 private String responseDescriptor;
48 private String status;
51 private String progress;
54 private String statusDescription;
57 private String errorCode;
60 private String responseId;
63 private String responseHistoryList;
71 private static final long serialVersionUID = 1L;
73 public String getVnfInstanceId() {
77 public void setVnfInstanceId(String vnfInstanceId) {
78 this.vnfInstanceId = vnfInstanceId;
81 public String getJobId() {
85 public void setJobId(String jobId) {
89 public String getNsId() {
93 public void setNsId(String nsId) {
97 public String getVnfmId() {
101 public void setVnfmId(String vnfmId) {
102 this.vnfmId = vnfmId;
105 public String getResponseDescriptor() {
106 return responseDescriptor;
109 public void setResponseDescriptor(String responseDescriptor) {
110 this.responseDescriptor = responseDescriptor;
113 public String getStatus() {
117 public void setStatus(String status) {
118 this.status = status;
121 public String getProgress() {
125 public void setProgress(String progress) {
126 this.progress = progress;
129 public String getStatusDescription() {
130 return statusDescription;
133 public void setStatusDescription(String statusDescription) {
134 this.statusDescription = statusDescription;
137 public String getErrorCode() {
141 public void setErrorCode(String errorCode) {
142 this.errorCode = errorCode;
145 public String getResponseId() {
149 public void setResponseId(String responseId) {
150 this.responseId = responseId;
153 public String getResponseHistoryList() {
154 return responseHistoryList;
157 public void setResponseHistoryList(String responseHistoryList) {
158 this.responseHistoryList = responseHistoryList;
161 public String getAddVm() {
165 public void setAddVm(String addVm) {
169 public String getDelVm() {
173 public void setDelVm(String delVm) {
177 public static VnfStatusEntity toEntity(JSONObject jsonObject) {
178 VnfStatusEntity vnfStatusEntity = new VnfStatusEntity();
179 vnfStatusEntity.setVnfInstanceId(JsonUtil.getJsonFieldStr(jsonObject, "vnfInstanceId"));
180 vnfStatusEntity.setJobId(JsonUtil.getJsonFieldStr(jsonObject, "jobId"));
181 vnfStatusEntity.setNsId(JsonUtil.getJsonFieldStr(jsonObject, "nsId"));
182 vnfStatusEntity.setVnfmId(JsonUtil.getJsonFieldStr(jsonObject, "vnfmId"));
183 vnfStatusEntity.setResponseDescriptor(JsonUtil.getJsonFieldStr(jsonObject, "responseDescriptor"));
184 vnfStatusEntity.setStatus(JsonUtil.getJsonFieldStr(jsonObject, "status"));
185 vnfStatusEntity.setProgress(JsonUtil.getJsonFieldStr(jsonObject, "progress"));
186 vnfStatusEntity.setStatusDescription(JsonUtil.getJsonFieldStr(jsonObject, "statusDescription"));
187 vnfStatusEntity.setErrorCode(JsonUtil.getJsonFieldStr(jsonObject, "errorCode"));
188 vnfStatusEntity.setResponseId(JsonUtil.getJsonFieldStr(jsonObject, "responseId"));
189 vnfStatusEntity.setResponseHistoryList(JsonUtil.getJsonFieldStr(jsonObject, "responseHistoryList"));
190 vnfStatusEntity.setAddVm(JsonUtil.getJsonFieldStr(jsonObject, "addVm"));
191 vnfStatusEntity.setDelVm(JsonUtil.getJsonFieldStr(jsonObject, "delVm"));
192 return vnfStatusEntity;
196 public String toString() {
197 JSONObject vnfStatusResJson = new JSONObject();
198 vnfStatusResJson.put("vnfInstanceId", StringUtils.trimToEmpty(this.getVnfInstanceId()));
199 vnfStatusResJson.put("jobId", StringUtils.trimToEmpty(this.getJobId()));
200 vnfStatusResJson.put("nsId", StringUtils.trimToEmpty(this.getNsId()));
201 vnfStatusResJson.put("vnfmId", StringUtils.trimToEmpty(this.getVnfmId()));
202 vnfStatusResJson.put("responseDescriptor", StringUtils.trimToEmpty(this.getResponseDescriptor()));
203 vnfStatusResJson.put("status", StringUtils.trimToEmpty(this.getStatus()));
204 vnfStatusResJson.put("progress", StringUtils.trimToEmpty(this.getProgress()));
205 vnfStatusResJson.put("statusDescription", StringUtils.trimToEmpty(this.getStatusDescription()));
206 vnfStatusResJson.put("errorCode", StringUtils.trimToEmpty(this.getErrorCode()));
207 vnfStatusResJson.put("responseId", StringUtils.trimToEmpty(this.getResponseId()));
208 vnfStatusResJson.put("responseHistoryList", StringUtils.trimToEmpty(this.getResponseHistoryList()));
209 vnfStatusResJson.put("addVm", StringUtils.trimToEmpty(this.getAddVm()));
210 vnfStatusResJson.put("delVm", StringUtils.trimToEmpty(this.getDelVm()));
211 return vnfStatusResJson.toString();