1 18 19 package sync4j.framework.server; 20 21 import java.io.Serializable ; 22 import org.apache.commons.lang.builder.ToStringBuilder; 23 24 32 public class Sync4jUser implements Serializable { 33 34 private String username; 35 private String password; 36 private String email; 37 private String firstname; 38 private String lastname; 39 private String [] roles; 40 41 42 public Sync4jUser() { 43 this(null, null, null, null, null, null); 44 } 45 46 public Sync4jUser(String username , 47 String password , 48 String email , 49 String firstname, 50 String lastname , 51 String [] roles) { 52 this.username = username; 53 this.password = password; 54 this.email = email; 55 this.firstname = firstname; 56 this.lastname = lastname; 57 this.roles = roles; 58 } 59 60 64 public String getUsername() { 65 return username; 66 } 67 68 72 public void setUsername(String username) { 73 this.username = username; 74 } 75 76 80 public String getPassword() { 81 return password; 82 } 83 84 88 public void setPassword(String password) { 89 this.password = password; 90 } 91 92 96 public String getEmail() { 97 return email; 98 } 99 100 104 public void setEmail(String email) { 105 this.email = email; 106 } 107 108 112 public String getFirstname() { 113 return firstname; 114 } 115 116 120 public void setFirstname(String firstname) { 121 this.firstname = firstname; 122 } 123 124 128 public String getLastname() { 129 return lastname; 130 } 131 132 136 public void setLastname(String lastname) { 137 this.lastname = lastname; 138 } 139 140 144 public String [] getRoles() { 145 return roles; 146 } 147 148 155 public boolean hasRole(final String role) { 156 for (int i=0; (roles != null) && (i<roles.length); ++i) { 157 if (roles[i].equals(role)) { 158 return true; 159 } 160 } 161 162 return false; 163 } 164 165 169 public void setRoles(String [] roles) { 170 this.roles = roles; 171 } 172 173 public String toString() { 174 ToStringBuilder sb = new ToStringBuilder(this); 175 176 sb.append("username:", username); 177 sb.append("email:", email); 178 sb.append("firstname:", firstname); 179 sb.append("lastname:", lastname); 180 181 return sb.toString(); 182 } 183 184 } 185 | Popular Tags |