1 package org.smartcomps.twister.util.user;
2
3 import java.util.Collection;
4 import java.util.Iterator;
5
6 public class User {
7
8 private String username;
9 private String password;
10 private Collection roles;
11
12 public User() {
13 }
14
15 public User(String username, String password, Collection roles) {
16 this.username = username;
17 this.password = password;
18 this.roles = roles;
19 }
20
21 public String getUsername() {
22 return username;
23 }
24
25 public void setUsername(String username) {
26 this.username = username;
27 }
28
29 public String getPassword() {
30 return password;
31 }
32
33 public void setPassword(String password) {
34 this.password = password;
35 }
36
37 public Collection getRoles() {
38 return roles;
39 }
40
41 public void setRoles(Collection roles) {
42 this.roles = roles;
43 }
44 public String toString() {
45 String r = " Role";
46 if (roles != null) {
47 Iterator it = roles.iterator();
48 while (it.hasNext()) {
49 Role role = (Role) it.next();
50 r+=":";
51 r+=role.getRolename();
52 }
53 }
54 return "User : username=" + username + ";password=" + password + r;
55 }
56
57 public boolean equals(Object obj) {
58 if (this == obj) return true;
59 if (!(obj instanceof User)) return false;
60 final User user = (User) obj;
61 if (!username.equals(user.getUsername()) ||
62 !password.equals(user.getPassword()) ||
63 !roles.equals(user.getRoles())) return false;
64 return true;
65 }
66
67 }
This page was automatically generated by Maven