1 package org.splat.service.dto;
3 import java.security.Principal;
5 import org.splat.kernel.Name;
10 * @author <a href="mailto:roman.kozlov@opencascade.com">Roman Kozlov (RKV)</a>
12 public class UserDTO implements Principal, Name {
14 private String _password; // Property without getter function
15 private String _username; // Unique in the user directory
16 private String _firstName;
18 private String _displayName; // Optional
19 private RoleDTO _role = new RoleDTO(); // Roles as list (as stored into the database)
20 private String _mailAddress;
21 private String _organizationName;
24 * Persistent id of the type.
28 // ==============================================================================================================================
29 // Public member functions
30 // ==============================================================================================================================
33 public boolean equals(final Object item) {
34 boolean res = (item != null);
36 if (item instanceof String) {
37 res = this._username.equals(item); // Usernames are unique
38 } else if (item instanceof UserDTO) {
39 UserDTO given = (UserDTO) item;
40 res = given._username.equals(this._username); // Usernames are unique
46 public String getDisplayName() {
47 String res = _displayName;
49 res = _name + " " + _firstName;
54 public String getFirstName() {
58 public void setFirstName(final String name) {
62 public String getMailAddress() {
66 public void setMailAddress(final String addr) {
70 public String getName() {
74 public void setName(final String name) {
78 public String getOrganizationName() {
79 return _organizationName;
82 public void setOrganizationName(final String name) {
83 _organizationName = name;
86 public String getRoleNames() {
87 return _role.getName();
90 public RoleDTO[] getRoles() {
91 return _role.toArray();
94 public String getUsername() {
99 public String toString() {
100 return _name + " " + _firstName;
108 public long getIndex() {
118 public void setIndex(final long rid) {
124 * @return the password
126 public String getPassword() {
132 * @param password the password to set
134 public void setPassword(final String password) {
135 this._password = password;
140 * @param username the username to set
142 public void setUsername(final String username) {
143 this._username = username;
150 public RoleDTO getRole() {
156 * @param role the role to set
158 public void setRole(final RoleDTO role) {
163 * Set the displayName.
164 * @param displayName the displayName to set
166 public void setDisplayName(final String displayName) {
167 _displayName = displayName;