KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > portal > core > impl > role > RoleImpl


1 /*****************************************
2  * *
3  * JBoss Portal: The OpenSource Portal *
4  * *
5  * Distributable under LGPL license. *
6  * See terms of license at gnu.org. *
7  * *
8  *****************************************/

9 package org.jboss.portal.core.impl.role;
10
11 import org.jboss.portal.core.model.Role;
12
13 import java.util.HashSet JavaDoc;
14 import java.util.Set JavaDoc;
15
16 /**
17  * @author <a HREF="mailto:julien@jboss.org">Julien Viet </a>
18  * @author <a HREF="mailto:theute@jboss.org">Thomas Heute </a>
19  * @author Roy Russo : roy at jboss dot org
20  * @version $Revision: 1.4 $
21  * @hibernate.class table="jbp_roles"
22  */

23 public class RoleImpl
24       implements Role
25 {
26
27    private Integer JavaDoc id;
28
29    private String JavaDoc name;
30
31    private Set JavaDoc users;
32
33    private String JavaDoc displayName;
34
35    private Integer JavaDoc rid; // role_ID
36

37    /**
38     * Called by hibernate.
39     */

40    public RoleImpl()
41    {
42       this.id = null;
43       this.name = null;
44       this.users = new HashSet JavaDoc();
45    }
46
47    public RoleImpl(String JavaDoc name)
48    {
49       this.id = null;
50       this.name = name;
51       this.displayName = name;
52       this.users = new HashSet JavaDoc();
53    }
54
55    public RoleImpl(String JavaDoc name, String JavaDoc displayName)
56    {
57       this.id = null;
58       this.name = name;
59       this.displayName = displayName;
60       this.users = new HashSet JavaDoc();
61    }
62
63    /**
64     * Called by hibernate.
65     */

66    private void setID(Integer JavaDoc id)
67    {
68       this.id = id;
69    }
70
71    /**
72     * Called by hibernate.
73     */

74    public void setName(String JavaDoc name)
75    {
76       this.name = name;
77    }
78
79    /**
80     * Called by hibernate.
81     */

82    public void setDisplayName(String JavaDoc displayName)
83    {
84       this.displayName = displayName;
85    }
86
87    /**
88     * Called by hibernate.
89     */

90    private void setUsers(Set JavaDoc users)
91    {
92       this.users = users;
93    }
94
95    // ******************************************************************************************************************
96

97    /**
98     * @hibernate.id column="jbp_rid" generator-class="native"
99     */

100    public Integer JavaDoc getID()
101    {
102       return id;
103    }
104
105    /**
106     * @hibernate.property column="jbp_name" unique="true" update="false"
107     */

108    public String JavaDoc getName()
109    {
110       return name;
111    }
112
113    /**
114     * @hibernate.property column="jbp_displayname" unique="true" update="true"
115     */

116    public String JavaDoc getDisplayName()
117    {
118       return displayName;
119    }
120
121    /**
122     * @hibernate.set inverse="true" table="jbp_role_membership" lazy="true"
123     * cascade="none"
124     * @hibernate.collection-key column="jbp_rid"
125     * @hibernate.collection-many-to-many column="jbp_uid"
126     * class="org.jboss.portal.core.impl.user.UserImpl"
127     * outer-join="false"
128     */

129    public Set JavaDoc getUsers()
130    {
131       return users;
132    }
133
134    public String JavaDoc toString()
135    {
136       return "Role[" + id + "," + name + "]";
137    }
138 }
Popular Tags