View Javadoc

1   /*
2    * Copyright 2002-2004 the original author or authors.
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  
17  package net.sf.fridaymvc.sample.hibernate;
18  
19  import java.io.Serializable;
20  import java.util.HashSet;
21  import java.util.Set;
22  
23  import net.sf.fridaymvc.security.accesscontroller.AbstractRole;
24  
25  /***
26   * @author <a href="mailto:arto.pastinen@ofw.fi">Arto Pastinen</a>
27   * @version $Id: HibernateRole.java,v 1.1.1.1 2004/11/23 09:36:43 artsi Exp $
28   * @hibernate.class
29   * 		table = "roles"
30   */
31  
32  public class HibernateRole extends AbstractRole implements Serializable {
33      protected Integer roleUid;
34      protected String name;
35  
36      /***
37       * @return Returns the roleUid.
38       * @hibernate.id
39       * 		column = "role_uid"
40       * 		generator-class = "native"
41       * 		unsaved-value = "null"
42       */
43      public Integer getRoleUid() {
44          return this.roleUid;
45      }
46      /***
47       * @param roleUid The roleUid to set.
48       */
49      public void setRoleUid(Integer roleUid) {
50          this.roleUid = roleUid;
51      }
52      /***
53       * 
54       * @hibernate.set 		
55       * 		cascade = "all"
56       * 		table = "join_roles_permissions"
57       * 
58       * @hibernate.collection-key
59       * 		column = "permission_uid"
60       * 		
61       * @hibernate.collection-many-to-many 
62       * 		class = "net.sf.fridaymvc.sample.hibernate.HibernatePermission"
63       * 		column = "role_uid"
64       */
65      public Set getPermissions() {
66          Set permissions = super.getPermissions();
67          if(permissions == null) setPermissions(new HashSet(1));
68          return permissions;
69      }
70  
71      /***
72       * @return Returns the name.
73       * @hibernate.property 
74       * 		column = "name"
75       * 		not-null = "true"
76       * 		unique = "true"
77       * 		length = "100"
78       */
79      public String getName() {
80          return super.name;
81      }    
82  }