KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > ivata > groupware > navigation > menu > MenuDO


1 /*
2  * Copyright (c) 2001 - 2005 ivata limited.
3  * All rights reserved.
4  * -----------------------------------------------------------------------------
5  * ivata groupware may be redistributed under the GNU General Public
6  * License as published by the Free Software Foundation;
7  * version 2 of the License.
8  *
9  * These programs are free software; you can redistribute them and/or
10  * modify them under the terms of the GNU General Public License
11  * as published by the Free Software Foundation; version 2 of the License.
12  *
13  * These programs are distributed in the hope that they will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16  *
17  * See the GNU General Public License in the file LICENSE.txt for more
18  * details.
19  *
20  * If you would like a copy of the GNU General Public License write to
21  *
22  * Free Software Foundation, Inc.
23  * 59 Temple Place - Suite 330
24  * Boston, MA 02111-1307, USA.
25  *
26  *
27  * To arrange commercial support and licensing, contact ivata at
28  * http://www.ivata.com/contact.jsp
29  * -----------------------------------------------------------------------------
30  * $Log: MenuDO.java,v $
31  * Revision 1.4 2005/04/29 02:48:20 colinmacleod
32  * Data bugfixes.
33  * Changed primary key back to Integer.
34  *
35  * Revision 1.3 2005/04/10 20:10:05 colinmacleod
36  * Added new themes.
37  * Changed id type to String.
38  * Changed i tag to em and b tag to strong.
39  * Improved PicoContainerFactory with NanoContainer scripts.
40  *
41  * Revision 1.2 2005/04/09 17:19:58 colinmacleod
42  * Changed copyright text to GPL v2 explicitly.
43  *
44  * Revision 1.1.1.1 2005/03/10 17:51:32 colinmacleod
45  * Restructured ivata op around Hibernate/PicoContainer.
46  * Renamed ivata groupware.
47  *
48  * Revision 1.1 2004/09/30 15:16:04 colinmacleod
49  * Split off addressbook elements into security subproject.
50  *
51  * Revision 1.4 2004/07/13 19:41:16 colinmacleod
52  * Moved project to POJOs from EJBs.
53  * Applied PicoContainer to services layer (replacing session EJBs).
54  * Applied Hibernate to persistence layer (replacing entity EJBs).
55  *
56  * Revision 1.3 2004/03/21 21:16:19 colinmacleod
57  * Shortened name to ivata op.
58  *
59  * Revision 1.2 2004/02/01 22:00:34 colinmacleod
60  * Added full names to author tags
61  *
62  * Revision 1.1.1.1 2004/01/27 20:57:59 colinmacleod
63  * Moved ivata openportal to SourceForge..
64  *
65  * Revision 1.2 2003/10/15 13:49:57 colin
66  * fixing fo Xdoclet
67  *
68  * Revision 1.7 2003/02/24 19:27:17 colin
69  * restructured file paths
70  *
71  * Revision 1.6 2003/02/04 17:43:50 colin
72  * copyright notice
73  *
74  * Revision 1.5 2002/09/27 18:15:32 peter
75  * vector of menuItem ids added to menuDO and the appropriate changes to Menubean
76  *
77  * Revision 1.4 2002/09/11 15:00:05 colin
78  * improved documentation
79  *
80  * Revision 1.3 2002/08/19 13:48:58 colin
81  * added image to menu items
82  *
83  * Revision 1.2 2002/06/28 13:29:54 colin
84  * added comparison method.
85  *
86  * Revision 1.1 2002/06/13 11:21:57 colin
87  * first version with rose model integration.
88  * -----------------------------------------------------------------------------
89  */

90 package com.ivata.groupware.navigation.menu;
91
92
93 import java.util.Set JavaDoc;
94
95 import com.ivata.groupware.container.persistence.BaseDO;
96
97
98 /**
99  * <p><code>EntityBean</code> to store the users menu system.</p>
100  *
101  * <p>This is a dependent value class, used to pass data back from the.</p>
102  * {@link MenuBean MenuBean} to a client application.</p>
103  *
104  * <p><strong>Note:</strong> This class provides data from {@link MenuBean MenuBean}.
105  * This is no local copy of the bean class, however, and changes here
106  * will not be automatically reflected in {@link MenuBean MenuBean}.</p>
107  *
108  * @since 2002-05-07
109  * @author Colin MacLeod
110  * <a HREF='mailto:colin.macleod@ivata.com'>colin.macleod@ivata.com</a>
111  * @version $Revision: 1.4 $
112  * @see MenuBean
113  *
114  * @hibernate.class
115  * table="navigation_menu"
116  * @hibernate.cache
117  * usage="read-write"
118  */

119 public class MenuDO extends BaseDO {
120
121     /**
122      * <p>All the menu items under this menu.</p>
123      */

124     private Set JavaDoc items;
125     /**
126      * <p>Order in which this menu should appear, in relation to the other
127      * menus.<p>
128      */

129     private Integer JavaDoc priority;
130     /**
131      * <p>Text or caption which should appear on this menu.</p>
132      */

133     private String JavaDoc text;
134
135     /**
136      * <p>Comparison method. See if the object supplied is a menu dependent
137      * object and, if so, whether or not its contents are the same as this one.
138      * Only the <code>id</code> fields are compared.</p>
139      *
140      * @param compare the object to compare with this one.
141      * @return <code>true</code> if the object supplied in <code>compare</code>
142      * is effectively the same as this one, otherwise false.
143      */

144     public boolean equals(final Object JavaDoc compare) {
145         // first check it is non-null and the class is right
146
if ((compare == null) ||
147             !(this.getClass().isInstance(compare))) {
148             return false;
149         }
150         MenuDO menuDO = (MenuDO) compare;
151         Integer JavaDoc id = getId();
152         Integer JavaDoc menuDOId = menuDO.getId();
153
154         // check that the ids are the same
155
return (((id == null) ?
156                     (menuDOId == null) :
157                     id.equals(menuDOId)));
158     }
159     /**
160      * <p>Get all the menu items under this menu.</p>
161      *
162      * @return all items in this menu as a <code>Collection</code> of
163      * <code>MenuItemDO</code> instances.
164      *
165      * @hibernate.set
166      * sort="com.ivata.groupware.navigation.menu.item.MenuItemComparator"
167      * @hibernate.collection-key
168      * column="menu"
169      * @hibernate.collection-one-to-many
170      * class="com.ivata.groupware.navigation.menu.item.MenuItemDO"
171      */

172     public final Set JavaDoc getItems() {
173         return items;
174     }
175     /**
176      * <p>Get the order in which this menu should appear, in relation to the other
177      * menus.<p>
178      *
179      * @return the order in which this menu should appear, in relation
180      * to the other menus. Lower values of this number will appear lower in the
181      * Set of menus (and are therefore more significant).
182      * @hibernate.property
183      */

184     public final Integer JavaDoc getPriority() {
185         return priority;
186     }
187
188     /**
189      * <p>Get the text or caption which should appear on this menu.</p>
190      *
191      * @return the text or caption which should appear on this menu
192      * @hibernate.property
193      */

194     public final String JavaDoc getText() {
195         return text;
196     }
197
198     /**
199      * <p>Set all the menu items under this menu.</p>
200      *
201      * @param items all items in this menu as a <code>Collection</code> of
202      * <code>MenuItemDO</code> instances.
203      */

204     public final void setItems(final Set JavaDoc items) {
205         this.items = items;
206     }
207     /**
208      * <p>Set the order in which this menu should appear, in relation to the other
209      * menus.<p>
210      *
211      * @param priority the order in which this menu should appear, in relation
212      * to the other menus. Lower values of this number will appear lower in the
213      * list of menus (and are therefore more significant).
214      */

215     public final void setPriority(final Integer JavaDoc priority) {
216         this.priority = priority;
217     }
218
219     /**
220      * <p>Set the text or caption which should appear on this menu.</p>
221      *
222      * @param text the text or caption which should appear on this menu
223      */

224     public final void setText(final String JavaDoc text) {
225         this.text = text;
226     }
227
228 }
229
Popular Tags