2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.openecomp.mso.cloud;
24 import org.codehaus.jackson.annotate.JsonProperty;
27 * JavaBean JSON class for a CloudSite. This bean represents a cloud location
28 * (i.e. and LCP node) in the NVP/AIC cloud. It will be loaded via CloudConfig
29 * object, of which it is a component (a CloudConfig JSON configuration file
30 * will contain multiple CloudSite definitions).
32 * Note that this is only used to access Cloud Configurations loaded from a
33 * JSON config file, so there are no explicit setters.
36 public class CloudSite {
39 @JsonProperty("region_id")
40 private String regionId;
41 @JsonProperty("identity_service_id")
42 private String identityServiceId;
43 @JsonProperty("aic_version")
44 private String aic_version;
48 // Derived property (set by CloudConfig loader based on identityServiceId)
49 private CloudIdentity identityService;
53 public String getId() {
56 public void setId(String id) {
60 public String getRegionId() {
64 public void setRegionId(String regionId) {
65 this.regionId = regionId;
68 public String getIdentityServiceId() {
69 return identityServiceId;
72 public CloudIdentity getIdentityService () {
73 return identityService;
76 public void setIdentityService (CloudIdentity identity) {
77 this.identityService = identity;
80 public String getAic_version() {
84 public void setAic_version(String aic_version) {
85 this.aic_version = aic_version;
88 public String getClli() {
92 public void setClli(String clli) {
97 public String toString() {
98 return "CloudSite: id=" + id +
99 ", regionId=" + regionId +
100 ", identityServiceId=" + identityServiceId +
101 ", aic_version=" + aic_version +
106 public CloudSite clone() {
107 CloudSite cloudSiteCopy = new CloudSite();
108 cloudSiteCopy.id = this.id;
109 cloudSiteCopy.regionId = this.regionId;
110 cloudSiteCopy.identityServiceId = this.identityServiceId;
111 cloudSiteCopy.aic_version = this.aic_version;
112 cloudSiteCopy.clli = this.clli;
113 cloudSiteCopy.identityService = this.identityService.clone();
114 return cloudSiteCopy;
118 public int hashCode() {
119 final int prime = 31;
121 result = prime * result + ((id == null) ? 0 : id.hashCode());
122 result = prime * result + ((identityService == null) ? 0 : identityService.hashCode());
123 result = prime * result + ((identityServiceId == null) ? 0 : identityServiceId.hashCode());
124 result = prime * result + ((regionId == null) ? 0 : regionId.hashCode());
125 result = prime * result + ((aic_version == null) ? 0 : aic_version.hashCode());
126 result = prime * result + ((clli == null) ? 0 : clli.hashCode());
131 public boolean equals(Object obj) {
136 if (getClass() != obj.getClass())
138 CloudSite other = (CloudSite) obj;
139 if (!cmp(id, other.id))
141 if (!cmp(regionId, other.regionId))
143 if (!cmp(identityServiceId, other.identityServiceId))
145 if (!cmp(aic_version, other.aic_version))
147 if (!cmp(clli, other.clli))
149 if (!cmp(identityService, other.identityService))
153 private boolean cmp(Object a, Object b) {