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.jujuvnfmadapter.service.entity;
19 import java.text.SimpleDateFormat;
20 import java.util.Date;
22 import net.sf.json.JSONObject;
24 import org.apache.commons.lang3.StringUtils;
25 import org.apache.commons.lang3.builder.ToStringBuilder;
26 import org.apache.commons.lang3.builder.ToStringStyle;
27 import org.openo.nfvo.jujuvnfmadapter.common.CryptUtil;
28 import org.openo.nfvo.jujuvnfmadapter.service.constant.Constant;
32 * Juju vnfm Class.<br>
37 * @version NFVO 0.5 Sep 12, 2016
39 public class JujuVnfm {
47 private String version;
49 private String userName;
55 private String vendor;
57 private String extraInfo;
59 private String status;
61 private String createAt;
63 private String updateAt;
70 public String getId() {
79 public void setId(String id) {
88 public String getType() {
97 public void setType(String type) {
106 public String getName() {
115 public void setName(String name) {
124 public String getVersion() {
133 public void setVersion(String version) {
134 this.version = version;
142 public String getUserName() {
151 public void setUserName(String userName) {
152 this.userName = userName;
160 public String getUrl() {
169 public void setUrl(String url) {
178 public String getPwd() {
187 public void setPwd(String pwd) {
196 public String getVendor() {
205 public void setVendor(String vendor) {
206 this.vendor = vendor;
214 public String getExtraInfo() {
223 public void setExtraInfo(String extraInfo) {
224 this.extraInfo = extraInfo;
232 public String getStatus() {
241 public void setStatus(String status) {
242 this.status = status;
250 public String getCreateAt() {
259 public void setCreateAt(String createAt) {
260 this.createAt = createAt;
268 public String getUpdateAt() {
277 public void setUpdateAt(String updateAt) {
278 this.updateAt = updateAt;
287 public String toString() {
288 return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE);
297 public int hashCode() {
298 final int prime = 31;
300 result = prime * result + ((id == null) ? 0 : id.hashCode());
311 public boolean equals(Object obj) {
318 if(!(obj instanceof JujuVnfm)) {
321 if(getClass() != obj.getClass()) {
324 JujuVnfm other = (JujuVnfm)obj;
326 if(other.id != null) {
329 } else if(!id.equals(other.id)) {
342 public void updateVnfm(JSONObject otherVnfm) {
343 String vnfmName = otherVnfm.getString("name");
344 String vnfmUserName = otherVnfm.getString("userName");
345 String vnfmPwd = CryptUtil.enCrypt(otherVnfm.getString("pwd"));
347 if(!StringUtils.isEmpty(vnfmName)) {
348 this.name = vnfmName;
351 if(!StringUtils.isEmpty(vnfmUserName)) {
352 this.userName = vnfmUserName;
355 if(!StringUtils.isEmpty(vnfmPwd)) {
359 String vnfmExtraInfo = otherVnfm.get("extraInfo").toString();
360 if(!StringUtils.isEmpty(vnfmExtraInfo)) {
361 this.extraInfo = vnfmExtraInfo;
364 this.updateAt = new SimpleDateFormat(Constant.DATE_FORMAT).format(new Date());