KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > ivata > groupware > admin > setting > struts > SettingForm


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: SettingForm.java,v $
31  * Revision 1.3 2005/04/10 19:46:46 colinmacleod
32  * Changed i tag to em and b tag to strong.
33  *
34  * Revision 1.2 2005/04/09 17:19:05 colinmacleod
35  * Changed copyright text to GPL v2 explicitly.
36  *
37  * Revision 1.1.1.1 2005/03/10 17:50:43 colinmacleod
38  * Restructured ivata op around Hibernate/PicoContainer.
39  * Renamed ivata groupware.
40  *
41  * Revision 1.8 2004/12/23 21:01:25 colinmacleod
42  * Updated Struts to v1.2.4.
43  * Changed base classes to use ivata masks.
44  *
45  * Revision 1.7 2004/11/12 18:19:13 colinmacleod
46  * Change action and form classes to extend MaskAction, MaskForm respectively.
47  *
48  * Revision 1.6 2004/11/12 15:56:47 colinmacleod
49  * Removed dependencies on SSLEXT.
50  * Moved Persistence classes to ivata masks.
51  *
52  * Revision 1.5 2004/07/13 19:41:12 colinmacleod
53  * Moved project to POJOs from EJBs.
54  * Applied PicoContainer to services layer (replacing session EJBs).
55  * Applied Hibernate to persistence layer (replacing entity EJBs).
56  *
57  * Revision 1.4 2004/03/21 21:16:05 colinmacleod
58  * Shortened name to ivata op.
59  *
60  * Revision 1.3 2004/02/10 19:57:21 colinmacleod
61  * Changed email address.
62  *
63  * Revision 1.2 2004/02/01 22:00:32 colinmacleod
64  * Added full names to author tags
65  *
66  * Revision 1.1.1.1 2004/01/27 20:57:47 colinmacleod
67  * Moved ivata openportal to SourceForge..
68  *
69  * Revision 1.5 2004/01/12 13:59:40 jano
70  * fixing bugs
71  *
72  * Revision 1.4 2003/11/13 16:03:15 jano
73  * commitng everything to CVS
74  * can deploy and application is ruuning, can login into
75  *
76  * Revision 1.3 2003/10/17 12:36:12 jano
77  * fixing problems with building
78  * converting intranet -> portal
79  * Eclipse building
80  *
81  * Revision 1.2 2003/10/15 13:04:21 colin
82  * fixing for XDoclet
83  *
84  * Revision 1.15 2003/03/05 13:29:11 peter
85  * fixed the validation for boolean
86  *
87  * Revision 1.14 2003/03/05 11:02:23 peter
88  * added handling for setting checkboxes - boolean settings
89  *
90  * Revision 1.13 2003/03/05 07:36:44 peter
91  * fixed fieldNames in client-side validation
92  *
93  * Revision 1.12 2003/02/28 09:38:28 jano
94  * RuntimeException(e) -> IntrnetRuntimeException
95  *
96  * Revision 1.11 2003/02/24 18:56:15 colin
97  * added to admin
98  *
99  * Revision 1.10 2003/02/20 20:47:34 colin
100  * improved validation by adding ValidationField and ValidationException
101  *
102  * Revision 1.9 2003/02/19 18:20:46 peter
103  * fixed validation and input format doubling
104  *
105  * Revision 1.8 2003/02/18 17:04:42 peter
106  * fixed checkBox resetting in reset()
107  *
108  * Revision 1.7 2003/02/14 17:02:02 peter
109  * dateTime settings added
110  *
111  * Revision 1.6 2003/02/12 14:01:42 peter
112  * reset for settingOverride checkbox Map fixed
113  *
114  * Revision 1.3 2003/02/05 18:15:07 peter
115  * works on validation, and changed to Map backed form
116  * -----------------------------------------------------------------------------
117  */

118 package com.ivata.groupware.admin.setting.struts;
119
120 import java.util.Arrays JavaDoc;
121 import java.util.HashMap JavaDoc;
122 import java.util.Iterator JavaDoc;
123 import java.util.List JavaDoc;
124 import java.util.Locale JavaDoc;
125 import java.util.Map JavaDoc;
126 import java.util.ResourceBundle JavaDoc;
127 import java.util.Set JavaDoc;
128
129 import javax.servlet.http.HttpServletRequest JavaDoc;
130 import javax.servlet.http.HttpSession JavaDoc;
131
132 import org.apache.struts.Globals;
133 import org.apache.struts.action.ActionMapping;
134
135 import com.ivata.groupware.admin.security.server.SecuritySession;
136 import com.ivata.groupware.admin.setting.SettingConstants;
137 import com.ivata.groupware.admin.setting.Settings;
138 import com.ivata.mask.Mask;
139 import com.ivata.mask.util.StringHandling;
140 import com.ivata.mask.util.SystemException;
141 import com.ivata.mask.validation.ValidationError;
142 import com.ivata.mask.validation.ValidationErrors;
143 import com.ivata.mask.web.struts.DialogForm;
144
145
146 /**
147  * <p>The form used to input/display data in
148  * preferences (setting/index.jsp) </p>
149  *
150  * @since 2003-01-29
151  * @author Peter Illes
152  * @version $Revision: 1.3 $
153  */

154 public class SettingForm extends DialogForm {
155     /**
156      * <p>when not null or non-empty string, the current user can change
157      * system settings</p>
158      */

159     private String JavaDoc administrator;
160     /**
161      * <p>holds the values of the visible fields in tabs of
162      * <code>/setting/index.jsp</code>, but it's only used because <strong>HTML
163      * tags</strong> have the <code>property<code> property mandatory</p>
164      */

165     private Map JavaDoc setting;
166     /**
167      * <p>The area where the settings change takes place: "user" or
168      * "system"</p>
169      */

170     private String JavaDoc settingArea;
171     /**
172      * <p>this map holds the override information for for all settings
173      * stored in <code>settingUser</code> and <code>settingSystem</code>
174      * as
175      * boolean, it's only used when a user with rights to change system
176      * settings is the current user. An element with the key setting name
177      * has value <code>true</code> if users can override it....</p>
178      */

179     private Map JavaDoc settingOverride;
180     /**
181      * <p>
182      * ivata settings implementation - used in validation.
183      * </p>
184      */

185     private Settings settings;
186     /**
187      * <p>holds the values of the system settings</p>
188      */

189     private Map JavaDoc settingSystem;
190
191     /**
192      * <p>stores the active tab</p>
193      */

194     private Integer JavaDoc settingTab_activeTab;
195     /**
196      * <p>stores the names of system settings for individual tabs as
197      * <code>List</code>s of <code>String</code>s.</p>
198      */

199     private List JavaDoc settingTabSystem;
200     /**
201      * <p>stores the names of user settings for individual tabs as
202      * <code>List</code>s of <code>String</code>s.</p>
203      */

204     private List JavaDoc settingTabUser;
205     /**
206      * <p>this map holds the types for all settings stored in
207      * <code>settingUser</code> and <code>settingSystem</code></p>
208      */

209     private Map JavaDoc settingType;
210     /**
211      * <p>holds the values of the user settings</p>
212      */

213     private Map JavaDoc settingUser;
214     /**
215      * <p>holds the list of tab names, the list of tabs shown varies
216      * because of user rights</p>
217      */

218     private List JavaDoc tabName;
219     /**
220      * <p>
221      * Defines the base class of all objects in the value object list.
222      * </p>
223      */

224     private Class JavaDoc baseClass;
225     /**
226      * <p>
227      * Mask containing all the field definitions for this list.
228      * </p>
229      */

230     private Mask mask;
231
232     /**
233      * <p>
234      * Construct a valid setting form.
235      * </p>
236      *
237      * @param maskParam Refer to {@link DialogForm#DialogForm}.
238      * @param baseClassParam Refer to {@link DialogForm#DialogForm}.
239      * @param settings ivata settings implementation - used in validation.
240      */

241     public SettingForm(final Mask maskParam,
242             final Class JavaDoc baseClassParam,
243             final Settings settings) {
244         this.settings = settings;
245         clear();
246     }
247
248     /**
249      * TODO
250      *
251      * @see com.ivata.mask.web.struts.MaskForm#clear()
252      */

253     protected void clear() {
254         administrator = null;
255         setting = new HashMap JavaDoc();
256         settingArea = "user";
257         settingOverride = new HashMap JavaDoc();
258         settingSystem = new HashMap JavaDoc();
259         settingTab_activeTab = null;
260         settingTabSystem = null;
261         settingTabUser = null;
262         settingType = new HashMap JavaDoc();
263         settingUser = new HashMap JavaDoc();
264         tabName = null;
265     }
266
267     /**
268      * <p>gets the administrator flag, that is when not null or non-empty
269      * string, the current user can change system settings</p>
270      * @return when not null or non-empty string, the current user can
271      * change system settings
272      */

273     public final String JavaDoc getAdministrator() {
274         return administrator;
275     }
276
277     /**
278      * <p>always returns empty string</p>
279      * @param key the name of the setting
280      * @return empty string
281      */

282     public final String JavaDoc getSetting(final String JavaDoc key) {
283         return "";
284     }
285
286     /**
287      * <p>Gets the area where the settings change takes place: "user" or
288      * "system"</p>
289      * @return "system" or "user"
290      */

291     public final String JavaDoc getSettingArea() {
292         return settingArea;
293     }
294
295     /**
296      * <p>returns the names of all settings from the setting form as a
297      * <code>Set</code>. The set may vary because of user rights and the
298      * fact that some settings can be disabled (locked).</p>
299      * @return names of settings
300      */

301     public final Set JavaDoc getSettingName() {
302         return settingType.keySet();
303     }
304
305     /**
306      * <p>returns the override status for a setting, only used when the
307      * current user has rights to change system settings</p>
308      * @param key the name of the setting
309      * @return <code>true</code> when this setting can be overriden by
310      * users, <code>false</code> otherwise
311      */

312     public final boolean getSettingOverride(final String JavaDoc key) {
313         return ((Boolean JavaDoc) settingOverride.get(key)).booleanValue();
314     }
315
316     /**
317      * <p>returns a value of the system settings</p>
318      * @param key the name of the setting
319      * @return the value of the setting
320      */

321     public final Object JavaDoc getSettingSystem(final String JavaDoc key) {
322         return settingSystem.get(key);
323     }
324
325     /**
326      * <p>getter for the active tab field</p>
327      * @return the id of the active tab as <code>Integer</code>
328      */

329     public final Integer JavaDoc getSettingTab_activeTab() {
330         return settingTab_activeTab;
331     }
332
333     /**
334      * <p>stores the names of system settings for individual tabs as
335      * <code>List</code>s of <code>String</code>s.</p>
336      *
337      * @return the current value of settingTabSystem.
338      */

339     public List JavaDoc getSettingTabSystem() {
340         return settingTabSystem;
341     }
342
343     /**
344      * <p>returns the system setting names for the current tab as comma
345      * separated string with quotes (used for javascript array
346      * definition)</p>
347      * @return comma separated string with quotes (used for javascript
348      * array definition)
349      */

350     public final String JavaDoc getSettingTabSystemFields() {
351         String JavaDoc returnString = "";
352
353         for (Iterator JavaDoc i =
354                 ((List JavaDoc) settingTabSystem.get(settingTab_activeTab.intValue())).iterator();
355             i.hasNext();) {
356             returnString += ("'" + (String JavaDoc) i.next() + "'");
357             if (i.hasNext()) {
358                 returnString += ",";
359             }
360         }
361         return returnString;
362     }
363
364     /**
365      * <p>stores the names of user settings for individual tabs as
366      * <code>List</code>s of <code>String</code>s.</p>
367      *
368      * @return the current value of settingTabUser.
369      */

370     public List JavaDoc getSettingTabUser() {
371         return settingTabUser;
372     }
373
374     /**
375      * <p>returns the user setting names for the current tab as comma
376      * separated string with quotes (used for javascript array
377      * definition)</p>
378      * @return comma separated string with quotes (used for javascript
379      * array definition)
380      */

381     public final String JavaDoc getSettingTabUserFields() {
382         String JavaDoc returnString = "";
383
384         for (Iterator JavaDoc i =
385                 ((List JavaDoc) settingTabUser.get(settingTab_activeTab.intValue())).iterator();
386             i.hasNext();) {
387             returnString += ("'" + (String JavaDoc) i.next() + "'");
388             if (i.hasNext()) {
389                 returnString += ",";
390             }
391         }
392         return returnString;
393     }
394
395     /**
396      * <p>returns the type for one of the settings</p>
397      * @param key the name of the setting
398      * @return the type of the setting as <code>SettingConstants</code>
399      */

400     public final Integer JavaDoc getSettingType(final String JavaDoc key) {
401         return (Integer JavaDoc) settingType.get(key);
402     }
403
404     /**
405      * <p>returns a value of the user settings</p>
406      * @param key the name of the setting
407      * @return the value of the setting
408      */

409     public final Object JavaDoc getSettingUser(final String JavaDoc key) {
410         return settingUser.get(key);
411     }
412
413     /**
414      * <p>returns the names of the displayed tabs</p>
415      * @return the names of displayed tabs as <code>List</code> of
416      * <code>String</code>s
417      */

418     public List JavaDoc getTabName() {
419         return tabName;
420     }
421
422     /**
423      * <p>Reset appopriate bean properties to their default state. This
424      * method
425      * is called before the properties are repopulated by the controller
426      * servlet.</p>
427      *
428      * @param mapping The mapping used to select this instance
429      * @param request The servlet request we are processing
430      *
431      */

432     public void reset(final ActionMapping mapping,
433             final HttpServletRequest JavaDoc request) {
434
435         if (settingTab_activeTab!=null) {
436
437             // reset the override checkboxes from the last tab to <code>false</code>
438
// because they're specific, only the 'succesful' ones are set
439
int activeTab = settingTab_activeTab.intValue();
440             for (Iterator JavaDoc i = ((List JavaDoc) getSettingTabSystem().get(activeTab)).iterator();
441                     i.hasNext();) {
442                 String JavaDoc currentKey = (String JavaDoc) i.next();
443                 settingOverride.put(currentKey, new Boolean JavaDoc(false));
444             }
445             for (Iterator JavaDoc i = ((List JavaDoc) getSettingTabUser().get(activeTab)).iterator();
446                     i.hasNext();) {
447                 String JavaDoc currentKey = (String JavaDoc) i.next();
448                 settingOverride.put(currentKey, new Boolean JavaDoc(false));
449             }
450             // reset the checkboxes on email tab
451
if (((String JavaDoc) tabName.get(activeTab)).equals("email")) {
452                 if (settingType.containsKey("emailSignatureForward")) {
453                    settingUser.put("emailSignatureForward","false");
454                    settingSystem.put("emailSignatureForward","false");
455                 }
456                 if (settingType.containsKey("emailSignatureReply")) {
457                    settingUser.put("emailSignatureReply","false");
458                    settingSystem.put("emailSignatureReply","false");
459                 }
460             }
461         }
462
463         // buttons
464
setApply(null);
465         setOk(null);
466
467     }
468
469     /**
470      * <p>sets the administrator flag, that is when not null or non-empty
471      * string, the current user can change system settings</p>
472      * @param administrator when not null or non-empty string, the
473      * current user can change system settings
474      */

475     public final void setAdministrator(final String JavaDoc administrator) {
476         this.administrator = administrator;
477     }
478
479     /**
480      * <p>sets the last value from the visible field of a setting, but
481      * this value is not used, {@see getSetting(String) </p>
482      * @param key the name of the setting
483      * @param the value of the visible field of a setting
484      */

485     public final void setSetting(final String JavaDoc key,
486             final String JavaDoc value) {
487     }
488
489     /**
490      * <p>Sets the area where the settings change takes place: "user" or
491      * "system"</p>
492      * @param settingArea
493      */

494     public final void setSettingArea(final String JavaDoc settingArea) {
495         this.settingArea = settingArea;
496     }
497
498     /**
499      * <p>sets the override status for a setting, only used when the
500      * current user has rights to change system settings</p>
501      * @param key the name of the setting
502      * @param overridable <code>true</code> when this setting can be
503      * overriden by users, <code>false</code> otherwise
504      */

505     public final void setSettingOverride(final String JavaDoc key,
506             final boolean overridable) {
507         settingOverride.put(key, new Boolean JavaDoc(overridable));
508     }
509
510     /**
511      * <p>sets a value of the system settings</p>
512      * @param key the name of the setting
513      * @param value the value of the setting
514      */

515     public final void setSettingSystem(final String JavaDoc key,
516             final Object JavaDoc value) {
517         if ((key.equals("emailSignatureReply") || key.equals("emailSignatureForward"))
518                 && !(value instanceof Boolean JavaDoc)
519                 && StringHandling.isNullOrEmpty((String JavaDoc) value)) {
520             return;
521         } else {
522             settingSystem.put(key, value);
523         }
524     }
525
526     /**
527      * <p>setter for the active tab field</p>
528      * @param settingTab_activeTab the id of the active tab as
529      * <code>Integer</code>
530      */

531     public final void setSettingTab_activeTab(final Integer JavaDoc settingTab_activeTab) {
532         this.settingTab_activeTab = settingTab_activeTab;
533     }
534
535     /**
536      * <p>stores the names of system settings for individual tabs as
537      * <code>List</code>s of <code>String</code>s.</p>
538      *
539      * @param settingTabSystem the new value of settingTabSystem.
540      */

541     public final void setSettingTabSystem(final List JavaDoc settingTabSystem) {
542         this.settingTabSystem = settingTabSystem;
543     }
544
545     /**
546      * <p>stores the names of user settings for individual tabs as
547      * <code>List</code>s of <code>String</code>s.</p>
548      *
549      * @param settingTabUser the new value of settingTabUser.
550      */

551     public final void setSettingTabUser(final List JavaDoc settingTabUser) {
552         this.settingTabUser = settingTabUser;
553     }
554
555     /**
556      * <p>sets the type of a settings</p>
557      * @param key the name of the setting
558      * @param type the type of the setting
559      */

560     public final void setSettingType(final String JavaDoc key,
561             final Integer JavaDoc type) {
562         settingType.put(key, type);
563     }
564
565     /**
566      * <p>sets a value of the user settings</p>
567      * @param key the name of the setting
568      * @param value the value of the setting
569      */

570     public final void setSettingUser(final String JavaDoc key,
571             final Object JavaDoc value) {
572         if ((key.equals("emailSignatureReply") || key.equals("emailSignatureForward"))
573                 && !(value instanceof Boolean JavaDoc)
574                 && StringHandling.isNullOrEmpty((String JavaDoc) value)) {
575             return;
576         } else {
577             settingUser.put(key, value);
578         }
579     }
580
581     /**
582      * <p>sets the names of the tabs to display</p>
583      * @param tabName <code> List of tab names
584      */

585     public final void setTabName(final List JavaDoc tabName) {
586         this.tabName = tabName;
587     }
588
589     /**
590      * Validate the settings for correct input,
591      * and return an <code>ActionMessages</code> object that encapsulates
592      * any
593      * validation errors that have been found. If no errors are found,
594      * return <code>null</code>
595      * @param mapping The mapping used to select this instance
596      * @param request The servlet request we are processing
597      *
598      */

599     public ValidationErrors validate(final HttpServletRequest JavaDoc request,
600             final HttpSession JavaDoc session) {
601         ValidationErrors validationErrors = new ValidationErrors();
602         SecuritySession securitySession = (SecuritySession)
603             request.getSession().getAttribute("securitySession");
604
605
606         // only do the validation when ok or apply was pressed
607
if (!(getOk() == null && getApply() == null)) {
608             // we need these for server-side validation
609
// these maps will contain only the settings that were ok here
610
Map JavaDoc settingUserValidation = new HashMap JavaDoc(this.settingUser);
611             Map JavaDoc settingSystemValidation = new HashMap JavaDoc(this.settingSystem);
612
613             // setting area identification (user or system) for error messages
614
ResourceBundle JavaDoc adminBundle =
615                 ResourceBundle.getBundle("com.ivata.groupware.admin.ApplicationResources",
616                     (Locale JavaDoc) request.getSession().getAttribute(Globals.LOCALE_KEY));
617
618             String JavaDoc settingSystemArea = adminBundle.getString("setting.system");
619             String JavaDoc settingUserArea = adminBundle.getString("setting.user");
620
621             // first go through both the user and the system map and check the types
622
for (Iterator JavaDoc i = settingType.keySet().iterator(); i.hasNext();) {
623                 String JavaDoc currentKey = (String JavaDoc) i.next();
624                 String JavaDoc currentFieldName = adminBundle.getString("setting.field." + currentKey);
625                 Integer JavaDoc currentType = (Integer JavaDoc) settingType.get(currentKey);
626                 // the values are strings when they were set from request or
627
// the correct types when the user haven't submitted the appropriate
628
// tab yet
629
String JavaDoc currentUserValue = settingUser.get(currentKey).toString();
630                 String JavaDoc currentSystemValue = settingSystem.get(currentKey).toString();
631
632                 switch (currentType.intValue()) {
633                     // check and conversion to Boolean
634
case SettingConstants.DATA_TYPE_BOOLEAN:
635                         if (!(currentUserValue.equalsIgnoreCase("true") ||
636                                 currentUserValue.equalsIgnoreCase("false"))) {
637                             validationErrors.add(
638                                     new ValidationError(
639                                             "errors.setting.boolean",
640                                     Arrays.asList(new String JavaDoc[]{
641                                             settingUserArea, currentFieldName
642                                             })));
643                             settingUserValidation.remove(currentKey);
644                         } else {
645                             settingUser.put(currentKey,
646                                 new Boolean JavaDoc(currentUserValue));
647                             settingUserValidation.put(currentKey,
648                                 new Boolean JavaDoc(currentUserValue));
649                         }
650                         if (!(currentSystemValue.equalsIgnoreCase("true") ||
651                                 currentSystemValue.equalsIgnoreCase("false"))) {
652                             validationErrors.add(
653                                     new ValidationError(
654                                             "errors.setting.boolean",
655                                     Arrays.asList(new String JavaDoc[]{
656                                             settingSystemArea, currentFieldName
657                                             })));
658                             settingSystemValidation.remove(currentKey);
659                         } else {
660                             settingSystem.put(currentKey,
661                                 new Boolean JavaDoc(currentSystemValue));
662                             settingSystemValidation.put(currentKey,
663                                 new Boolean JavaDoc(currentSystemValue));
664                         }
665                         break;
666
667                     //check and conversion to Integer
668
case SettingConstants.DATA_TYPE_INTEGER:
669                         // check whether the string holds number representation
670
try {
671                             Integer.parseInt(currentUserValue);
672                             // when we're here it's ok
673
settingUser.put(currentKey, new Integer JavaDoc(currentUserValue));
674                             settingUserValidation.put(currentKey,
675                                 new Integer JavaDoc(currentUserValue));
676                         } catch (NumberFormatException JavaDoc e) {
677                             // we catched this so the string didn't contain a number
678
validationErrors.add(
679                                     new ValidationError(
680                                             "errors.setting.integer",
681                                     Arrays.asList(new String JavaDoc[]{
682                                             settingUserArea, currentFieldName
683                                             })));
684                             settingUserValidation.remove(currentKey);
685                         }
686                         try {
687                             Integer.parseInt(currentSystemValue);
688                             // when we're here it's ok
689
settingSystem.put(currentKey, new Integer JavaDoc(currentSystemValue));
690                             settingSystemValidation.put(currentKey,
691                                 new Integer JavaDoc(currentSystemValue));
692                         } catch (NumberFormatException JavaDoc e) {
693                             // we catched this so the string didn't contain a number
694
validationErrors.add(
695                                     new ValidationError(
696                                             "errors.setting.integer",
697                                     Arrays.asList(new String JavaDoc[]{
698                                             settingSystemArea, currentFieldName
699                                             })));
700                             settingSystemValidation.remove(currentKey);
701                         }
702                         break;
703
704                         // the only other type is string so far, no special validation here
705
case SettingConstants.DATA_TYPE_STRING:
706
707                         break;
708                 }
709             }
710             // we checked the types here, the real validation takes place on the
711
// server, worth to do so when there are some settings with correct
712
// types left
713
if (!(settingUserValidation.isEmpty() && settingSystemValidation.isEmpty())) {
714                 Locale JavaDoc locale = (Locale JavaDoc) session.getAttribute(Globals.LOCALE_KEY);
715                 ValidationErrors userErrors;
716                 try {
717                     userErrors = settings.validate(securitySession,
718                         settingUserValidation, locale, SettingConstants.SETTING_USER);
719                 } catch (SystemException e) {
720                     throw new RuntimeException JavaDoc(e);
721                 }
722                 validationErrors.addAll(userErrors);
723                 ValidationErrors systemErrors;
724                 try {
725                     systemErrors = settings.validate(securitySession,
726                         settingSystemValidation, locale, SettingConstants.SETTING_SYSTEM);
727                 } catch (SystemException e) {
728                     throw new RuntimeException JavaDoc(e);
729                 }
730                 validationErrors.addAll(systemErrors);
731             }
732         }
733         return validationErrors;
734     }
735
736     /**
737      * <p>
738      * Defines the base class of all objects in the value object list.
739      * </p>
740      *
741      * @return base class of all objects in the value object list.
742      */

743     public final Class JavaDoc getBaseClass() {
744         return baseClass;
745     }
746
747     /**
748      * <p>
749      * Mask containing all the field definitions for this list.
750      * </p>
751      *
752      * @return mask containing all the field definitions for this list.
753      */

754     public final Mask getMask() {
755         return mask;
756     }
757 }
758
Popular Tags