001: /*
002: * Copyright (c) 2001 - 2005 ivata limited.
003: * All rights reserved.
004: * -----------------------------------------------------------------------------
005: * ivata groupware may be redistributed under the GNU General Public
006: * License as published by the Free Software Foundation;
007: * version 2 of the License.
008: *
009: * These programs are free software; you can redistribute them and/or
010: * modify them under the terms of the GNU General Public License
011: * as published by the Free Software Foundation; version 2 of the License.
012: *
013: * These programs are distributed in the hope that they will be useful,
014: * but WITHOUT ANY WARRANTY; without even the implied warranty of
015: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
016: *
017: * See the GNU General Public License in the file LICENSE.txt for more
018: * details.
019: *
020: * If you would like a copy of the GNU General Public License write to
021: *
022: * Free Software Foundation, Inc.
023: * 59 Temple Place - Suite 330
024: * Boston, MA 02111-1307, USA.
025: *
026: *
027: * To arrange commercial support and licensing, contact ivata at
028: * http://www.ivata.com/contact.jsp
029: * -----------------------------------------------------------------------------
030: * $Log: RightDO.java,v $
031: * Revision 1.2 2005/10/02 14:08:58 colinmacleod
032: * Added/improved log4j logging.
033: *
034: * Revision 1.1 2005/09/29 14:17:04 colinmacleod
035: * Split UserGroupDO off from GroupDO.
036: * Moved UserGroupDO, Right classes to security subproject (from
037: * addressbook).
038: * Centralized user right handling into Rights and RightsImpl.
039: *
040: * Revision 1.5 2005/09/14 14:52:01 colinmacleod
041: * Added serialVersionUID.
042: *
043: * Revision 1.4 2005/04/29 02:48:13 colinmacleod
044: * Data bugfixes.
045: * Changed primary key back to Integer.
046: *
047: * Revision 1.3 2005/04/10 20:09:36 colinmacleod
048: * Added new themes.
049: * Changed id type to String.
050: * Changed i tag to em and b tag to strong.
051: * Improved PicoContainerFactory with NanoContainer scripts.
052: *
053: * Revision 1.2 2005/04/09 17:19:07 colinmacleod
054: * Changed copyright text to GPL v2 explicitly.
055: *
056: * Revision 1.1.1.1 2005/03/10 17:50:35 colinmacleod
057: * Restructured ivata op around Hibernate/PicoContainer.
058: * Renamed ivata groupware.
059: *
060: * Revision 1.1 2004/07/13 19:41:14 colinmacleod
061: * Moved project to POJOs from EJBs.
062: * Applied PicoContainer to services layer (replacing session EJBs).
063: * Applied Hibernate to persistence layer (replacing entity EJBs).
064: *
065: * Revision 1.3 2004/03/21 21:16:06 colinmacleod
066: * Shortened name to ivata op.
067: *
068: * Revision 1.2 2004/02/01 22:00:32 colinmacleod
069: * Added full names to author tags
070: *
071: * Revision 1.1.1.1 2004/01/27 20:57:51 colinmacleod
072: * Moved ivata openportal to SourceForge..
073: *
074: * Revision 1.6 2003/11/13 16:03:15 jano
075: * commitng everything to CVS
076: * can deploy and application is ruuning, can login into
077: *
078: * Revision 1.5 2003/11/03 11:28:24 jano
079: * commiting addressbook,
080: * tryinjg to fix deploying problem
081: *
082: * Revision 1.4 2003/10/17 12:36:12 jano
083: * fixing problems with building
084: * converting intranet -> portal
085: * Eclipse building
086: *
087: * Revision 1.3 2003/10/15 13:45:32 jano
088: * converting to XDoclet
089: *
090: * Revision 1.2 2003/10/15 13:18:02 colin
091: * fixing for XDoclet
092: *
093: * Revision 1.3 2003/05/01 12:13:22 jano
094: * tidy up names of sequeneces
095: *
096: * Revision 1.2 2003/02/25 14:38:13 colin
097: * implemented setModified methods on entity beans thro IvataEntityBean superclass
098: *
099: * Revision 1.1 2003/02/24 19:09:21 colin
100: * moved to business
101: *
102: * Revision 1.11 2003/02/04 17:43:45 colin
103: * copyright notice
104: *
105: * Revision 1.10 2003/01/08 17:17:10 jano
106: * fixing bug
107: *
108: * Revision 1.9 2003/01/03 15:42:30 jano
109: * we don't need tempFindTarge...... method, we are using select method
110: *
111: * Revision 1.8 2003/01/03 15:01:46 jano
112: * we have new selec method and method where we are calling that select method
113: *
114: * Revision 1.7 2003/01/03 10:21:45 jano
115: * fixing bug
116: *
117: * Revision 1.6 2003/01/03 09:11:15 jano
118: * taking VIEW of
119: *
120: * Revision 1.4 2002/09/27 12:50:57 jano
121: * ejbCreate ejbPost was change
122: *
123: * Revision 1.3 2002/07/04 12:29:28 jano
124: * i put readonly script to CVS and i will commit all SRC directory
125: *
126: * Revision 1.2 2002/06/17 07:28:44 colin
127: * improved and extended javadoc documentation
128: * -----------------------------------------------------------------------------
129: */
130: package com.ivata.groupware.admin.security.user.group.right;
131:
132: import org.apache.log4j.Logger;
133:
134: import com.ivata.groupware.admin.security.user.group.UserGroupDO;
135: import com.ivata.groupware.admin.security.user.group.right.detail.RightDetailDO;
136: import com.ivata.groupware.container.persistence.BaseDO;
137:
138: /**
139: * <p>Assigns the right to perform a specific action to a group of people. Each
140: * right allows a group to add, amend, view or delete entries from the intranet.
141: * The element which is allowed to be changed by this right is described by the
142: * {@link com.ivata.groupware.adddressbook.person.group.right.detail.RightDetailBean
143: * detail EJB} associated with it.</p>
144: *
145: * @since ivata groupware 0.9 (2002-05-19)
146: * @author Colin MacLeod
147: * <a href='mailto:colin.macleod@ivata.com'>colin.macleod@ivata.com</a>
148: * @see
149: * com.ivata.groupware.adddressbook.person.group.right.detail.RightDetailBean
150: * @see RightConstants
151: * @version $Revision: 1.2 $
152: *
153: * @hibernate.class
154: * table="user_right"
155: * @hibernate.cache
156: * usage="read-write"
157: */
158: public class RightDO extends BaseDO {
159: /**
160: * Logger for this class.
161: */
162: private static final Logger logger = Logger
163: .getLogger(RightDO.class);
164:
165: /**
166: * Serialization version (for <code>Serializable</code> interface).
167: */
168: private static final long serialVersionUID = 1L;
169:
170: /**
171: * <p>Access level allowed. This will give the group the right to
172: * add, amend, view or delete the associated data, as defined in
173: * {@link RightConstants RightConstants}.</p>
174: */
175: private Integer access;
176:
177: /**
178: * <p>The detail, which provides clear text information about this
179: * right.</p>
180: */
181: private RightDetailDO detail;
182:
183: /**
184: * <p>Group who is entitled by this right. Rights in ivata groupware
185: * are allocated on a per-group basis.</p>
186: */
187: private UserGroupDO group;
188:
189: /**
190: * <p>Id of the DO this right targets. Some rights allow a group
191: * access to a specific instance of an EJB. This id is the id of that
192: * instance.</p>
193: */
194: private Integer targetId;
195:
196: /**
197: * <p>Get the access level allowed. This will give the group the right to
198: * add, amend, view or delete the associated data, as defined in
199: * {@link RightConstants RightConstants}.</p>
200: *
201: * @return access level allowed, as defined in {@link RightConstants
202: * RightConstants}.
203: *
204: * @hibernate.property
205: */
206: public final Integer getAccess() {
207: if (logger.isDebugEnabled()) {
208: logger.debug("getAccess() - start");
209: }
210:
211: if (logger.isDebugEnabled()) {
212: logger
213: .debug("getAccess() - end - return value = "
214: + access);
215: }
216: return access;
217: }
218:
219: /**
220: * <p>Get the detail, which provides clear text information about this
221: * right.</p>
222: *
223: * @return instance providing clear text information about this right
224: *
225: * @hibernate.many-to-one
226: * column="detail"
227: */
228: public final RightDetailDO getDetail() {
229: if (logger.isDebugEnabled()) {
230: logger.debug("getDetail() - start");
231: }
232:
233: if (logger.isDebugEnabled()) {
234: logger
235: .debug("getDetail() - end - return value = "
236: + detail);
237: }
238: return detail;
239: }
240:
241: /**
242: * <p>Get the group who is entitled by this right. Rights in ivata groupware
243: * are allocated on a per-group basis.</p>
244: *
245: * @return group entitled to this right.
246: *
247: * @hibernate.many-to-one
248: * column="user_group"
249: */
250: public final UserGroupDO getGroup() {
251: if (logger.isDebugEnabled()) {
252: logger.debug("getGroup() - start");
253: }
254:
255: if (logger.isDebugEnabled()) {
256: logger.debug("getGroup() - end - return value = " + group);
257: }
258: return group;
259: }
260:
261: /**
262: * <p>Get the id of the DO this right targets. Some rights allow a group
263: * access to a specific instance of an EJB. This id is the id of that
264: * instance.</p>
265: *
266: * @return the id of the EJB the right targets, or null if this right is not
267: * specific to a single instance.
268: *
269: * @hibernate.property
270: * column="target_id"
271: */
272: public final Integer getTargetId() {
273: if (logger.isDebugEnabled()) {
274: logger.debug("getTargetId() - start");
275: }
276:
277: if (logger.isDebugEnabled()) {
278: logger.debug("getTargetId() - end - return value = "
279: + targetId);
280: }
281: return targetId;
282: }
283:
284: /**
285: * <p>Set the access level allowed. This will give the group the right to
286: * add, amend, view or delete the associated data, as defined in
287: * {@link RightConstants RightConstants}.</p>
288: *
289: * @param access access level allowed, as defined in {@link RightConstants
290: * RightConstants}
291: */
292: public final void setAccess(final Integer access) {
293: if (logger.isDebugEnabled()) {
294: logger.debug("setAccess(Integer access = " + access
295: + ") - start");
296: }
297:
298: checkSetter();
299: this .access = access;
300:
301: if (logger.isDebugEnabled()) {
302: logger.debug("setAccess(Integer) - end");
303: }
304: }
305:
306: /**
307: * <p>Set the detail, which provides clear text information about this
308: * right.</p>
309: *
310: * @param detail instance providing clear text information about this right
311: */
312: public final void setDetail(final RightDetailDO detail) {
313: if (logger.isDebugEnabled()) {
314: logger.debug("setDetail(RightDetailDO detail = " + detail
315: + ") - start");
316: }
317:
318: checkSetter();
319: this .detail = detail;
320:
321: if (logger.isDebugEnabled()) {
322: logger.debug("setDetail(RightDetailDO) - end");
323: }
324: }
325:
326: /**
327: * <p>Set the group who is entitled by this right. Rights in ivata groupware
328: * are allocated on a per-group basis.</p>
329: *
330: * @param group group bean entitled to this right.
331: */
332: public final void setGroup(final UserGroupDO group) {
333: if (logger.isDebugEnabled()) {
334: logger.debug("setGroup(UserGroupDO group = " + group
335: + ") - start");
336: }
337:
338: checkSetter();
339: this .group = group;
340:
341: if (logger.isDebugEnabled()) {
342: logger.debug("setGroup(UserGroupDO) - end");
343: }
344: }
345:
346: /**
347: * <p>Set the id of the DO this right targets. Some rights allow a group
348: * access to a specific instance of an EJB. This id is the id of that
349: * instance.</p>
350: *
351: * @param targetId the id of the EJB the right targets, or null if this
352: * right is not specific to a single instance.
353: */
354: public final void setTargetId(final Integer targetId) {
355: if (logger.isDebugEnabled()) {
356: logger.debug("setTargetId(Integer targetId = " + targetId
357: + ") - start");
358: }
359:
360: checkSetter();
361: this .targetId = targetId;
362:
363: if (logger.isDebugEnabled()) {
364: logger.debug("setTargetId(Integer) - end");
365: }
366: }
367: }
|