48d5622a6f4e533d369404d2c5391dbf0c55158a
[integration/csit.git] / plans / usecases / pnf-sw-upgrade / so / simulator / common / src / main / java / org / onap / so / simulator / model / User.java
1 /*-
2  * ============LICENSE_START=======================================================
3  *  Copyright (C) 2019 Nordix Foundation.
4  * ================================================================================
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *      http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  * SPDX-License-Identifier: Apache-2.0
18  * ============LICENSE_END=========================================================
19  */
20 package org.onap.so.simulator.model;
21
22 import static org.springframework.util.ObjectUtils.nullSafeEquals;
23
24 /**
25  * @author Waqas Ikram (waqas.ikram@est.tech)
26  *
27  */
28 public class User {
29     private String username;
30     private String password;
31     private String role;
32
33     /**
34      * @return the username
35      */
36     public String getUsername() {
37         return username;
38     }
39
40     /**
41      * @param username the username to set
42      */
43     public void setUsername(final String username) {
44         this.username = username;
45     }
46
47     /**
48      * @return the password
49      */
50     public String getPassword() {
51         return password;
52     }
53
54     /**
55      * @param password the password to set
56      */
57     public void setPassword(final String password) {
58         this.password = password;
59     }
60
61     /**
62      * @return the role
63      */
64     public String getRole() {
65         return role;
66     }
67
68     /**
69      * @param role the role to set
70      */
71     public void setRole(final String role) {
72         this.role = role;
73     }
74
75     @Override
76     public int hashCode() {
77         final int prime = 31;
78         int result = 1;
79         result = prime * result + ((password == null) ? 0 : password.hashCode());
80         result = prime * result + ((role == null) ? 0 : role.hashCode());
81         result = prime * result + ((username == null) ? 0 : username.hashCode());
82         return result;
83     }
84
85     @Override
86     public boolean equals(final Object obj) {
87         if (obj instanceof User) {
88             final User other = (User) obj;
89             return nullSafeEquals(this.username, other.username) && nullSafeEquals(this.password, other.password)
90                     && nullSafeEquals(this.role, other.role);
91         }
92         return false;
93     }
94
95     @Override
96     public String toString() {
97         return "UserCredential [username=" + username + ", password=" + password + ", role=" + role + "]";
98     }
99
100
101 }