Source Code Cross Referenced for ActionModel.java in  » Library » Apache-beehive-1.0.2-src » org » apache » beehive » netui » compiler » model » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Library » Apache beehive 1.0.2 src » org.apache.beehive.netui.compiler.model 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


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.compiler.model;
020:
021:        import java.util.ArrayList;
022:        import java.util.Map;
023:        import java.util.LinkedHashMap;
024:        import java.util.Iterator;
025:
026:        import org.apache.beehive.netui.compiler.JpfLanguageConstants;
027:        import org.w3c.dom.Element;
028:
029:        /**
030:         * Represents an ActionMapping in a Struts based web application or
031:         * sub application.
032:         */
033:        public class ActionModel extends AbstractForwardContainer implements 
034:                ForwardContainer, ExceptionContainer, JpfLanguageConstants {
035:            public static final String DEFAULT_FORM_SCOPE = "request";
036:
037:            private static final String PAGEFLOW_ACTION_MAPPING_CLASSNAME = PAGEFLOW_PACKAGE
038:                    + ".config.PageFlowActionMapping";
039:
040:            // Struts attributes.
041:            private ArrayList _exceptionCatches = new ArrayList();
042:            private String _attribute;
043:            private String _forward;
044:            private String _include;
045:            private String _input;
046:            private String _formBeanName;
047:            private String _parameter;
048:            private String _path; // required to be set
049:            private String _prefix;
050:            private String _scope = DEFAULT_FORM_SCOPE;
051:            private String _suffix;
052:            private String _type;
053:            private boolean _unknown;
054:            private String _roles;
055:            private boolean _validate;
056:
057:            // Non-struts attributes.
058:            private String _unqualifiedActionPath;
059:            private Boolean _loginRequired;
060:            private boolean _isOverloaded;
061:            private Boolean _readonly;
062:            private boolean _isSimpleAction = false;
063:            private boolean _preventDoubleSubmit = false;
064:            private String _formMember; // pageflow-scoped form
065:            private String _formClass; // applicable for non-ActionForm-derived types
066:            private LinkedHashMap _conditionalForwards;
067:            private String _formBeanMessageResourcesKey;
068:            private String _defaultForwardName; // for Simple Actions
069:
070:            public ActionModel(String path, String formName, StrutsApp parent) {
071:                super (parent);
072:                this ._path = path;
073:                this ._formBeanName = formName;
074:            }
075:
076:            protected ActionModel(StrutsApp parent) {
077:                this (null, null, parent);
078:            }
079:
080:            public void setFormBeanName(String formBeanName) {
081:                _formBeanName = formBeanName;
082:            }
083:
084:            protected void writeToElement(XmlModelWriter xw, Element element) {
085:                element.setAttribute("path", _path);
086:                setElementAttribute(element, "name", _formBeanName);
087:                setElementAttribute(element, "className", getClassName());
088:                setElementAttribute(element, "type", _type);
089:                setElementAttribute(element, "attribute", _attribute);
090:                setElementAttribute(element, "input", _input);
091:                setElementAttribute(element, "parameter", _parameter);
092:                setElementAttribute(element, "prefix", _prefix);
093:                setElementAttribute(element, "suffix", _suffix);
094:                setElementAttribute(element, "scope", _scope != null ? _scope
095:                        : "request");
096:                setElementAttribute(element, "roles", _roles);
097:                setElementAttribute(element, "forward", _forward);
098:                setElementAttribute(element, "include", _include);
099:                setElementAttribute(element, "validate", Boolean
100:                        .toString(_validate)); // always set the value, even if false
101:                addSetProperty(xw, element, "unqualifiedActionPath",
102:                        _unqualifiedActionPath);
103:                addSetProperty(xw, element, "formMember", _formMember);
104:                addSetProperty(xw, element, "formClass", _formClass);
105:                addSetProperty(xw, element, "loginRequired", _loginRequired);
106:                addSetProperty(xw, element, "preventDoubleSubmit",
107:                        _preventDoubleSubmit);
108:                addSetProperty(xw, element, "overloaded", _isOverloaded);
109:                addSetProperty(xw, element, "readonly", _readonly);
110:                addSetProperty(xw, element, "simpleAction", _isSimpleAction);
111:                addSetProperty(xw, element, "defaultForward",
112:                        _defaultForwardName);
113:                addSetProperty(xw, element, "formBeanMessageResourcesKey",
114:                        _formBeanMessageResourcesKey);
115:
116:                if (_conditionalForwards != null) {
117:                    addSetProperty(xw, element, "conditionalForwards",
118:                            getMapString(_conditionalForwards));
119:                }
120:
121:                if (_exceptionCatches != null && !_exceptionCatches.isEmpty()) {
122:                    for (int i = 0; i < _exceptionCatches.size(); ++i) {
123:                        ExceptionModel ec = (ExceptionModel) _exceptionCatches
124:                                .get(i);
125:                        Element exceptionToEdit = findChildElement(xw, element,
126:                                "exception", "type", ec.getType(), true, null);
127:                        ec.writeXML(xw, exceptionToEdit);
128:                    }
129:                }
130:
131:                // forwards
132:                writeForwards(xw, element);
133:
134:                writeAdditionalSetProperties(xw, element);
135:            }
136:
137:            private void addSetProperty(XmlModelWriter xw, Element element,
138:                    String propertyName, boolean propertyValue) {
139:                if (propertyValue)
140:                    addSetProperty(xw, element, propertyName, Boolean
141:                            .toString(propertyValue));
142:            }
143:
144:            private void addSetProperty(XmlModelWriter xw, Element element,
145:                    String propertyName, Boolean propertyValue) {
146:                if (propertyValue != null)
147:                    addSetProperty(xw, element, propertyName, propertyValue
148:                            .toString());
149:            }
150:
151:            protected void addSetProperty(XmlModelWriter xw, Element element,
152:                    String propertyName, String propertyValue) {
153:                setCustomProperty(xw, element, propertyName, propertyValue,
154:                        PAGEFLOW_ACTION_MAPPING_CLASSNAME);
155:            }
156:
157:            /**
158:             * Implemented for {@link ExceptionContainer}.
159:             */
160:            public void addException(ExceptionModel em) {
161:                _exceptionCatches.add(em);
162:            }
163:
164:            public String getAttribute() {
165:                return _attribute;
166:            }
167:
168:            public void setAttribute(String attribute) {
169:                this ._attribute = attribute;
170:            }
171:
172:            public String getForward() {
173:                return _forward;
174:            }
175:
176:            public void setForward(String forward) {
177:                this ._forward = forward;
178:            }
179:
180:            public String getInclude() {
181:                return _include;
182:            }
183:
184:            public void setInclude(String include) {
185:                this ._include = include;
186:            }
187:
188:            public String getInput() {
189:                return _input;
190:            }
191:
192:            public void setInput(String input) {
193:                this ._input = input;
194:            }
195:
196:            public String getName() {
197:                return _formBeanName;
198:            }
199:
200:            public String getFormBeanName() {
201:                return _formBeanName;
202:            }
203:
204:            public void setName(String name) {
205:                this ._formBeanName = name;
206:            }
207:
208:            public String getParameter() {
209:                return _parameter;
210:            }
211:
212:            public void setParameter(String parameter) {
213:                this ._parameter = parameter;
214:            }
215:
216:            public boolean isValidate() {
217:                return _validate;
218:            }
219:
220:            public void setValidate(boolean validate) {
221:                _validate = validate;
222:            }
223:
224:            public String getPath() {
225:                return _path;
226:            }
227:
228:            public String getPath(boolean useUnqualifiedPath) {
229:                if (useUnqualifiedPath && _unqualifiedActionPath != null) {
230:                    return _unqualifiedActionPath;
231:                } else {
232:                    return _path;
233:                }
234:            }
235:
236:            public void setPath(String path) {
237:                this ._path = path;
238:            }
239:
240:            public String getPrefix() {
241:                return _prefix;
242:            }
243:
244:            public void setPrefix(String prefix) {
245:                this ._prefix = prefix;
246:            }
247:
248:            public String getScope() {
249:                return _scope == null ? DEFAULT_FORM_SCOPE : _scope;
250:            }
251:
252:            public void setScope(String scope) {
253:                this ._scope = scope;
254:            }
255:
256:            public String getSuffix() {
257:                return _suffix;
258:            }
259:
260:            public void setSuffix(String suffix) {
261:                this ._suffix = suffix;
262:            }
263:
264:            public String getType() {
265:                return _type;
266:            }
267:
268:            public void setType(String type) {
269:                this ._type = type;
270:            }
271:
272:            public boolean isUnknown() {
273:                return _unknown;
274:            }
275:
276:            public void setUnknown(boolean unknown) {
277:                this ._unknown = unknown;
278:            }
279:
280:            public String getUnqualifiedActionPath() {
281:                return _unqualifiedActionPath;
282:            }
283:
284:            public void setUnqualifiedActionPath(String unqualifiedActionPath) {
285:                this ._unqualifiedActionPath = unqualifiedActionPath;
286:            }
287:
288:            public String getDefaultForwardName() {
289:                return _defaultForwardName;
290:            }
291:
292:            public void setDefaultForwardName(String defaultForwardName) {
293:                _defaultForwardName = defaultForwardName;
294:            }
295:
296:            public String getRoles() {
297:                return _roles;
298:            }
299:
300:            public void setRoles(String roles) {
301:                _roles = roles;
302:            }
303:
304:            /**
305:             * Set the value to use for the login required <set-property> of the <action>.
306:             * If the value is null, then this <set-property> will not be included in the
307:             * <action>.
308:             * @param loginRequired if <code>true</code>, login is required for this action.
309:             *                      If <code>false</code>, no login is required. Otherwise,
310:             *                      a <set-property> will not be written, implying
311:             *                      login is not required.
312:             */
313:            public void setLoginRequired(Boolean loginRequired) {
314:                _loginRequired = loginRequired;
315:            }
316:
317:            public void setPreventDoubleSubmit(boolean preventDoubleSubmit) {
318:                _preventDoubleSubmit = preventDoubleSubmit;
319:            }
320:
321:            public boolean isSimpleAction() {
322:                return _isSimpleAction;
323:            }
324:
325:            public void setSimpleAction(boolean simpleAction) {
326:                _isSimpleAction = simpleAction;
327:            }
328:
329:            public boolean isOverloaded() {
330:                return _isOverloaded;
331:            }
332:
333:            public void setOverloaded(boolean overloaded) {
334:                _isOverloaded = overloaded;
335:            }
336:
337:            public String getFormMember() {
338:                return _formMember;
339:            }
340:
341:            public void setFormMember(String formMember) {
342:                _formMember = formMember;
343:            }
344:
345:            public String getFormClass() {
346:                return _formClass;
347:            }
348:
349:            public void setFormClass(String formClass) {
350:                _formClass = formClass;
351:            }
352:
353:            public Boolean isReadonly() {
354:                return _readonly;
355:            }
356:
357:            /**
358:             * Set the value to use for the read only <set-property> of the <action>.
359:             * If the value is null, then this <set-property> will not be included in
360:             * the <action>. If set to <code>true</code>, then by default the action
361:             * "promises" that it will not modify member data.
362:             * @param readonly if true, this action is read only .If false, it is not
363:             *                 read only (the default). Otherwise, a <set-property>
364:             *                 will not be written, implying it is not read only. 
365:             */
366:            public void setReadonly(Boolean readonly) {
367:                _readonly = readonly;
368:            }
369:
370:            public void addConditionalForward(String expression,
371:                    String forwardName) {
372:                if (_conditionalForwards == null)
373:                    _conditionalForwards = new LinkedHashMap();
374:                _conditionalForwards.put(expression, forwardName);
375:            }
376:
377:            private static String getMapString(Map map) {
378:                StringBuffer retVal = new StringBuffer();
379:
380:                for (Iterator i = map.entrySet().iterator(); i.hasNext();) {
381:                    Map.Entry entry = (Map.Entry) i.next();
382:                    retVal.append(entry.getValue()).append(':').append(
383:                            entry.getKey()).append(';');
384:                }
385:
386:                return retVal.toString();
387:            }
388:
389:            public void setFormBeanMessageResourcesKey(
390:                    String formBeanMessageResourcesKey) {
391:                _formBeanMessageResourcesKey = formBeanMessageResourcesKey;
392:            }
393:
394:            public void setActionName(String actionName) {
395:                setPath('/' + actionName);
396:            }
397:
398:            public String getActionPath() {
399:                return getPath();
400:            }
401:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.