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: MenuItemDO.java,v $
031: * Revision 1.6 2005/10/02 14:08:58 colinmacleod
032: * Added/improved log4j logging.
033: *
034: * Revision 1.5 2005/09/29 13:22:47 colinmacleod
035: * Added read-only functionality to data object classes (with a check on each
036: * setter).
037: *
038: * Revision 1.4 2005/09/14 16:10:22 colinmacleod
039: * Removed unused local and class variables.
040: * Added serialVersionUID.
041: *
042: * Revision 1.3 2005/04/10 20:10:06 colinmacleod
043: * Added new themes.
044: * Changed id type to String.
045: * Changed i tag to em and b tag to strong.
046: * Improved PicoContainerFactory with NanoContainer scripts.
047: *
048: * Revision 1.2 2005/04/09 17:19:58 colinmacleod
049: * Changed copyright text to GPL v2 explicitly.
050: *
051: * Revision 1.1.1.1 2005/03/10 17:51:32 colinmacleod
052: * Restructured ivata op around Hibernate/PicoContainer.
053: * Renamed ivata groupware.
054: *
055: * Revision 1.1 2004/09/30 15:16:04 colinmacleod
056: * Split off addressbook elements into security subproject.
057: *
058: * Revision 1.1 2004/07/13 19:41:16 colinmacleod
059: * Moved project to POJOs from EJBs.
060: * Applied PicoContainer to services layer (replacing session EJBs).
061: * Applied Hibernate to persistence layer (replacing entity EJBs).
062: *
063: * Revision 1.3 2004/03/21 21:16:19 colinmacleod
064: * Shortened name to ivata op.
065: *
066: * Revision 1.2 2004/02/01 22:00:34 colinmacleod
067: * Added full names to author tags
068: *
069: * Revision 1.1.1.1 2004/01/27 20:57:59 colinmacleod
070: * Moved ivata openportal to SourceForge..
071: *
072: * Revision 1.5 2003/11/03 11:28:25 jano
073: * commiting addressbook,
074: * tryinjg to fix deploying problem
075: *
076: * Revision 1.4 2003/10/17 12:36:13 jano
077: * fixing problems with building
078: * converting intranet -> portal
079: * Eclipse building
080: *
081: * Revision 1.3 2003/10/15 13:56:20 jano
082: * converting to XDoclet
083: *
084: * Revision 1.2 2003/10/15 13:49:57 colin
085: * fixing fo Xdoclet
086: *
087: * Revision 1.10 2003/05/01 12:15:43 jano
088: * tidy up names of sequeneces
089: *
090: * Revision 1.9 2003/02/25 14:38:14 colin
091: * implemented setModified methods on entity beans thro IvataEntityBean superclass
092: *
093: * Revision 1.8 2003/02/24 19:27:17 colin
094: * restructured file paths
095: *
096: * Revision 1.7 2003/02/04 17:43:50 colin
097: * copyright notice
098: *
099: * Revision 1.6 2002/09/11 15:00:29 colin
100: * update for adding new menu items
101: *
102: * Revision 1.5 2002/08/19 13:35:02 colin
103: * added image
104: *
105: * Revision 1.4 2002/07/04 12:29:28 jano
106: * i put readonly script to CVS and i will commit all SRC directory
107: *
108: * Revision 1.3 2002/06/28 13:31:20 colin
109: * changed create method.
110: *
111: * Revision 1.2 2002/06/17 07:29:08 colin
112: * improved and extended javadoc documentation
113: * -----------------------------------------------------------------------------
114: */
115: package com.ivata.groupware.navigation.menu.item;
116:
117: import org.apache.log4j.Logger;
118:
119: import com.ivata.groupware.admin.security.user.UserDO;
120: import com.ivata.groupware.container.persistence.BaseDO;
121: import com.ivata.groupware.navigation.menu.MenuDO;
122:
123: /**
124: * <p><code>EntityBean</code> to store items in the users menu system.</p>
125: *
126: * @since 2002-05-07
127: * @author Colin MacLeod
128: * <a href='mailto:colin.macleod@ivata.com'>colin.macleod@ivata.com</a>
129: * @version $Revision: 1.6 $
130: * @see com.ivata.groupware.menu.MenuBean
131: *
132: * @hibernate.class
133: * table="navigation_menu_item"
134: * @hibernate.cache
135: * usage="read-write"
136: */
137: public class MenuItemDO extends BaseDO {
138: /**
139: * Logger for this class.
140: */
141: private static final Logger logger = Logger
142: .getLogger(MenuItemDO.class);
143:
144: /**
145: * Serialization version (for <code>Serializable</code> interface).
146: */
147: private static final long serialVersionUID = 1L;
148:
149: /**
150: * <p>Image associated with the item.</p>
151: */
152: private String image;
153:
154: /**
155: * <p>
156: * Menu which contains this item.
157: * </p>
158: */
159: private MenuDO menu;
160: /**
161: * <p>Order in which this menu item should appear, in relation to the other
162: * menu items.<p>
163: */
164: private Integer priority;
165:
166: /**
167: * <p>Get the text or caption which should appear in this menu.</p>
168: */
169: private String text;
170:
171: /**
172: * <p>Get the <code>URL</code> to link this menu item to.</p>
173: */
174: private String URL;
175:
176: /**
177: * <p>User associated with this menu item.</p>
178: */
179: private UserDO user;
180:
181: /**
182: * <p>Get the image associated with the item.</p>
183: *
184: * @return the filename (without path) of an image associated with this
185: * item, or <code>null</code> if no image is currently associated with this
186: * menu item.
187: * @hibernate.property
188: */
189: public final String getImage() {
190: if (logger.isDebugEnabled()) {
191: logger.debug("getImage() - start");
192: }
193:
194: if (logger.isDebugEnabled()) {
195: logger.debug("getImage() - end - return value = " + image);
196: }
197: return image;
198: }
199:
200: /**
201: * <p>
202: * Menu which contains this item.
203: * </p>
204: *
205: * @return current value of menu.
206: * @hibernate.many-to-one
207: */
208: public final MenuDO getMenu() {
209: if (logger.isDebugEnabled()) {
210: logger.debug("getMenu() - start");
211: }
212:
213: if (logger.isDebugEnabled()) {
214: logger.debug("getMenu() - end - return value = " + menu);
215: }
216: return menu;
217: }
218:
219: /**
220: * <p>Get the order in which this menu item should appear, in relation to the other
221: * menu items.<p>
222: *
223: * @return the order in which this menu item should appear, in relation
224: * to the other menu items. Lower values of this number will appear lower in the
225: * list of menu items (and are therefore more significant).
226: * @hibernate.property
227: */
228: public final Integer getPriority() {
229: if (logger.isDebugEnabled()) {
230: logger.debug("getPriority() - start");
231: }
232:
233: if (logger.isDebugEnabled()) {
234: logger.debug("getPriority() - end - return value = "
235: + priority);
236: }
237: return priority;
238: }
239:
240: /**
241: * <p>Get the text or caption which should appear in this menu.</p>
242: *
243: * @return the text or caption which should appear in this menu
244: * @hibernate.property
245: */
246: public final String getText() {
247: if (logger.isDebugEnabled()) {
248: logger.debug("getText() - start");
249: }
250:
251: if (logger.isDebugEnabled()) {
252: logger.debug("getText() - end - return value = " + text);
253: }
254: return text;
255: }
256:
257: /**
258: * <p>Get the <code>URL</code> to link this menu item to.</p>
259: *
260: * @return the <code>URL</code> to link this menu item to
261: * @hibernate.property
262: */
263: public final String getURL() {
264: if (logger.isDebugEnabled()) {
265: logger.debug("getURL() - start");
266: }
267:
268: if (logger.isDebugEnabled()) {
269: logger.debug("getURL() - end - return value = " + URL);
270: }
271: return URL;
272: }
273:
274: /**
275: * <p>Get the user associated with this menu item.</p>
276: *
277: * @return the user associated with this item, or <code>null</code> if
278: * the item should appear in all users' menues.
279: *
280: * @hibernate.many-to-one
281: * column="person_user"
282: */
283: public UserDO getUser() {
284: if (logger.isDebugEnabled()) {
285: logger.debug("getUser() - start");
286: }
287:
288: if (logger.isDebugEnabled()) {
289: logger.debug("getUser() - end - return value = " + user);
290: }
291: return user;
292: }
293:
294: /**
295: * <p>Set the image associated with the item.</p>
296: *
297: * @param image the filename (without path) of an image associated with this
298: * item, or <code>null</code> if no image is currently associated with this
299: * menu item.
300: */
301: public final void setImage(final String image) {
302: if (logger.isDebugEnabled()) {
303: logger.debug("setImage(String image = " + image
304: + ") - start");
305: }
306:
307: checkSetter();
308: this .image = image;
309:
310: if (logger.isDebugEnabled()) {
311: logger.debug("setImage(String) - end");
312: }
313: }
314:
315: /**
316: * <p>
317: * Menu which contains this item.
318: * </p>
319: *
320: * @param menu new value of menu.
321: */
322: public final void setMenu(final MenuDO menu) {
323: if (logger.isDebugEnabled()) {
324: logger.debug("setMenu(MenuDO menu = " + menu + ") - start");
325: }
326:
327: checkSetter();
328: this .menu = menu;
329:
330: if (logger.isDebugEnabled()) {
331: logger.debug("setMenu(MenuDO) - end");
332: }
333: }
334:
335: /**
336: * <p>Set the order in which this menu item should appear, in relation to the other
337: * menu items.<p>
338: *
339: * @param priority the order in which this menu item should appear, in relation
340: * to the other menu items. Lower values of this number will appear lower in the
341: * list of menu items (and are therefore more significant).
342: */
343: public final void setPriority(final Integer priority) {
344: if (logger.isDebugEnabled()) {
345: logger.debug("setPriority(Integer priority = " + priority
346: + ") - start");
347: }
348:
349: checkSetter();
350: this .priority = priority;
351:
352: if (logger.isDebugEnabled()) {
353: logger.debug("setPriority(Integer) - end");
354: }
355: }
356:
357: /**
358: * <p>Set the text or caption which should appear in this menu.</p>
359: *
360: * @param text the text or caption which should appear in this menu.
361: */
362: public final void setText(final String text) {
363: if (logger.isDebugEnabled()) {
364: logger.debug("setText(String text = " + text + ") - start");
365: }
366:
367: checkSetter();
368: this .text = text;
369:
370: if (logger.isDebugEnabled()) {
371: logger.debug("setText(String) - end");
372: }
373: }
374:
375: /**
376: * <p>Set the <code>URL</code> to link this menu item to.</p>
377: *
378: * @param URL the <code>URL</code> to link this menu item to.
379: */
380: public final void setURL(final String URL) {
381: if (logger.isDebugEnabled()) {
382: logger.debug("setURL(String URL = " + URL + ") - start");
383: }
384:
385: checkSetter();
386: this .URL = URL;
387:
388: if (logger.isDebugEnabled()) {
389: logger.debug("setURL(String) - end");
390: }
391: }
392:
393: /**
394: * <p>Set the user associated with this menu item.</p>
395: *
396: * @param user the user associated with this item, or <code>null</code> if
397: * the item should appear in all users' menues.
398: */
399: public final void setUser(final UserDO user) {
400: if (logger.isDebugEnabled()) {
401: logger.debug("setUser(UserDO user = " + user + ") - start");
402: }
403:
404: checkSetter();
405: this .user = user;
406:
407: if (logger.isDebugEnabled()) {
408: logger.debug("setUser(UserDO) - end");
409: }
410: }
411: }
|