KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > roller > ui > authoring > struts > formbeans > RollerConfigFormEx


1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. The ASF licenses this file to You
4 * under the Apache License, Version 2.0 (the "License"); you may not
5 * use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License. For additional information regarding
15 * copyright in this work, please see the NOTICE file in the top level
16 * directory of this distribution.
17 */

18
19 package org.apache.roller.ui.authoring.struts.formbeans;
20
21 import javax.servlet.http.HttpServletRequest JavaDoc;
22
23 import org.apache.struts.action.ActionMapping;
24 import org.apache.roller.RollerException;
25 import org.apache.roller.pojos.RollerConfigData;
26 import org.apache.roller.ui.authoring.struts.forms.RollerConfigForm;
27
28 /**
29  * These properties are not persistent and are only needed for the UI.
30  *
31  * @struts.form name="rollerConfigFormEx"
32  * @author Lance Lavandowska
33  */

34 public class RollerConfigFormEx extends RollerConfigForm
35 {
36     public RollerConfigFormEx()
37     {
38     }
39
40     public RollerConfigFormEx( RollerConfigData config, java.util.Locale JavaDoc locale ) throws RollerException
41     {
42         super(config, locale);
43     }
44
45     /**
46      * Override for non-primitive values
47      */

48     public void copyFrom(org.apache.roller.pojos.RollerConfigData dataHolder, java.util.Locale JavaDoc locale) throws RollerException
49     {
50         super.copyFrom(dataHolder, locale);
51         fixNulls();
52         this.uploadMaxFileMB = dataHolder.getUploadMaxFileMB();
53         this.uploadMaxDirMB = dataHolder.getUploadMaxDirMB();
54     }
55
56     /**
57      * Override for non-primitive values
58      */

59     public void copyTo(org.apache.roller.pojos.RollerConfigData dataHolder, java.util.Locale JavaDoc locale) throws RollerException
60     {
61         fixNulls();
62         super.copyTo(dataHolder, locale);
63         dataHolder.setUploadMaxFileMB(this.uploadMaxFileMB);
64         dataHolder.setUploadMaxDirMB(this.uploadMaxDirMB);
65     }
66
67     /**
68      * Method allows Struts to handle empty checkboxes for booleans
69      */

70     public void reset(ActionMapping mapping, HttpServletRequest JavaDoc request)
71     {
72         setAbsoluteURL( null );
73         fixNulls();
74     }
75     
76     private void fixNulls()
77     {
78         if (getRssUseCache() == null) setRssUseCache( Boolean.FALSE );
79         if (getNewUserAllowed() == null) setNewUserAllowed( Boolean.FALSE );
80         if (getEnableAggregator() == null) setEnableAggregator( Boolean.FALSE );
81         if (getUploadEnabled() == null) setUploadEnabled( Boolean.FALSE );
82         if (getMemDebug() == null) setMemDebug( Boolean.FALSE );
83         if (getAutoformatComments() == null) setAutoformatComments( Boolean.FALSE );
84         if (getEscapeCommentHtml() == null) setEscapeCommentHtml( Boolean.FALSE );
85         if (getEmailComments() == null) setEmailComments( Boolean.FALSE );
86         if (getEnableLinkback() == null) setEnableLinkback( Boolean.FALSE );
87         if (getEncryptPasswords() == null) setEncryptPasswords( Boolean.FALSE );
88     }
89 }
Popular Tags