KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > blandware > atleap > webapp > form > core > GlobalPropertyForm


1 /*
2  * Copyright 2004 Blandware (http://www.blandware.com)
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not 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.
15  */

16 package com.blandware.atleap.webapp.form.core;
17
18 import com.blandware.atleap.webapp.form.BaseForm;
19 import org.apache.struts.action.ActionMapping;
20
21 import javax.servlet.http.HttpServletRequest JavaDoc;
22 import java.util.Map JavaDoc;
23 import java.util.SortedMap JavaDoc;
24 import java.util.TreeMap JavaDoc;
25
26 /**
27  * <p>This form bean represents all global properties at once because of batch update</p>
28  * <p><a HREF="GlobalPropertyForm.java.htm"><i>View Source</i></a></p>
29  * <p/>
30  *
31  * @author Sergey Zubtcovskii <a HREF="mailto:sergey.zubtcovskii@blandware.com">&lt;sergey.zubtcovskii@blandware.com&gt;</a>
32  * @version $Revision: 1.3 $ $Date: 2005/08/04 17:25:16 $
33  * @struts.form name="globalPropertyForm"
34  */

35 public class GlobalPropertyForm extends BaseForm implements java.io.Serializable JavaDoc {
36
37     /**
38      * List of mappings <code>name -&gt; value</code>
39      */

40     protected SortedMap JavaDoc propertyMap = new TreeMap JavaDoc();
41
42     /**
43      * List of mappings <code>id -&gt; version</code>
44      */

45     protected SortedMap JavaDoc versionMap = new TreeMap JavaDoc();
46
47     /**
48      * Default empty constructor.
49      */

50     public GlobalPropertyForm() {
51     }
52
53     /**
54      * Returns map of properties
55      *
56      * @return map of properties
57      */

58     public Map JavaDoc getPropertyMap() {
59         return propertyMap;
60     }
61
62     /**
63      * Sets properties
64      *
65      * @param propertyMap map of properties to set
66      */

67     public void setPropertyMap(SortedMap JavaDoc propertyMap) {
68         this.propertyMap = propertyMap;
69     }
70
71     /**
72      * Returns value of property with specified name
73      *
74      * @param name Name of property
75      * @return Property value
76      */

77     public Object JavaDoc getProperty(String JavaDoc name) {
78         return propertyMap.get(name);
79     }
80
81     /**
82      * Sets value for property with specified name
83      *
84      * @param name Name of property
85      * @param value Value of property
86      */

87     public void setProperty(String JavaDoc name, Object JavaDoc value) {
88         propertyMap.put(name, value);
89     }
90
91     /**
92      * Returns map of versions
93      *
94      * @return map of versions
95      */

96     public Map JavaDoc getVersionMap() {
97         return versionMap;
98     }
99
100     /**
101      * Sets map of versions
102      *
103      * @param versionMap Map to set
104      */

105     public void setVersionMap(SortedMap JavaDoc versionMap) {
106         this.versionMap = versionMap;
107     }
108
109     /**
110      * Returns version of global property by specified key
111      *
112      * @param key Key to return version for
113      * @return version
114      */

115     public Object JavaDoc getVersion(String JavaDoc key) {
116         return versionMap.get(key);
117     }
118
119     /**
120      * Sets version for specified key
121      *
122      * @param key Key to set version for
123      * @param version Version to set
124      */

125     public void setVersion(String JavaDoc key, Object JavaDoc version) {
126         versionMap.put(key, version);
127     }
128
129     /**
130      * @see org.apache.struts.action.ActionForm#reset(org.apache.struts.action.ActionMapping, javax.servlet.http.HttpServletRequest)
131      */

132     public void reset(ActionMapping mapping, HttpServletRequest JavaDoc request) {
133         this.propertyMap = new TreeMap JavaDoc();
134         this.versionMap = new TreeMap JavaDoc();
135     }
136
137 }
138
Popular Tags