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.onap.so.cloud;
23 import com.fasterxml.jackson.annotation.JsonProperty;
24 import com.openpojo.business.annotation.BusinessKey;
25 import org.apache.commons.lang3.builder.HashCodeBuilder;
27 import java.util.Comparator;
29 import org.apache.commons.lang3.builder.EqualsBuilder;
30 import org.apache.commons.lang3.builder.ToStringBuilder;
31 import org.apache.commons.lang3.builder.ToStringStyle;
34 * JavaBean JSON class for a CloudIdentity. This bean represents a cloud identity
35 * service instance (i.e. a DCP node) in the NVP/AIC cloud. It will be loaded via
36 * CloudConfig object, of which it is a component (a CloudConfig JSON configuration
37 * file may contain multiple CloudIdentity definitions).
39 * Note that this is only used to access Cloud Configurations loaded from a
40 * JSON config file, so there are no explicit setters.
43 public class CloudIdentity {
48 @JsonProperty("identity_url")
50 private String identityUrl;
51 @JsonProperty("mso_id")
54 @JsonProperty("mso_pass")
56 private String msoPass;
57 @JsonProperty("admin_tenant")
59 private String adminTenant;
60 @JsonProperty("member_role")
62 private String memberRole;
63 @JsonProperty("tenant_metadata")
65 private Boolean tenantMetadata;
66 @JsonProperty("identity_server_type")
68 private ServerType identityServerType;
69 @JsonProperty("identity_authentication_type")
71 private AuthenticationType identityAuthenticationType;
73 public CloudIdentity() {}
75 public String getId () {
79 public void setId (String id) {
83 public String getIdentityUrl() {
84 return this.identityUrl;
86 public void setIdentityUrl(String url) {
87 this.identityUrl = url;
90 public String getMsoId () {
94 public void setMsoId (String id) {
98 public String getMsoPass () {
102 public void setMsoPass (String pwd) {
106 public String getAdminTenant () {
110 public void setAdminTenant (String tenant) {
111 this.adminTenant = tenant;
114 public String getMemberRole () {
118 public void setMemberRole (String role) {
119 this.memberRole = role;
122 public Boolean hasTenantMetadata () {
123 return tenantMetadata;
126 public void setTenantMetadata (Boolean meta) {
127 this.tenantMetadata = meta;
130 public ServerType getIdentityServerType() {
131 return this.identityServerType;
133 public void setIdentityServerType(ServerType ist) {
134 this.identityServerType = ist;
136 public String getIdentityServerTypeAsString() {
137 return this.identityServerType.toString();
140 * @return the identityAuthenticationType
142 public AuthenticationType getIdentityAuthenticationType() {
143 return identityAuthenticationType;
147 * @param identityAuthenticationType the identityAuthenticationType to set
149 public void setIdentityAuthenticationType(AuthenticationType identityAuthenticationType) {
150 this.identityAuthenticationType = identityAuthenticationType;
154 public CloudIdentity clone() {
155 CloudIdentity cloudIdentityCopy = new CloudIdentity();
157 cloudIdentityCopy.id = this.id;
158 cloudIdentityCopy.identityUrl = this.identityUrl;
159 cloudIdentityCopy.msoId = this.msoId;
160 cloudIdentityCopy.msoPass = this.msoPass;
161 cloudIdentityCopy.adminTenant = this.adminTenant;
162 cloudIdentityCopy.memberRole = this.memberRole;
163 cloudIdentityCopy.tenantMetadata = this.tenantMetadata;
164 cloudIdentityCopy.identityServerType = this.identityServerType;
165 cloudIdentityCopy.identityAuthenticationType = this.identityAuthenticationType;
167 return cloudIdentityCopy;
171 public String toString() {
172 return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).append("id", getId())
173 .append("identityUrl", getIdentityUrl()).append("msoId", getMsoId())
174 .append("adminTenant", getAdminTenant()).append("memberRole", getMemberRole())
175 .append("tenantMetadata", hasTenantMetadata()).append("identityServerType", getIdentityServerType())
176 .append("identityAuthenticationType", getIdentityAuthenticationType()).toString();
180 public boolean equals(final Object other) {
184 if (!getClass().equals(other.getClass())) {
187 CloudIdentity castOther = (CloudIdentity) other;
188 return new EqualsBuilder().append(getId(), castOther.getId())
189 .append(getIdentityUrl(), castOther.getIdentityUrl()).append(getMsoId(), castOther.getMsoId())
190 .append(getMsoPass(), castOther.getMsoPass()).append(getAdminTenant(), castOther.getAdminTenant())
191 .append(getMemberRole(), castOther.getMemberRole())
192 .append(hasTenantMetadata(), castOther.hasTenantMetadata())
193 .append(getIdentityServerType(), castOther.getIdentityServerType())
194 .append(getIdentityAuthenticationType(), castOther.getIdentityAuthenticationType()).isEquals();
198 public int hashCode() {
199 return new HashCodeBuilder(1, 31).append(getId()).append(getIdentityUrl()).append(getMsoId())
200 .append(getMsoPass()).append(getAdminTenant()).append(getMemberRole()).append(hasTenantMetadata())
201 .append(getIdentityServerType()).append(getIdentityAuthenticationType()).toHashCode();