001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: *
017: * $Header:$
018: */
019: package org.apache.beehive.netui.pageflow.config;
020:
021: import org.apache.struts.action.ActionMapping;
022:
023: import java.util.Map;
024: import java.util.LinkedHashMap;
025:
026: /**
027: * Bean class to handle our extensions to the Struts <action> element.
028: */
029: public class PageFlowActionMapping extends ActionMapping {
030: private String _unqualifiedActionPath;
031: private boolean _loginRequired = false;
032: private boolean _preventDoubleSubmit = false;
033: private boolean _simpleAction = false;
034: private boolean _isOverloaded = false;
035: private String _formMember;
036: private String _formClass; // applicable for non-ActionForm-derived form types
037: private boolean _readonly = false;
038: private Map/*< String, String >*/_conditionalForwards = new LinkedHashMap/*< String, String >*/();
039: private String _formBeanMessageResourcesKey;
040: private String _defaultForward;
041:
042: public String getUnqualifiedActionPath() {
043: return _unqualifiedActionPath;
044: }
045:
046: public final void setUnqualifiedActionPath(
047: String unqualifiedActionPath) {
048: _unqualifiedActionPath = unqualifiedActionPath;
049: }
050:
051: public String getUnqualifiedActionName() {
052: if (_unqualifiedActionPath != null
053: && _unqualifiedActionPath.startsWith("/")) {
054: return _unqualifiedActionPath.substring(1);
055: } else {
056: return _unqualifiedActionPath;
057: }
058: }
059:
060: public boolean isLoginRequired() {
061: return _loginRequired;
062: }
063:
064: public void setLoginRequired(boolean loginRequired) {
065: _loginRequired = loginRequired;
066: }
067:
068: public boolean isPreventDoubleSubmit() {
069: return _preventDoubleSubmit;
070: }
071:
072: public void setPreventDoubleSubmit(boolean preventDoubleSubmit) {
073: _preventDoubleSubmit = preventDoubleSubmit;
074: }
075:
076: public boolean isSimpleAction() {
077: return _simpleAction;
078: }
079:
080: public void setSimpleAction(boolean simpleAction) {
081: _simpleAction = simpleAction;
082: }
083:
084: public boolean isOverloaded() {
085: return _isOverloaded;
086: }
087:
088: public void setOverloaded(boolean overloaded) {
089: _isOverloaded = overloaded;
090: }
091:
092: public String getFormMember() {
093: return _formMember;
094: }
095:
096: public void setFormMember(String formMember) {
097: _formMember = formMember;
098: }
099:
100: public String getFormClass() {
101: return _formClass;
102: }
103:
104: public void setFormClass(String formClass) {
105: _formClass = formClass;
106: }
107:
108: public boolean isReadonly() {
109: return _readonly;
110: }
111:
112: public void setReadonly(boolean readonly) {
113: _readonly = readonly;
114: }
115:
116: public void setConditionalForwards(String conditionalForwards) {
117: String[] pairs = conditionalForwards.split(";");
118:
119: for (int i = 0; i < pairs.length; i++) {
120: String pair = pairs[i];
121: int delim = pair.indexOf(':');
122: assert delim != -1 : pair;
123: String forwardName = pair.substring(0, delim);
124: String expression = pair.substring(delim + 1);
125: _conditionalForwards.put(expression, forwardName);
126: }
127: }
128:
129: /**
130: * Get a map of expression -> forward-name. If the expression evaluates to <code>true</code> the forward is used.
131: */
132: public Map/*< String, String >*/getConditionalForwardsMap() {
133: return _conditionalForwards;
134: }
135:
136: public String getFormBeanMessageResourcesKey() {
137: return _formBeanMessageResourcesKey;
138: }
139:
140: public void setFormBeanMessageResourcesKey(
141: String formBeanMessageResourcesKey) {
142: _formBeanMessageResourcesKey = formBeanMessageResourcesKey;
143: }
144:
145: public String getDefaultForward() {
146: return _defaultForward;
147: }
148:
149: public void setDefaultForward(String defaultForward) {
150: _defaultForward = defaultForward;
151: }
152:
153: /**
154: * Get a prefix directory path that all Forward local paths should be relative to. By default this is
155: * <code>null</code>, which means that there is no forced prefix path.
156: */
157: public String getLocalPathsRelativeTo() {
158: return null;
159: }
160: }
|