View Javadoc

1   /*
2    * Copyright 2004 Carlos Sanchez.
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package net.sf.oness.user.model.bo;
17  
18  import java.util.Set;
19  
20  import net.sf.oness.common.all.BaseObject;
21  
22  /***
23   * @hibernate.class table="usertable"
24   * @author Carlos Sanchez
25   * @version $Revision: 1.4 $
26   */
27  public class User
28      extends BaseObject
29  {
30  
31      /***
32       * Set of <code>Authority</code> objects
33       * 
34       * @directed true
35       * @supplierCardinality *
36       * @supplierRole authorities
37       */
38      private Set authorities;
39  
40      private String name;
41  
42      private String password;
43  
44      private Boolean enabled = Boolean.TRUE;
45  
46      public User()
47      {
48      }
49  
50      public User( String name, String password, Boolean enabled )
51      {
52          this.name = name;
53          this.password = password;
54          this.enabled = enabled;
55      }
56  
57      public void setName( String name )
58      {
59          this.name = name;
60      }
61  
62      /***
63       * @hibernate.id generator-class="assigned" length="25"
64       * @return String
65       */
66      public String getName()
67      {
68          return name;
69      }
70  
71      public void setPassword( String password )
72      {
73          this.password = password;
74      }
75  
76      /***
77       * @hibernate.property
78       * @return String
79       */
80      public String getPassword()
81      {
82          return password;
83      }
84  
85      /***
86       * Sets the enabled property, by default true.
87       * 
88       * @param enabled
89       *            if null, true is used
90       */
91      public void setEnabled( Boolean enabled )
92      {
93          this.enabled = enabled == null ? Boolean.TRUE : enabled;
94      }
95  
96      /***
97       * @hibernate.property
98       * @return boolean
99       */
100     public Boolean isEnabled()
101     {
102         return enabled;
103     }
104 
105     public void setAuthorities( Set authorities )
106     {
107         this.authorities = authorities;
108     }
109 
110     /***
111      * @hibernate.set lazy="false"
112      * @hibernate.collection-key column="username"
113      * @hibernate.collection-many-to-many class="net.sf.oness.user.model.bo.Authority"
114      * @return Set of <code>Authority</code> objects
115      */
116     public Set getAuthorities()
117     {
118         return authorities;
119     }
120 }