KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > beehive > netui > pageflow > config > PageFlowActionMapping


1 /*
2  * Copyright 2004 The Apache Software Foundation.
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  * $Header:$
17  */

18 package org.apache.beehive.netui.pageflow.config;
19
20 import org.apache.struts.action.ActionMapping;
21
22 import java.util.Map JavaDoc;
23 import java.util.LinkedHashMap JavaDoc;
24
25
26 /**
27  * Bean class to handle our extensions to the Struts <action> element.
28  */

29 public class PageFlowActionMapping extends ActionMapping
30 {
31     private String JavaDoc _unqualifiedActionPath;
32     private boolean _loginRequired = false;
33     private boolean _preventDoubleSubmit = false;
34     private boolean _simpleAction = false;
35     private boolean _isOverloaded = false;
36     private String JavaDoc _formMember;
37     private String JavaDoc _formClass; // applicable for non-ActionForm-derived form types
38
private boolean _readonly = false;
39     private Map JavaDoc/*< String, String >*/ _conditionalForwards = new LinkedHashMap JavaDoc/*< String, String >*/();
40     private String JavaDoc _formBeanMessageResourcesKey;
41     private String JavaDoc _defaultForward;
42     
43
44     public String JavaDoc getUnqualifiedActionPath()
45     {
46         return _unqualifiedActionPath;
47     }
48
49     public final void setUnqualifiedActionPath( String JavaDoc unqualifiedActionPath )
50     {
51         _unqualifiedActionPath = unqualifiedActionPath;
52     }
53     
54     public final String JavaDoc getUnqualifiedActionName()
55     {
56         if ( _unqualifiedActionPath != null && _unqualifiedActionPath.startsWith( "/" ) )
57         {
58             return _unqualifiedActionPath.substring( 1 );
59         }
60         else
61         {
62             return _unqualifiedActionPath;
63         }
64     }
65     
66     public final boolean isLoginRequired()
67     {
68         return _loginRequired;
69     }
70     
71     public void setLoginRequired( boolean loginRequired )
72     {
73         _loginRequired = loginRequired;
74     }
75
76     public boolean isPreventDoubleSubmit()
77     {
78         return _preventDoubleSubmit;
79     }
80
81     public void setPreventDoubleSubmit( boolean preventDoubleSubmit )
82     {
83         _preventDoubleSubmit = preventDoubleSubmit;
84     }
85
86     public boolean isSimpleAction()
87     {
88         return _simpleAction;
89     }
90
91     public void setSimpleAction( boolean simpleAction )
92     {
93         _simpleAction = simpleAction;
94     }
95
96     public boolean isOverloaded()
97     {
98         return _isOverloaded;
99     }
100
101     public void setOverloaded( boolean overloaded )
102     {
103         _isOverloaded = overloaded;
104     }
105     
106     public String JavaDoc getFormMember()
107     {
108         return _formMember;
109     }
110
111     public void setFormMember( String JavaDoc formMember )
112     {
113         _formMember = formMember;
114     }
115
116     public String JavaDoc getFormClass()
117     {
118         return _formClass;
119     }
120
121     public void setFormClass( String JavaDoc formClass )
122     {
123         _formClass = formClass;
124     }
125
126     public boolean isReadonly()
127     {
128         return _readonly;
129     }
130
131     public void setReadonly( boolean readonly )
132     {
133         _readonly = readonly;
134     }
135     
136     public void setConditionalForwards( String JavaDoc conditionalForwards )
137     {
138         String JavaDoc[] pairs = conditionalForwards.split( ";" );
139         
140         for ( int i = 0; i < pairs.length; i++ )
141         {
142             String JavaDoc pair = pairs[i];
143             int delim = pair.indexOf( ':' );
144             assert delim != -1 : pair;
145             String JavaDoc forwardName = pair.substring( 0, delim );
146             String JavaDoc expression = pair.substring( delim + 1 );
147             _conditionalForwards.put( expression, forwardName );
148         }
149     }
150     
151     /**
152      * Get a map of expression -> forward-name. If the expression evaluates to <code>true</code> the forward is used.
153      */

154     public Map JavaDoc/*< String, String >*/ getConditionalForwardsMap()
155     {
156         return _conditionalForwards;
157     }
158
159     public String JavaDoc getFormBeanMessageResourcesKey()
160     {
161         return _formBeanMessageResourcesKey;
162     }
163
164     public void setFormBeanMessageResourcesKey( String JavaDoc formBeanMessageResourcesKey )
165     {
166         _formBeanMessageResourcesKey = formBeanMessageResourcesKey;
167     }
168
169     public String JavaDoc getDefaultForward()
170     {
171         return _defaultForward;
172     }
173
174     public void setDefaultForward( String JavaDoc defaultForward )
175     {
176         _defaultForward = defaultForward;
177     }
178 }
179
Popular Tags