KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > javabb > vo > Group


1 package org.javabb.vo;
2
3 import java.io.Serializable JavaDoc;
4 import java.util.Set JavaDoc;
5 import org.apache.commons.lang.builder.EqualsBuilder;
6 import org.apache.commons.lang.builder.HashCodeBuilder;
7 import org.apache.commons.lang.builder.ToStringBuilder;
8
9 /*
10  * Copyright 2004 JavaFree.org
11  *
12  * Licensed under the Apache License, Version 2.0 (the "License");
13  * you may not use this file except in compliance with the License.
14  * You may obtain a copy of the License at
15  *
16  * http://www.apache.org/licenses/LICENSE-2.0
17  *
18  * Unless required by applicable law or agreed to in writing, software
19  * distributed under the License is distributed on an "AS IS" BASIS,
20  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21  * See the License for the specific language governing permissions and
22  * limitations under the License.
23  */

24
25 /**
26  * $Id: Group.java,v 1.2.8.2 2006/04/17 17:46:53 daltoncamargo Exp $
27  * @author Dalton Camargo - <a HREF="mailto:dalton@javabb.org">dalton@javabb.org </a> <br>
28  */

29 /**
30  * @hibernate.class
31  * table="jbb_group"
32  *
33 */

34 public class Group implements Serializable JavaDoc {
35
36     /** identifier field */
37     private Long JavaDoc groupId;
38
39     /** nullable persistent field */
40     private String JavaDoc groupName;
41
42     /** persistent field */
43     private org.javabb.vo.User user;
44
45     /** persistent field */
46     private Set JavaDoc userGroups;
47
48     /** persistent field */
49     private Set JavaDoc GroupModerators;
50
51     /** persistent field */
52     private Set JavaDoc GroupPermissions;
53
54     /** full constructor */
55     public Group(Long JavaDoc groupId, String JavaDoc groupName, org.javabb.vo.User user, Set JavaDoc userGroups, Set JavaDoc GroupModerators, Set JavaDoc GroupPermissions) {
56         this.groupId = groupId;
57         this.groupName = groupName;
58         this.user = user;
59         this.userGroups = userGroups;
60         this.GroupModerators = GroupModerators;
61         this.GroupPermissions = GroupPermissions;
62     }
63
64     /** default constructor */
65     public Group() {
66     }
67
68     /** minimal constructor */
69     public Group(Long JavaDoc groupId, org.javabb.vo.User user, Set JavaDoc userGroups, Set JavaDoc GroupModerators, Set JavaDoc GroupPermissions) {
70         this.groupId = groupId;
71         this.user = user;
72         this.userGroups = userGroups;
73         this.GroupModerators = GroupModerators;
74         this.GroupPermissions = GroupPermissions;
75     }
76
77     /**
78      * @hibernate.id
79      * generator-class="assigned"
80      * type="java.lang.Long"
81      * column="group_id"
82      *
83      */

84     public Long JavaDoc getGroupId() {
85         return this.groupId;
86     }
87
88     public void setGroupId(Long JavaDoc groupId) {
89         this.groupId = groupId;
90     }
91
92     /**
93      * @hibernate.property
94      * column="group_name"
95      * length="255"
96      *
97      */

98     public String JavaDoc getGroupName() {
99         return this.groupName;
100     }
101
102     public void setGroupName(String JavaDoc groupName) {
103         this.groupName = groupName;
104     }
105
106     /**
107      * @hibernate.many-to-one
108      * not-null="true"
109      * @hibernate.column name="id_user"
110      *
111      */

112     public org.javabb.vo.User getUser() {
113         return this.user;
114     }
115
116     public void setUser(org.javabb.vo.User user) {
117         this.user = user;
118     }
119
120     /**
121      * @hibernate.set
122      * lazy="true"
123      * inverse="true"
124      * cascade="none"
125      * @hibernate.collection-key
126      * column="group_id"
127      * @hibernate.collection-one-to-many
128      * class="org.javabb.vo.UserGroup"
129      *
130      */

131     public Set JavaDoc getUserGroups() {
132         return this.userGroups;
133     }
134
135     public void setUserGroups(Set JavaDoc userGroups) {
136         this.userGroups = userGroups;
137     }
138
139     /**
140      * @hibernate.set
141      * lazy="true"
142      * inverse="true"
143      * cascade="none"
144      * @hibernate.collection-key
145      * column="group_id"
146      * @hibernate.collection-one-to-many
147      * class="org.javabb.vo.GroupModerator"
148      *
149      */

150     public Set JavaDoc getGroupModerators() {
151         return this.GroupModerators;
152     }
153
154     public void setGroupModerators(Set JavaDoc GroupModerators) {
155         this.GroupModerators = GroupModerators;
156     }
157
158     /**
159      * @hibernate.set
160      * lazy="true"
161      * inverse="true"
162      * cascade="none"
163      * @hibernate.collection-key
164      * column="group_id"
165      * @hibernate.collection-one-to-many
166      * class="org.javabb.vo.GroupPermission"
167      *
168      */

169     public Set JavaDoc getGroupPermissions() {
170         return this.GroupPermissions;
171     }
172
173     public void setGroupPermissions(Set JavaDoc GroupPermissions) {
174         this.GroupPermissions = GroupPermissions;
175     }
176
177     public String JavaDoc toString() {
178         return new ToStringBuilder(this)
179             .append("groupId", getGroupId())
180             .toString();
181     }
182
183     public boolean equals(Object JavaDoc other) {
184         if ( !(other instanceof Group) ) return false;
185         Group castOther = (Group) other;
186         return new EqualsBuilder()
187             .append(this.getGroupId(), castOther.getGroupId())
188             .isEquals();
189     }
190
191     public int hashCode() {
192         return new HashCodeBuilder()
193             .append(getGroupId())
194             .toHashCode();
195     }
196
197 }
198
Popular Tags