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.db.catalog.beans;
23 import com.fasterxml.jackson.annotation.JsonProperty;
24 import com.openpojo.business.annotation.BusinessKey;
25 import org.apache.commons.lang3.builder.HashCodeBuilder;
26 import java.util.Date;
27 import org.apache.commons.lang3.builder.EqualsBuilder;
28 import org.apache.commons.lang3.builder.ToStringBuilder;
29 import org.apache.commons.lang3.builder.ToStringStyle;
30 import javax.persistence.Column;
31 import javax.persistence.Entity;
32 import javax.persistence.EnumType;
33 import javax.persistence.Enumerated;
34 import javax.persistence.Id;
35 import javax.persistence.PrePersist;
36 import javax.persistence.Table;
37 import javax.persistence.Temporal;
38 import javax.persistence.TemporalType;
41 * EntityBean class for a CloudIdentity. This bean represents a cloud identity service instance (i.e. a DCP node) in the
42 * NVP/AIC cloud. It will be loaded via CloudConfig object, of which it is a component.
46 @Table(name = "identity_services")
47 public class CloudIdentity {
55 @JsonProperty("identity_url")
57 @Column(name = "IDENTITY_URL")
58 private String identityUrl;
60 @JsonProperty("mso_id")
62 @Column(name = "MSO_ID")
65 @JsonProperty("mso_pass")
67 @Column(name = "MSO_PASS")
68 private String msoPass;
70 @JsonProperty("project_domain_name")
72 @Column(name = "PROJECT_DOMAIN_NAME")
73 private String projectDomainName;
75 @JsonProperty("user_domain_name")
77 @Column(name = "USER_DOMAIN_NAME")
78 private String userDomainName;
80 @JsonProperty("admin_tenant")
82 @Column(name = "ADMIN_TENANT")
83 private String adminTenant;
85 @JsonProperty("member_role")
87 @Column(name = "MEMBER_ROLE")
88 private String memberRole;
90 @JsonProperty("tenant_metadata")
92 @Column(name = "TENANT_METADATA")
93 private Boolean tenantMetadata;
95 @JsonProperty("identity_server_type")
97 @Enumerated(EnumType.STRING)
98 @Column(name = "IDENTITY_SERVER_TYPE")
99 private ServerType identityServerType;
101 @JsonProperty("identity_authentication_type")
103 @Enumerated(EnumType.STRING)
104 @Column(name = "IDENTITY_AUTHENTICATION_TYPE")
105 private AuthenticationType identityAuthenticationType;
107 @JsonProperty("last_updated_by")
109 @Column(name = "LAST_UPDATED_BY")
110 private String lastUpdatedBy;
112 @JsonProperty("creation_timestamp")
114 @Column(name = "CREATION_TIMESTAMP", updatable = false)
115 @Temporal(TemporalType.TIMESTAMP)
116 private Date created;
118 @JsonProperty("update_timestamp")
120 @Column(name = "UPDATE_TIMESTAMP")
121 @Temporal(TemporalType.TIMESTAMP)
122 private Date updated;
124 public CloudIdentity() {}
127 protected void onCreate() {
128 this.created = new Date();
129 this.updated = new Date();
132 public String getId() {
136 public void setId(String id) {
140 public String getIdentityUrl() {
141 return this.identityUrl;
144 public void setIdentityUrl(String url) {
145 this.identityUrl = url;
148 public String getMsoId() {
152 public void setMsoId(String id) {
156 public String getMsoPass() {
160 public void setMsoPass(String pwd) {
164 public String getAdminTenant() {
168 public String getLastUpdatedBy() {
169 return lastUpdatedBy;
172 public Date getCreated() {
176 public Date getUpdated() {
180 public void setLastUpdatedBy(String lastUpdatedBy) {
181 this.lastUpdatedBy = lastUpdatedBy;
184 public void setCreated(Date created) {
185 this.created = created;
188 public void setUpdated(Date updated) {
189 this.updated = updated;
192 public void setAdminTenant(String tenant) {
193 this.adminTenant = tenant;
196 public String getMemberRole() {
200 public void setMemberRole(String role) {
201 this.memberRole = role;
204 public Boolean getTenantMetadata() {
205 return tenantMetadata;
208 public void setTenantMetadata(Boolean meta) {
209 this.tenantMetadata = meta;
212 public ServerType getIdentityServerType() {
213 return this.identityServerType;
216 public void setIdentityServerType(ServerType ist) {
217 this.identityServerType = ist;
220 public String getIdentityServerTypeAsString() {
221 return this.identityServerType.toString();
225 * @return the identityAuthenticationType
227 public AuthenticationType getIdentityAuthenticationType() {
228 return identityAuthenticationType;
232 * @param identityAuthenticationType the identityAuthenticationType to set
234 public void setIdentityAuthenticationType(AuthenticationType identityAuthenticationType) {
235 this.identityAuthenticationType = identityAuthenticationType;
238 public String getProjectDomainName() {
239 return projectDomainName;
242 public void setProjectDomainName(String projectDomainName) {
243 this.projectDomainName = projectDomainName;
246 public String getUserDomainName() {
247 return userDomainName;
250 public void setUserDomainName(String userDomainName) {
251 this.userDomainName = userDomainName;
255 public CloudIdentity clone() {
256 CloudIdentity cloudIdentityCopy = new CloudIdentity();
258 cloudIdentityCopy.id = this.id;
259 cloudIdentityCopy.identityUrl = this.identityUrl;
260 cloudIdentityCopy.msoId = this.msoId;
261 cloudIdentityCopy.msoPass = this.msoPass;
262 cloudIdentityCopy.adminTenant = this.adminTenant;
263 cloudIdentityCopy.memberRole = this.memberRole;
264 cloudIdentityCopy.tenantMetadata = this.tenantMetadata;
265 cloudIdentityCopy.identityServerType = this.identityServerType;
266 cloudIdentityCopy.identityAuthenticationType = this.identityAuthenticationType;
267 cloudIdentityCopy.projectDomainName = this.projectDomainName;
268 cloudIdentityCopy.userDomainName = this.userDomainName;
270 return cloudIdentityCopy;
274 public String toString() {
275 return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).append("id", getId())
276 .append("identityUrl", getIdentityUrl()).append("msoId", getMsoId())
277 .append("projectDomain", getProjectDomainName()).append("userDomain", getUserDomainName())
278 .append("adminTenant", getAdminTenant()).append("memberRole", getMemberRole())
279 .append("tenantMetadata", getTenantMetadata()).append("identityServerType", getIdentityServerType())
280 .append("identityAuthenticationType", getIdentityAuthenticationType()).toString();
284 public boolean equals(final Object other) {
288 if (!getClass().equals(other.getClass())) {
291 CloudIdentity castOther = (CloudIdentity) other;
292 return new EqualsBuilder().append(getId(), castOther.getId())
293 .append(getIdentityUrl(), castOther.getIdentityUrl()).append(getMsoId(), castOther.getMsoId())
294 .append(getMsoPass(), castOther.getMsoPass()).append(getAdminTenant(), castOther.getAdminTenant())
295 .append(getProjectDomainName(), castOther.getProjectDomainName())
296 .append(getUserDomainName(), castOther.getUserDomainName())
297 .append(getMemberRole(), castOther.getMemberRole())
298 .append(getTenantMetadata(), castOther.getTenantMetadata())
299 .append(getIdentityServerType(), castOther.getIdentityServerType())
300 .append(getIdentityAuthenticationType(), castOther.getIdentityAuthenticationType()).isEquals();
304 public int hashCode() {
305 return new HashCodeBuilder(1, 31).append(getId()).append(getIdentityUrl()).append(getMsoId())
306 .append(getMsoPass()).append(getProjectDomainName()).append(getUserDomainName())
307 .append(getAdminTenant()).append(getMemberRole()).append(getTenantMetadata())
308 .append(getIdentityServerType()).append(getIdentityAuthenticationType()).toHashCode();