View Javadoc
1   /*
2    * Created on May 13, 2005
3    *
4    * The system user role.
5    */
6   package net.sf.mindoro.model;
7   
8   /***
9    * The system user role.
10   * 
11   * @author aisrael
12   * @hibernate.class table="systemUser"
13   */
14  public class SystemUser {
15  
16      private Long id;
17  
18      private String login;
19  
20      private String passwordHash;
21  
22      private Person person;
23  
24      /***
25       * Default constructor
26       */
27      public SystemUser() {
28          this(null, "", "");
29      }
30  
31      /***
32       * Parameterized constructor
33       * 
34       * @param person
35       *            Person
36       * @param login
37       *            user login name
38       * @param passwordHash
39       *            password hash (SHA-256)
40       */
41      public SystemUser(final Person person, final String login, final String passwordHash) {
42          this.person = person;
43          this.login = login;
44          this.passwordHash = passwordHash;
45      }
46  
47      /***
48       * @return Returns the id.
49       * @hibernate.id column="id" generator-class="native"
50       */
51      public final Long getId() {
52          return id;
53      }
54  
55      /***
56       * @param id
57       *            The id to set.
58       */
59      public final void setId(final Long id) {
60          this.id = id;
61      }
62  
63      /***
64       * @return Returns the person.
65       * @hibernate.one-to-one class="net.sf.mindoro.model.Person"
66       */
67      public final Person getPerson() {
68          return this.person;
69      }
70  
71      /***
72       * @param person
73       *            The person to set.
74       */
75      public final void setPerson(final Person person) {
76          this.person = person;
77      }
78  
79      /***
80       * @return Returns the login.
81       * @hibernate.property column="login" length="32" unique="true"
82       *                     not-null="true"
83       */
84      public final String getLogin() {
85          return login;
86      }
87  
88      /***
89       * @param login
90       *            The login to set.
91       */
92      public final void setLogin(final String login) {
93          this.login = login;
94      }
95  
96      /***
97       * @return Returns the passwordHash.
98       * @hibernate.property column="passwordHash" length="64" not-null="true"
99       */
100     public final String getPasswordHash() {
101         return passwordHash;
102     }
103 
104     /***
105      * @param passwordHash
106      *            The passwordHash to set.
107      */
108     public final void setPasswordHash(final String passwordHash) {
109         this.passwordHash = passwordHash;
110     }
111 
112     /***
113      * @return Returns the displayName.
114      */
115     public final String getDisplayName() {
116         if (null != person) {
117             return person.getDisplayName();
118         } else {
119             return null;
120         }
121     }
122 
123     /***
124      * (non-Javadoc)
125      * 
126      * @see java.lang.Object#toString()
127      */
128     public final String toString() {
129         return "(SystemUser " + "(login \"" + this.login + "\")(passwordHash \"" + this.passwordHash
130                 + "\")(displayName \"" + this.getDisplayName() + "\"))";
131     }
132 }