]> SALOME platform Git repositories - tools/siman.git/blobdiff - Workspace/Siman-Common/src/org/splat/service/dto/UserDTO.java
Salome HOME
Modifications done to respect PMD rules. Versioning a document is fixed. Validation...
[tools/siman.git] / Workspace / Siman-Common / src / org / splat / service / dto / UserDTO.java
index 3d2b4c93cbc0bc00ff1e2dd8c8e230f31a4582c7..0109dac369d25ba0c1beef911387d0aab416435f 100644 (file)
@@ -1,6 +1,7 @@
 package org.splat.service.dto;
 
 import java.security.Principal;
+
 import org.splat.kernel.Name;
 
 /**
@@ -10,90 +11,93 @@ import org.splat.kernel.Name;
  */
 public class UserDTO implements Principal, Name {
 
-       private String password; // Property without getter function
-       private String username; // Unique in the user directory
-       private String first;
-       private String last;
-       private String display; // Optional
-       private RoleDTO role = new RoleDTO(); // Roles as list (as stored into the database)
-       private String email;
-       private String organid;
+       private String _password; // Property without getter function
+       private String _username; // Unique in the user directory
+       private String _firstName;
+       private String _name;
+       private String _displayName; // Optional
+       private RoleDTO _role = new RoleDTO(); // Roles as list (as stored into the database)
+       private String _mailAddress;
+       private String _organizationName;
 
        /**
         * Persistent id of the type.
         */
-       private long rid;
+       private long _index;
 
        // ==============================================================================================================================
        // Public member functions
        // ==============================================================================================================================
 
-       public boolean equals(Object item) {
-               if (item == null)
-                       return false;
-               if (item instanceof String) {
-                       return this.username.equals((String) item); // Usernames are unique
-               } else if (item instanceof UserDTO) {
-                       UserDTO given = (UserDTO) item;
-                       return (given.username.equals(this.username)); // Usernames are unique
-               } else {
-                       return false;
+       @Override
+       public boolean equals(final Object item) {
+               boolean res = (item != null);
+               if (res) {
+                       if (item instanceof String) {
+                               res = this._username.equals(item); // Usernames are unique
+                       } else if (item instanceof UserDTO) {
+                               UserDTO given = (UserDTO) item;
+                               res = given._username.equals(this._username); // Usernames are unique
+                       }
                }
+               return res;
        }
 
        public String getDisplayName() {
-               if (display == null)
-                       return last + " " + first;
-               else
-                       return display;
+               String res = _displayName;
+               if (res == null) {
+                       res = _name + " " + _firstName;
+               }
+               return res;
        }
 
        public String getFirstName() {
-               return first;
+               return _firstName;
        }
 
        public void setFirstName(final String name) {
-               first = name;
+               _firstName = name;
        }
 
        public String getMailAddress() {
-               return email;
+               return _mailAddress;
        }
 
        public void setMailAddress(final String addr) {
-               email = addr;
+               _mailAddress = addr;
        }
 
        public String getName() {
-               return last;
+               return _name;
        }
        
        public void setName(final String name) {
-               last = name;
+               _name = name;
        }
 
        public String getOrganizationName() {
-               return organid;
+               return _organizationName;
        }
 
-       public void setOrganizationName(String name) {
-               organid = name;
+       public void setOrganizationName(final String name) {
+               _organizationName = name;
        }
 
        public String getRoleNames() {
-               return role.getName();
+               return _role.getName();
        }
 
        public RoleDTO[] getRoles() {
-               return role.toArray();
+               return _role.toArray();
        }
 
        public String getUsername() {
-               return username;
+               return _username;
        }
 
+       @Override
        public String toString() {
-               return last + " " + first;
+               return _name + " " + _firstName;
        }
 
        /**
@@ -102,7 +106,7 @@ public class UserDTO implements Principal, Name {
         * @return the rid
         */
        public long getIndex() {
-               return rid;
+               return _index;
        }
 
        /**
@@ -111,8 +115,8 @@ public class UserDTO implements Principal, Name {
         * @param rid
         *            the rid to set
         */
-       public void setIndex(long rid) {
-               this.rid = rid;
+       public void setIndex(final long rid) {
+               this._index = rid;
        }
 
        /**
@@ -120,23 +124,23 @@ public class UserDTO implements Principal, Name {
         * @return the password
         */
        public String getPassword() {
-               return password;
+               return _password;
        }
 
        /**
         * Set the password.
         * @param password the password to set
         */
-       public void setPassword(String password) {
-               this.password = password;
+       public void setPassword(final String password) {
+               this._password = password;
        }
 
        /**
         * Set the username.
         * @param username the username to set
         */
-       public void setUsername(String username) {
-               this.username = username;
+       public void setUsername(final String username) {
+               this._username = username;
        }
 
        /**
@@ -144,14 +148,22 @@ public class UserDTO implements Principal, Name {
         * @return the role
         */
        public RoleDTO getRole() {
-               return role;
+               return _role;
        }
 
        /**
         * Set the role.
         * @param role the role to set
         */
-       public void setRole(RoleDTO role) {
-               this.role = role;
+       public void setRole(final RoleDTO role) {
+               this._role = role;
+       }
+
+       /**
+        * Set the displayName.
+        * @param displayName the displayName to set
+        */
+       public void setDisplayName(final String displayName) {
+               _displayName = displayName;
        }
 }
\ No newline at end of file