Source Code Cross Referenced for SettingDO.java in  » Groupware » ivatagroupware » com » ivata » groupware » admin » setting » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Groupware » ivatagroupware » com.ivata.groupware.admin.setting 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


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: SettingDO.java,v $
031:         * Revision 1.2  2005/10/02 14:08:59  colinmacleod
032:         * Added/improved log4j logging.
033:         *
034:         * Revision 1.1  2005/09/29 13:06:05  colinmacleod
035:         * First version of setting subproject.
036:         * Existing classes restructured, new setting user interface created.
037:         * Flexible XML UI configuration makes it easy to reuse the same web pages in
038:         * other projects.
039:         * Web files work as stand-alone webapp for testing.
040:         *
041:         * Revision 1.4  2005/09/14 16:10:22  colinmacleod
042:         * Removed unused local and class variables.
043:         * Added serialVersionUID.
044:         *
045:         * Revision 1.3  2005/04/10 20:10:04  colinmacleod
046:         * Added new themes.
047:         * Changed id type to String.
048:         * Changed i tag to em and b tag to strong.
049:         * Improved PicoContainerFactory with NanoContainer scripts.
050:         *
051:         * Revision 1.2  2005/04/09 17:19:57  colinmacleod
052:         * Changed copyright text to GPL v2 explicitly.
053:         *
054:         * Revision 1.1.1.1  2005/03/10 17:51:37  colinmacleod
055:         * Restructured ivata op around Hibernate/PicoContainer.
056:         * Renamed ivata groupware.
057:         *
058:         * Revision 1.1  2004/09/30 15:15:59  colinmacleod
059:         * Split off addressbook elements into security subproject.
060:         *
061:         * Revision 1.2  2004/07/13 19:54:31  colinmacleod
062:         * Moved project to POJOs from EJBs.
063:         * Applied PicoContainer to services layer (replacing session EJBs).
064:         * Applied Hibernate to persistence layer (replacing entity EJBs).
065:         *
066:         * Revision 1.3  2004/03/21 21:16:05  colinmacleod
067:         * Shortened name to ivata op.
068:         *
069:         * Revision 1.2  2004/02/01 22:00:32  colinmacleod
070:         * Added full names to author tags
071:         *
072:         * Revision 1.1.1.1  2004/01/27 20:57:46  colinmacleod
073:         * Moved ivata openportal to SourceForge..
074:         *
075:         * Revision 1.6  2003/11/03 11:28:24  jano
076:         * commiting addressbook,
077:         * tryinjg to fix deploying problem
078:         *
079:         * Revision 1.5  2003/10/17 12:36:12  jano
080:         * fixing problems with building
081:         * converting intranet -> portal
082:         * Eclipse building
083:         *
084:         * Revision 1.4  2003/10/16 07:40:37  jano
085:         * fixing comments
086:         *
087:         * Revision 1.3  2003/10/15 13:13:59  jano
088:         * converting to XDoclet
089:         *
090:         * Revision 1.2  2003/10/15 13:04:20  colin
091:         * fixing for XDoclet
092:         *
093:         * Revision 1.4  2003/03/03 16:57:08  colin
094:         * converted localization to automatic paths
095:         * added labels
096:         * added mandatory fieldName attribute
097:         *
098:         * Revision 1.3  2003/02/25 16:58:08  peter
099:         * fixed bugs in create method, id and sequence name
100:         *
101:         * Revision 1.2  2003/02/25 14:38:12  colin
102:         * implemented setModified methods on entity beans thro IvataEntityBean superclass
103:         *
104:         * Revision 1.1  2003/02/24 18:56:14  colin
105:         * added to admin
106:         *
107:         * Revision 1.13  2003/02/24 09:50:39  peter
108:         * the enable field is boolean now
109:         *
110:         * Revision 1.12  2003/02/04 17:43:50  colin
111:         * copyright notice
112:         *
113:         * Revision 1.11  2003/02/04 08:00:28  peter
114:         * modified to handle null userName booth in getSetting and setSetting
115:         *
116:         * Revision 1.10  2002/11/12 09:36:08  colin
117:         * added ejbRemove
118:         *
119:         * Revision 1.9  2002/07/15 07:51:04  colin
120:         * added new Mail EJB and local interface to settings
121:         *
122:         * Revision 1.8  2002/07/05 10:32:52  colin
123:         * changes trying to move the project to jano
124:         *
125:         * Revision 1.6  2002/07/04 12:29:28  jano
126:         * i put readonly script to CVS and i will commit all SRC directory
127:         *
128:         * Revision 1.5  2002/07/02 14:58:21  colin
129:         * tried to fix jbuilder EJB designer
130:         *
131:         * Revision 1.4  2002/06/21 12:10:03  colin
132:         * cosmetic changes. tidied up documentation
133:         *
134:         * Revision 1.3  2002/06/17 07:28:58  colin
135:         * improved and extended javadoc documentation
136:         * -----------------------------------------------------------------------------
137:         */
138:        package com.ivata.groupware.admin.setting;
139:
140:        import org.apache.log4j.Logger;
141:
142:        import com.ivata.groupware.admin.security.user.UserDO;
143:        import com.ivata.groupware.container.persistence.AuthorTimestampNamedDO;
144:
145:        /**
146:         * <p>This class represents a single setting within the system. Each setting can
147:         * either be global, or overridden for a single user. You can have integer,
148:         * string or boolean settings. These are identified by the type constants
149:         * defined in {@link SettingConstants SettingConstants}.</p>
150:         *
151:         * @since 2001-04-20
152:         * @author Colin MacLeod
153:         * <a href='mailto:colin.macleod@ivata.com'>colin.macleod@ivata.com</a>
154:         * @version $Revision: 1.2 $
155:         *
156:         * @hibernate.class
157:         *      table="setting"
158:         * @hibernate.cache
159:         *      usage="read-write"
160:         */
161:        public class SettingDO extends AuthorTimestampNamedDO {
162:            /**
163:             * Logger for this class.
164:             */
165:            private static final Logger logger = Logger
166:                    .getLogger(SettingDO.class);
167:
168:            /**
169:             * Serialization version (for <code>Serializable</code> interface).
170:             */
171:            private static final long serialVersionUID = 1L;
172:
173:            /**
174:             * <p>Defines whether or not this setting is currently enabled.</p>
175:             */
176:            private boolean enabled = true;
177:
178:            /**
179:             * <p>Name of this setting. This is a clear text identifier which
180:             * should be unique within the system. Use alphanumeric characters with no
181:             * spaces.</p>
182:             */
183:            private String name;
184:
185:            /**
186:             * <p>Type of the settting. This can be any of the 'TYPE_...'
187:             * constants defined in {@link SettingConstant SettingConstant}.</p>
188:             */
189:            private int type;
190:
191:            /**
192:             * <p>User this setting applies to, or <code>null</code> if it is
193:             * the default setting.</p>
194:             */
195:            private UserDO user;
196:
197:            /**
198:             * <p>Value of the setting. Whilst all settings are stored as
199:             * strings, the content should represent the type of the setting so that
200:             * integer types will only contain numeric strings, and boolean types will
201:             * only contain 'true' or 'false'.</p>
202:             */
203:            private String value;
204:
205:            /**
206:             * <p>Get the name of this setting. This is a clear text identifier which
207:             * should be unique within the system. Use alphanumeric characters with no
208:             * spaces.</p>
209:             *
210:             * @return the name of the setting, a clear text identifier.
211:             *
212:             * @hibernate.property
213:             */
214:            public final String getName() {
215:                if (logger.isDebugEnabled()) {
216:                    logger.debug("getName() - start");
217:                }
218:
219:                if (logger.isDebugEnabled()) {
220:                    logger.debug("getName() - end - return value = " + name);
221:                }
222:                return name;
223:            }
224:
225:            /**
226:             * <p>Get the type of the settting. This can be any of the 'TYPE_...'
227:             * constants defined in {@link SettingConstant SettingConstant}.</p>
228:             *
229:             * @return the type of the settting, one of the 'TYPE_...' constants defined
230:             *      in {@link SettingConstant SettingConstant}.
231:             *
232:             * @hibernate.property
233:             */
234:            public final int getType() {
235:                if (logger.isDebugEnabled()) {
236:                    logger.debug("getType() - start");
237:                }
238:
239:                if (logger.isDebugEnabled()) {
240:                    logger.debug("getType() - end - return value = " + type);
241:                }
242:                return type;
243:            }
244:
245:            /**
246:             * <p>Get the user this setting applies to, or <code>null</code> if it is
247:             * the default setting.</p>
248:             *
249:             * @return the user this setting applies to, or <code>null</code> if it is
250:             *     the default setting.
251:             *
252:             * @hibernate.many-to-one
253:             *      column="person_user"
254:             */
255:            public UserDO getUser() {
256:                if (logger.isDebugEnabled()) {
257:                    logger.debug("getUser() - start");
258:                }
259:
260:                if (logger.isDebugEnabled()) {
261:                    logger.debug("getUser() - end - return value = " + user);
262:                }
263:                return user;
264:            }
265:
266:            /**
267:             * <p>Get the value of the setting. Whilst all settings are stored as
268:             * strings, the content should represent the type of the setting so that
269:             * integer types will only contain numeric strings, and boolean types will
270:             * only contain 'true' or 'false'.</p>
271:             *
272:             * @return the value of the setting.
273:             *
274:             * @hibernate.property
275:             */
276:            public final String getValue() {
277:                if (logger.isDebugEnabled()) {
278:                    logger.debug("getValue() - start");
279:                }
280:
281:                if (logger.isDebugEnabled()) {
282:                    logger.debug("getValue() - end - return value = " + value);
283:                }
284:                return value;
285:            }
286:
287:            /**
288:             * <p>Get whether or not this setting is currently enabled.</p>
289:             *
290:             * @return <code>true</code> if the setting may be used currently, otherwise
291:             *      <code>false</code>.
292:             *
293:             * @hibernate.property
294:             *      column="enable"
295:             */
296:            public boolean isEnabled() {
297:                if (logger.isDebugEnabled()) {
298:                    logger.debug("isEnabled() - start");
299:                }
300:
301:                if (logger.isDebugEnabled()) {
302:                    logger.debug("isEnabled() - end - return value = "
303:                            + enabled);
304:                }
305:                return enabled;
306:            }
307:
308:            /**
309:             * <p>Set this setting to be currently enabled.</p>
310:             *
311:             * @param enable <code>true</code> if the setting may be used currently,
312:             *     otherwise <code>false</code>.
313:             */
314:            public final void setEnabled(final boolean enabled) {
315:                if (logger.isDebugEnabled()) {
316:                    logger.debug("setEnabled(boolean enabled = " + enabled
317:                            + ") - start");
318:                }
319:
320:                checkSetter();
321:                this .enabled = enabled;
322:
323:                if (logger.isDebugEnabled()) {
324:                    logger.debug("setEnabled(boolean) - end");
325:                }
326:            }
327:
328:            /**
329:             * <p>Set the name of this setting. This is a clear text identifier which
330:             * should be unique within the system. Use alphanumeric characters with no
331:             * spaces.</p>
332:             *
333:             * @param name the name of the setting, a clear text identifier.
334:             */
335:            public final void setName(final String name) {
336:                if (logger.isDebugEnabled()) {
337:                    logger.debug("setName(String name = " + name + ") - start");
338:                }
339:
340:                checkSetter();
341:                this .name = name;
342:
343:                if (logger.isDebugEnabled()) {
344:                    logger.debug("setName(String) - end");
345:                }
346:            }
347:
348:            /**
349:             * <p>Set the type of the setting. This can be any of the 'TYPE_...'
350:             * constants defined in {@link SettingConstant SettingConstant}.</p>
351:             *
352:             * @param type the type of the settting, one of the 'TYPE_...' constants
353:             *     defined in {@link SettingConstant SettingConstant}.
354:             */
355:            public final void setType(final int type) {
356:                if (logger.isDebugEnabled()) {
357:                    logger.debug("setType(int type = " + type + ") - start");
358:                }
359:
360:                checkSetter();
361:                this .type = type;
362:
363:                if (logger.isDebugEnabled()) {
364:                    logger.debug("setType(int) - end");
365:                }
366:            }
367:
368:            /**
369:             * <p>Set the user this setting applies to, or <code>null</code> if it is
370:             * the default setting.</p>
371:             *
372:             * @param user the user this setting applies to, or <code>null</code> if it
373:             *     is the default setting.
374:             */
375:            public final void setUser(final UserDO user) {
376:                if (logger.isDebugEnabled()) {
377:                    logger.debug("setUser(UserDO user = " + user + ") - start");
378:                }
379:
380:                checkSetter();
381:                this .user = user;
382:
383:                if (logger.isDebugEnabled()) {
384:                    logger.debug("setUser(UserDO) - end");
385:                }
386:            }
387:
388:            /**
389:             * <p>Set the value of the setting. Whilst all settings are stored as
390:             * strings, the content should represent the type of the setting so that
391:             * integer types will only contain numeric strings, and boolean types will
392:             * only contain 'true' or 'false'.</p>
393:             *
394:             * @param value the value of the setting.
395:             */
396:            public final void setValue(final String value) {
397:                if (logger.isDebugEnabled()) {
398:                    logger.debug("setValue(String value = " + value
399:                            + ") - start");
400:                }
401:
402:                checkSetter();
403:                this .value = value;
404:
405:                if (logger.isDebugEnabled()) {
406:                    logger.debug("setValue(String) - end");
407:                }
408:            }
409:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.