KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > ivata > groupware > admin > setting > SettingDO


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: SettingDO.java,v $
31  * Revision 1.3 2005/04/10 20:10:04 colinmacleod
32  * Added new themes.
33  * Changed id type to String.
34  * Changed i tag to em and b tag to strong.
35  * Improved PicoContainerFactory with NanoContainer scripts.
36  *
37  * Revision 1.2 2005/04/09 17:19:57 colinmacleod
38  * Changed copyright text to GPL v2 explicitly.
39  *
40  * Revision 1.1.1.1 2005/03/10 17:51:37 colinmacleod
41  * Restructured ivata op around Hibernate/PicoContainer.
42  * Renamed ivata groupware.
43  *
44  * Revision 1.1 2004/09/30 15:15:59 colinmacleod
45  * Split off addressbook elements into security subproject.
46  *
47  * Revision 1.2 2004/07/13 19:54:31 colinmacleod
48  * Moved project to POJOs from EJBs.
49  * Applied PicoContainer to services layer (replacing session EJBs).
50  * Applied Hibernate to persistence layer (replacing entity EJBs).
51  *
52  * Revision 1.3 2004/03/21 21:16:05 colinmacleod
53  * Shortened name to ivata op.
54  *
55  * Revision 1.2 2004/02/01 22:00:32 colinmacleod
56  * Added full names to author tags
57  *
58  * Revision 1.1.1.1 2004/01/27 20:57:46 colinmacleod
59  * Moved ivata openportal to SourceForge..
60  *
61  * Revision 1.6 2003/11/03 11:28:24 jano
62  * commiting addressbook,
63  * tryinjg to fix deploying problem
64  *
65  * Revision 1.5 2003/10/17 12:36:12 jano
66  * fixing problems with building
67  * converting intranet -> portal
68  * Eclipse building
69  *
70  * Revision 1.4 2003/10/16 07:40:37 jano
71  * fixing comments
72  *
73  * Revision 1.3 2003/10/15 13:13:59 jano
74  * converting to XDoclet
75  *
76  * Revision 1.2 2003/10/15 13:04:20 colin
77  * fixing for XDoclet
78  *
79  * Revision 1.4 2003/03/03 16:57:08 colin
80  * converted localization to automatic paths
81  * added labels
82  * added mandatory fieldName attribute
83  *
84  * Revision 1.3 2003/02/25 16:58:08 peter
85  * fixed bugs in create method, id and sequence name
86  *
87  * Revision 1.2 2003/02/25 14:38:12 colin
88  * implemented setModified methods on entity beans thro IvataEntityBean superclass
89  *
90  * Revision 1.1 2003/02/24 18:56:14 colin
91  * added to admin
92  *
93  * Revision 1.13 2003/02/24 09:50:39 peter
94  * the enable field is boolean now
95  *
96  * Revision 1.12 2003/02/04 17:43:50 colin
97  * copyright notice
98  *
99  * Revision 1.11 2003/02/04 08:00:28 peter
100  * modified to handle null userName booth in getSetting and setSetting
101  *
102  * Revision 1.10 2002/11/12 09:36:08 colin
103  * added ejbRemove
104  *
105  * Revision 1.9 2002/07/15 07:51:04 colin
106  * added new Mail EJB and local interface to settings
107  *
108  * Revision 1.8 2002/07/05 10:32:52 colin
109  * changes trying to move the project to jano
110  *
111  * Revision 1.6 2002/07/04 12:29:28 jano
112  * i put readonly script to CVS and i will commit all SRC directory
113  *
114  * Revision 1.5 2002/07/02 14:58:21 colin
115  * tried to fix jbuilder EJB designer
116  *
117  * Revision 1.4 2002/06/21 12:10:03 colin
118  * cosmetic changes. tidied up documentation
119  *
120  * Revision 1.3 2002/06/17 07:28:58 colin
121  * improved and extended javadoc documentation
122  * -----------------------------------------------------------------------------
123  */

124 package com.ivata.groupware.admin.setting;
125
126
127 import com.ivata.groupware.admin.security.user.UserDO;
128 import com.ivata.groupware.container.persistence.NamedDO;
129
130 /**
131  * <p>This class represents a single setting within the system. Each setting can
132  * either be global, or overridden for a single user. You can have integer,
133  * string or boolean settings. These are identified by the type constants
134  * defined in {@link SettingConstants SettingConstants}.</p>
135  *
136  * @since 2001-04-20
137  * @author Colin MacLeod
138  * <a HREF='mailto:colin.macleod@ivata.com'>colin.macleod@ivata.com</a>
139  * @version $Revision: 1.3 $
140  *
141  * @hibernate.class
142  * table="setting"
143  * @hibernate.cache
144  * usage="read-write"
145  */

146 public class SettingDO extends NamedDO {
147     /**
148      * <p>Clear text description of the purpose of the setting and what
149      * elements of the intranet system this setting affects.</p>
150      */

151     private String JavaDoc description;
152
153     /**
154      * <p>Defines whether or not this setting is currently enabled.</p>
155      */

156     private boolean enabled = true;
157
158     /**
159      * <p>Name of this setting. This is a clear text identifier which
160      * should be unique within the system. Use alphanumeric characters with no
161      * spaces.</p>
162      */

163     private String JavaDoc name;
164
165     /**
166      * <p>Type of the settting. This can be any of the 'TYPE_...'
167      * constants defined in {@link SettingConstant SettingConstant}.</p>
168      */

169     private int type;
170
171     /**
172      * <p>User this setting applies to, or <code>null</code> if it is
173      * the default setting.</p>
174      */

175     private UserDO user;
176
177     /**
178      * <p>Value of the setting. Whilst all settings are stored as
179      * strings, the content should represent the type of the setting so that
180      * integer types will only contain numeric strings, and boolean types will
181      * only contain 'true' or 'false'.</p>
182      */

183     private String JavaDoc value;
184     /**
185      * <p>Get a clear text description of the purpose of the setting and what
186      * elements of the intranet system this setting affects.</p>
187      *
188      * @return a clear text description of the purpose of the setting and what
189      * elements of the intranet system this setting affects.
190      *
191      * @hibernate.property
192      */

193     public final String JavaDoc getDescription() {
194         return description;
195     }
196     /**
197      * <p>Get the name of this setting. This is a clear text identifier which
198      * should be unique within the system. Use alphanumeric characters with no
199      * spaces.</p>
200      *
201      * @return the name of the setting, a clear text identifier.
202      *
203      * @hibernate.property
204      */

205     public final String JavaDoc getName() {
206         return name;
207     }
208     /**
209      * <p>Get the type of the settting. This can be any of the 'TYPE_...'
210      * constants defined in {@link SettingConstant SettingConstant}.</p>
211      *
212      * @return the type of the settting, one of the 'TYPE_...' constants defined
213      * in {@link SettingConstant SettingConstant}.
214      *
215      * @hibernate.property
216      */

217     public final int getType() {
218         return type;
219     }
220
221     /**
222      * <p>Get the user this setting applies to, or <code>null</code> if it is
223      * the default setting.</p>
224      *
225      * @return the user this setting applies to, or <code>null</code> if it is
226      * the default setting.
227      *
228      * @hibernate.many-to-one
229      * column="person_user"
230      */

231     public UserDO getUser() {
232         return user;
233     }
234     /**
235      * <p>Get the value of the setting. Whilst all settings are stored as
236      * strings, the content should represent the type of the setting so that
237      * integer types will only contain numeric strings, and boolean types will
238      * only contain 'true' or 'false'.</p>
239      *
240      * @return the value of the setting.
241      *
242      * @hibernate.property
243      */

244     public final String JavaDoc getValue() {
245         return value;
246     }
247     /**
248      * <p>Get whether or not this setting is currently enabled.</p>
249      *
250      * @return <code>true</code> if the setting may be used currently, otherwise
251      * <code>false</code>.
252      *
253      * @hibernate.property
254      * column="enable"
255      */

256     public boolean isEnabled() {
257         return enabled;
258     }
259
260     /**
261      * <p>Set a clear text description of the purpose of the setting and what
262      * elements of the intranet system this setting affects.</p>
263      *
264      * @param description a clear text description of the purpose of the setting
265      * and what elements of the intranet system this setting affects.
266      */

267     public final void setDescription(final String JavaDoc description) {
268         this.description = description;
269     }
270
271     /**
272      * <p>Set this setting to be currently enabled.</p>
273      *
274      * @param enable <code>true</code> if the setting may be used currently,
275      * otherwise <code>false</code>.
276      */

277     public final void setEnabled(final boolean enabled) {
278         this.enabled = enabled;
279     }
280
281     /**
282      * <p>Set the name of this setting. This is a clear text identifier which
283      * should be unique within the system. Use alphanumeric characters with no
284      * spaces.</p>
285      *
286      * @param name the name of the setting, a clear text identifier.
287      */

288     public final void setName(final String JavaDoc name) {
289         this.name = name;
290     }
291
292     /**
293      * <p>Set the type of the setting. This can be any of the 'TYPE_...'
294      * constants defined in {@link SettingConstant SettingConstant}.</p>
295      *
296      * @param type the type of the settting, one of the 'TYPE_...' constants
297      * defined in {@link SettingConstant SettingConstant}.
298      */

299     public final void setType(final int type) {
300         this.type = type;
301     }
302
303     /**
304      * <p>Set the user this setting applies to, or <code>null</code> if it is
305      * the default setting.</p>
306      *
307      * @param user the user this setting applies to, or <code>null</code> if it
308      * is the default setting.
309      */

310     public final void setUser(final UserDO user) {
311         this.user = user;
312     }
313
314     /**
315      * <p>Set the value of the setting. Whilst all settings are stored as
316      * strings, the content should represent the type of the setting so that
317      * integer types will only contain numeric strings, and boolean types will
318      * only contain 'true' or 'false'.</p>
319      *
320      * @param value the value of the setting.
321      */

322     public final void setValue(final String JavaDoc value) {
323         this.value = value;
324     }
325 }
Popular Tags