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.sdc.be.datatypes.elements;
23 import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition;
25 public class ConsumerDataDefinition extends ToscaDataDefinition {
27 // ECOMP Consumer Name - UTF-8 string up to 255 characters containing the
28 // following characters : ( maybe to limit 4-64 chars ? )
29 // Lowercase characters {a-z}
30 // Uppercase characters {A-Z}
32 // Dash {-}; this character is not supported as the first character in the
34 // Period {.}; this character is not supported as the first character in the
37 // * ECOMP Consumer Password - expected to be SHA-2 256 encrypted value (
38 // SALT + "real" password ) => maximal length 256 bytes = 32 characters
39 // Before storing/comparing please convert upper case letter to lower.
40 // The "normalized" encrypted password should match the following format :
41 // [a-z0-9]{32} = alphanumeric string
43 // * ECOMP Consumer Salt - alphanumeric string [a-z0-9] , length = 32 chars.
44 // * ECOMP Consumer Last Authentication Time ( for future use) -
45 // time when ECOMP Consumer was authenticated for the last time in
46 // milliseconds from 1970 (GMT) - should be set to "0" on creation .
47 // * ECOMP Consumer Details Last updated time - time of the last update in
48 // milliseconds from 1970 (GMT)
49 // * USER_ID - USER_ID of the last user that created/updated credentials (
50 // should be retrieved from USER_ID header)
51 private String consumerName;
52 private String consumerPassword;
53 private String consumerSalt;
54 private Long consumerLastAuthenticationTime;
55 private Long consumerDetailsLastupdatedtime;
56 private String lastModfierAtuid;
58 public ConsumerDataDefinition() {
62 public ConsumerDataDefinition(ConsumerDataDefinition a) {
63 this.consumerName = a.consumerName;
64 this.consumerPassword = a.consumerPassword;
65 this.consumerSalt = a.consumerSalt;
66 this.consumerLastAuthenticationTime = a.consumerLastAuthenticationTime;
67 this.consumerDetailsLastupdatedtime = a.consumerDetailsLastupdatedtime;
68 this.lastModfierAtuid = a.lastModfierAtuid;
72 public String getConsumerName() {
76 public void setConsumerName(String consumerName) {
77 this.consumerName = consumerName;
80 public String getConsumerPassword() {
81 return consumerPassword;
84 public void setConsumerPassword(String consumerPassword) {
85 this.consumerPassword = consumerPassword;
88 public String getConsumerSalt() {
92 public void setConsumerSalt(String consumerSalt) {
93 this.consumerSalt = consumerSalt;
96 public Long getConsumerLastAuthenticationTime() {
97 return consumerLastAuthenticationTime;
100 public void setConsumerLastAuthenticationTime(Long consumerLastAuthenticationTime) {
101 this.consumerLastAuthenticationTime = consumerLastAuthenticationTime;
104 public Long getConsumerDetailsLastupdatedtime() {
105 return consumerDetailsLastupdatedtime;
108 public void setConsumerDetailsLastupdatedtime(Long consumerDetailsLastupdatedtime) {
109 this.consumerDetailsLastupdatedtime = consumerDetailsLastupdatedtime;
112 public String getLastModfierAtuid() {
113 return lastModfierAtuid;
116 public void setLastModfierAtuid(String lastModfierAtuid) {
117 this.lastModfierAtuid = lastModfierAtuid;
121 public String toString() {
122 StringBuilder sb = new StringBuilder();
123 sb.append("ConsumerDataDefinition [").append("consumerName=").append(consumerName).append(",")
124 .append("consumerPassword=").append(consumerPassword).append(",").append("consumerSalt=")
125 .append(consumerSalt).append(",").append("consumerLastAuthenticationTime=")
126 .append(consumerLastAuthenticationTime).append(",").append("consumerDetailsLastupdatedtime=")
127 .append(consumerDetailsLastupdatedtime).append(",").append("lastModfierAtuid=").append(lastModfierAtuid)
129 return sb.toString();
133 public int hashCode() {
134 final int prime = 31;
136 result = prime * result + ((consumerName == null) ? 0 : consumerName.hashCode());
137 result = prime * result + ((consumerPassword == null) ? 0 : consumerPassword.hashCode());
138 result = prime * result + ((consumerSalt == null) ? 0 : consumerSalt.hashCode());
139 result = prime * result
140 + ((consumerLastAuthenticationTime == null) ? 0 : consumerLastAuthenticationTime.hashCode());
141 result = prime * result
142 + ((consumerDetailsLastupdatedtime == null) ? 0 : consumerDetailsLastupdatedtime.hashCode());
143 result = prime * result + ((lastModfierAtuid == null) ? 0 : lastModfierAtuid.hashCode());
148 public boolean equals(Object obj) {
155 if (getClass() != obj.getClass()) {
158 ConsumerDataDefinition other = (ConsumerDataDefinition) obj;
159 if (consumerName == null) {
160 if (other.consumerName != null) {
163 } else if (!consumerName.equals(other.consumerName)) {
166 if (consumerPassword == null) {
167 if (other.consumerPassword != null) {
170 } else if (!consumerPassword.equals(other.consumerPassword)) {
174 if (consumerSalt == null) {
175 if (other.consumerSalt != null) {
178 } else if (!consumerSalt.equals(other.consumerSalt)) {
182 if (consumerLastAuthenticationTime == null) {
183 if (other.consumerLastAuthenticationTime != null) {
186 } else if (!consumerLastAuthenticationTime.equals(other.consumerLastAuthenticationTime)) {
190 if (consumerDetailsLastupdatedtime == null) {
191 if (other.consumerDetailsLastupdatedtime != null) {
194 } else if (!consumerDetailsLastupdatedtime.equals(other.consumerDetailsLastupdatedtime)) {
198 if (lastModfierAtuid == null) {
199 return other.lastModfierAtuid == null;
201 return lastModfierAtuid.equals(other.lastModfierAtuid);