Replaced all tabs with spaces in java and pom.xml
[so.git] / mso-catalog-db / src / main / java / org / onap / so / db / catalog / beans / CloudIdentity.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
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
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
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=========================================================
19  */
20
21 package org.onap.so.db.catalog.beans;
22
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;
39
40 /**
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.
43  *
44  */
45 @Entity
46 @Table(name = "identity_services")
47 public class CloudIdentity {
48
49     @JsonProperty
50     @BusinessKey
51     @Id
52     @Column(name = "ID")
53     private String id;
54
55     @JsonProperty("identity_url")
56     @BusinessKey
57     @Column(name = "IDENTITY_URL")
58     private String identityUrl;
59
60     @JsonProperty("mso_id")
61     @BusinessKey
62     @Column(name = "MSO_ID")
63     private String msoId;
64
65     @JsonProperty("mso_pass")
66     @BusinessKey
67     @Column(name = "MSO_PASS")
68     private String msoPass;
69
70     @JsonProperty("project_domain_name")
71     @BusinessKey
72     @Column(name = "PROJECT_DOMAIN_NAME")
73     private String projectDomainName;
74
75     @JsonProperty("user_domain_name")
76     @BusinessKey
77     @Column(name = "USER_DOMAIN_NAME")
78     private String userDomainName;
79
80     @JsonProperty("admin_tenant")
81     @BusinessKey
82     @Column(name = "ADMIN_TENANT")
83     private String adminTenant;
84
85     @JsonProperty("member_role")
86     @BusinessKey
87     @Column(name = "MEMBER_ROLE")
88     private String memberRole;
89
90     @JsonProperty("tenant_metadata")
91     @BusinessKey
92     @Column(name = "TENANT_METADATA")
93     private Boolean tenantMetadata;
94
95     @JsonProperty("identity_server_type")
96     @BusinessKey
97     @Enumerated(EnumType.STRING)
98     @Column(name = "IDENTITY_SERVER_TYPE")
99     private ServerType identityServerType;
100
101     @JsonProperty("identity_authentication_type")
102     @BusinessKey
103     @Enumerated(EnumType.STRING)
104     @Column(name = "IDENTITY_AUTHENTICATION_TYPE")
105     private AuthenticationType identityAuthenticationType;
106
107     @JsonProperty("last_updated_by")
108     @BusinessKey
109     @Column(name = "LAST_UPDATED_BY")
110     private String lastUpdatedBy;
111
112     @JsonProperty("creation_timestamp")
113     @BusinessKey
114     @Column(name = "CREATION_TIMESTAMP", updatable = false)
115     @Temporal(TemporalType.TIMESTAMP)
116     private Date created;
117
118     @JsonProperty("update_timestamp")
119     @BusinessKey
120     @Column(name = "UPDATE_TIMESTAMP")
121     @Temporal(TemporalType.TIMESTAMP)
122     private Date updated;
123
124     public CloudIdentity() {}
125
126     @PrePersist
127     protected void onCreate() {
128         this.created = new Date();
129         this.updated = new Date();
130     }
131
132     public String getId() {
133         return id;
134     }
135
136     public void setId(String id) {
137         this.id = id;
138     }
139
140     public String getIdentityUrl() {
141         return this.identityUrl;
142     }
143
144     public void setIdentityUrl(String url) {
145         this.identityUrl = url;
146     }
147
148     public String getMsoId() {
149         return msoId;
150     }
151
152     public void setMsoId(String id) {
153         this.msoId = id;
154     }
155
156     public String getMsoPass() {
157         return msoPass;
158     }
159
160     public void setMsoPass(String pwd) {
161         this.msoPass = pwd;
162     }
163
164     public String getAdminTenant() {
165         return adminTenant;
166     }
167
168     public String getLastUpdatedBy() {
169         return lastUpdatedBy;
170     }
171
172     public Date getCreated() {
173         return created;
174     }
175
176     public Date getUpdated() {
177         return updated;
178     }
179
180     public void setLastUpdatedBy(String lastUpdatedBy) {
181         this.lastUpdatedBy = lastUpdatedBy;
182     }
183
184     public void setCreated(Date created) {
185         this.created = created;
186     }
187
188     public void setUpdated(Date updated) {
189         this.updated = updated;
190     }
191
192     public void setAdminTenant(String tenant) {
193         this.adminTenant = tenant;
194     }
195
196     public String getMemberRole() {
197         return memberRole;
198     }
199
200     public void setMemberRole(String role) {
201         this.memberRole = role;
202     }
203
204     public Boolean getTenantMetadata() {
205         return tenantMetadata;
206     }
207
208     public void setTenantMetadata(Boolean meta) {
209         this.tenantMetadata = meta;
210     }
211
212     public ServerType getIdentityServerType() {
213         return this.identityServerType;
214     }
215
216     public void setIdentityServerType(ServerType ist) {
217         this.identityServerType = ist;
218     }
219
220     public String getIdentityServerTypeAsString() {
221         return this.identityServerType.toString();
222     }
223
224     /**
225      * @return the identityAuthenticationType
226      */
227     public AuthenticationType getIdentityAuthenticationType() {
228         return identityAuthenticationType;
229     }
230
231     /**
232      * @param identityAuthenticationType the identityAuthenticationType to set
233      */
234     public void setIdentityAuthenticationType(AuthenticationType identityAuthenticationType) {
235         this.identityAuthenticationType = identityAuthenticationType;
236     }
237
238     public String getProjectDomainName() {
239         return projectDomainName;
240     }
241
242     public void setProjectDomainName(String projectDomainName) {
243         this.projectDomainName = projectDomainName;
244     }
245
246     public String getUserDomainName() {
247         return userDomainName;
248     }
249
250     public void setUserDomainName(String userDomainName) {
251         this.userDomainName = userDomainName;
252     }
253
254     @Override
255     public CloudIdentity clone() {
256         CloudIdentity cloudIdentityCopy = new CloudIdentity();
257
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;
269
270         return cloudIdentityCopy;
271     }
272
273     @Override
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();
281     }
282
283     @Override
284     public boolean equals(final Object other) {
285         if (other == null) {
286             return false;
287         }
288         if (!getClass().equals(other.getClass())) {
289             return false;
290         }
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();
301     }
302
303     @Override
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();
309     }
310 }