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;
27 import java.util.Date;
29 import org.apache.commons.lang3.builder.EqualsBuilder;
30 import org.apache.commons.lang3.builder.ToStringBuilder;
31 import org.apache.commons.lang3.builder.ToStringStyle;
33 import javax.persistence.Column;
34 import javax.persistence.Entity;
35 import javax.persistence.EnumType;
36 import javax.persistence.Enumerated;
37 import javax.persistence.Id;
38 import javax.persistence.PrePersist;
39 import javax.persistence.Table;
40 import javax.persistence.Temporal;
41 import javax.persistence.TemporalType;
44 * EntityBean class for a CloudIdentity. This bean represents a cloud identity
45 * service instance (i.e. a DCP node) in the NVP/AIC cloud. It will be loaded via
46 * CloudConfig object, of which it is a component.
50 @Table(name = "identity_services")
51 public class CloudIdentity {
59 @JsonProperty("identity_url")
61 @Column(name = "IDENTITY_URL")
62 private String identityUrl;
64 @JsonProperty("mso_id")
66 @Column(name = "MSO_ID")
69 @JsonProperty("mso_pass")
71 @Column(name = "MSO_PASS")
72 private String msoPass;
74 @JsonProperty("project_domain_name")
76 @Column(name = "PROJECT_DOMAIN_NAME")
77 private String projectDomainName;
79 @JsonProperty("user_domain_name")
81 @Column(name = "USER_DOMAIN_NAME")
82 private String userDomainName;
84 @JsonProperty("admin_tenant")
86 @Column(name = "ADMIN_TENANT")
87 private String adminTenant;
89 @JsonProperty("member_role")
91 @Column(name = "MEMBER_ROLE")
92 private String memberRole;
94 @JsonProperty("tenant_metadata")
96 @Column(name = "TENANT_METADATA")
97 private Boolean tenantMetadata;
99 @JsonProperty("identity_server_type")
101 @Enumerated(EnumType.STRING)
102 @Column(name = "IDENTITY_SERVER_TYPE")
103 private ServerType identityServerType;
105 @JsonProperty("identity_authentication_type")
107 @Enumerated(EnumType.STRING)
108 @Column(name = "IDENTITY_AUTHENTICATION_TYPE")
109 private AuthenticationType identityAuthenticationType;
111 @JsonProperty("last_updated_by")
113 @Column(name = "LAST_UPDATED_BY")
114 private String lastUpdatedBy ;
116 @JsonProperty("creation_timestamp")
118 @Column(name = "CREATION_TIMESTAMP", updatable = false)
119 @Temporal(TemporalType.TIMESTAMP)
120 private Date created;
122 @JsonProperty("update_timestamp")
124 @Column(name = "UPDATE_TIMESTAMP")
125 @Temporal(TemporalType.TIMESTAMP)
126 private Date updated;
128 public CloudIdentity() {}
131 protected void onCreate() {
132 this.created = new Date();
133 this.updated = new Date();
136 public String getId () {
140 public void setId (String id) {
144 public String getIdentityUrl() {
145 return this.identityUrl;
147 public void setIdentityUrl(String url) {
148 this.identityUrl = url;
151 public String getMsoId () {
155 public void setMsoId (String id) {
159 public String getMsoPass () {
163 public void setMsoPass (String pwd) {
167 public String getAdminTenant () {
171 public String getLastUpdatedBy() {
172 return lastUpdatedBy;
175 public Date getCreated() {
179 public Date getUpdated() {
183 public void setLastUpdatedBy(String lastUpdatedBy) {
184 this.lastUpdatedBy = lastUpdatedBy;
187 public void setCreated(Date created) {
188 this.created = created;
191 public void setUpdated(Date updated) {
192 this.updated = updated;
195 public void setAdminTenant (String tenant) {
196 this.adminTenant = tenant;
199 public String getMemberRole () {
203 public void setMemberRole (String role) {
204 this.memberRole = role;
207 public Boolean getTenantMetadata() {
208 return tenantMetadata;
211 public void setTenantMetadata (Boolean meta) {
212 this.tenantMetadata = meta;
215 public ServerType getIdentityServerType() {
216 return this.identityServerType;
218 public void setIdentityServerType(ServerType ist) {
219 this.identityServerType = ist;
221 public String getIdentityServerTypeAsString() {
222 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;
254 public CloudIdentity clone() {
255 CloudIdentity cloudIdentityCopy = new CloudIdentity();
257 cloudIdentityCopy.id = this.id;
258 cloudIdentityCopy.identityUrl = this.identityUrl;
259 cloudIdentityCopy.msoId = this.msoId;
260 cloudIdentityCopy.msoPass = this.msoPass;
261 cloudIdentityCopy.adminTenant = this.adminTenant;
262 cloudIdentityCopy.memberRole = this.memberRole;
263 cloudIdentityCopy.tenantMetadata = this.tenantMetadata;
264 cloudIdentityCopy.identityServerType = this.identityServerType;
265 cloudIdentityCopy.identityAuthenticationType = this.identityAuthenticationType;
266 cloudIdentityCopy.projectDomainName = this.projectDomainName;
267 cloudIdentityCopy.userDomainName = this.userDomainName;
269 return cloudIdentityCopy;
273 public String toString() {
274 return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).append("id", getId())
275 .append("identityUrl", getIdentityUrl()).append("msoId", getMsoId())
276 .append("projectDomain", getProjectDomainName()).append("userDomain", getUserDomainName())
277 .append("adminTenant", getAdminTenant()).append("memberRole", getMemberRole())
278 .append("tenantMetadata", getTenantMetadata()).append("identityServerType", getIdentityServerType())
279 .append("identityAuthenticationType", getIdentityAuthenticationType()).toString();
283 public boolean equals(final Object other) {
287 if (!getClass().equals(other.getClass())) {
290 CloudIdentity castOther = (CloudIdentity) other;
291 return new EqualsBuilder().append(getId(), castOther.getId())
292 .append(getIdentityUrl(), castOther.getIdentityUrl()).append(getMsoId(), castOther.getMsoId())
293 .append(getMsoPass(), castOther.getMsoPass()).append(getAdminTenant(), castOther.getAdminTenant())
294 .append(getProjectDomainName(), castOther.getProjectDomainName()).append(getUserDomainName(), castOther.getUserDomainName())
295 .append(getMemberRole(), castOther.getMemberRole())
296 .append(getTenantMetadata(), castOther.getTenantMetadata())
297 .append(getIdentityServerType(), castOther.getIdentityServerType())
298 .append(getIdentityAuthenticationType(), castOther.getIdentityAuthenticationType()).isEquals();
302 public int hashCode() {
303 return new HashCodeBuilder(1, 31).append(getId()).append(getIdentityUrl()).append(getMsoId())
304 .append(getMsoPass()).append(getProjectDomainName()).append(getUserDomainName()).append(getAdminTenant()).append(getMemberRole()).append(getTenantMetadata())
305 .append(getIdentityServerType()).append(getIdentityAuthenticationType()).toHashCode();