Source Code Cross Referenced for AbstractFlowExecutionPropertyResolver.java in  » Workflow-Engines » spring-webflow-1.0.4 » org » springframework » webflow » executor » jsf » 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 » Workflow Engines » spring webflow 1.0.4 » org.springframework.webflow.executor.jsf 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2004-2007 the original author or authors.
003:         *
004:         * Licensed under the Apache License, Version 2.0 (the "License");
005:         * you may not use this file except in compliance with the License.
006:         * You may obtain a copy of the License at
007:         *
008:         *      http://www.apache.org/licenses/LICENSE-2.0
009:         *
010:         * Unless required by applicable law or agreed to in writing, software
011:         * distributed under the License is distributed on an "AS IS" BASIS,
012:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013:         * See the License for the specific language governing permissions and
014:         * limitations under the License.
015:         */
016:        package org.springframework.webflow.executor.jsf;
017:
018:        import javax.faces.el.EvaluationException;
019:        import javax.faces.el.PropertyNotFoundException;
020:        import javax.faces.el.PropertyResolver;
021:        import javax.faces.el.ReferenceSyntaxException;
022:
023:        import org.springframework.webflow.execution.FlowExecution;
024:
025:        /**
026:         * Base class for property resolvers that get and set flow execution attributes.
027:         * 
028:         * @author Keith Donald
029:         */
030:        public abstract class AbstractFlowExecutionPropertyResolver extends
031:                PropertyResolver {
032:
033:            /**
034:             * The standard property resolver to delegate to if this one doesn't apply.
035:             */
036:            private final PropertyResolver resolverDelegate;
037:
038:            /**
039:             * Creates a new flow executon property resolver
040:             * @param resolverDelegate the resolver to delegate to when the property is not a flow execution attribute
041:             */
042:            public AbstractFlowExecutionPropertyResolver(
043:                    PropertyResolver resolverDelegate) {
044:                this .resolverDelegate = resolverDelegate;
045:            }
046:
047:            /**
048:             * Returns the property resolver this resolver delegates to if necessary.
049:             */
050:            protected final PropertyResolver getResolverDelegate() {
051:                return resolverDelegate;
052:            }
053:
054:            public Class getType(Object base, Object property)
055:                    throws EvaluationException, PropertyNotFoundException {
056:                if (base instanceof  FlowExecution) {
057:                    FlowExecution execution = (FlowExecution) base;
058:                    assertPropertyNameValid(property);
059:                    return doGetAttributeType(execution, (String) property);
060:                } else {
061:                    return resolverDelegate.getType(base, property);
062:                }
063:            }
064:
065:            public Class getType(Object base, int index)
066:                    throws EvaluationException, PropertyNotFoundException {
067:                if (base instanceof  FlowExecution) {
068:                    // cannot access flow execution by index so we cannot determine type. Return null per JSF spec
069:                    return null;
070:                } else {
071:                    return resolverDelegate.getType(base, index);
072:                }
073:            }
074:
075:            public Object getValue(Object base, Object property)
076:                    throws EvaluationException, PropertyNotFoundException {
077:                if (base instanceof  FlowExecution) {
078:                    FlowExecution execution = (FlowExecution) base;
079:                    assertPropertyNameValid(property);
080:                    return doGetAttribute(execution, (String) property);
081:                } else {
082:                    return resolverDelegate.getValue(base, property);
083:                }
084:            }
085:
086:            public Object getValue(Object base, int index)
087:                    throws EvaluationException, PropertyNotFoundException {
088:                if (base instanceof  FlowExecution) {
089:                    throw new ReferenceSyntaxException(
090:                            "Cannot apply an index value to a flow execution");
091:                } else {
092:                    return resolverDelegate.getValue(base, index);
093:                }
094:            }
095:
096:            public boolean isReadOnly(Object base, Object property)
097:                    throws EvaluationException, PropertyNotFoundException {
098:                if (base instanceof  FlowExecution) {
099:                    return false;
100:                } else {
101:                    return resolverDelegate.isReadOnly(base, property);
102:                }
103:            }
104:
105:            public boolean isReadOnly(Object base, int index)
106:                    throws EvaluationException, PropertyNotFoundException {
107:                if (base instanceof  FlowExecution) {
108:                    return false;
109:                } else {
110:                    return resolverDelegate.isReadOnly(base, index);
111:                }
112:            }
113:
114:            public void setValue(Object base, Object property, Object value)
115:                    throws EvaluationException, PropertyNotFoundException {
116:                if ((base instanceof  FlowExecution)) {
117:                    FlowExecution execution = (FlowExecution) base;
118:                    assertPropertyNameValid(property);
119:                    doSetAttribute(execution, (String) property, value);
120:                } else {
121:                    resolverDelegate.setValue(base, property, value);
122:                }
123:            }
124:
125:            public void setValue(Object base, int index, Object value)
126:                    throws EvaluationException, PropertyNotFoundException {
127:                if (base instanceof  FlowExecution) {
128:                    throw new ReferenceSyntaxException(
129:                            "Cannot apply an index value to a flow execution");
130:                } else {
131:                    resolverDelegate.setValue(base, index, value);
132:                }
133:            }
134:
135:            // helpers
136:
137:            private void assertPropertyNameValid(Object property) {
138:                if (property == null) {
139:                    throw new PropertyNotFoundException(
140:                            "The name of the flow execution attribute cannot be null");
141:                }
142:                if (!(property instanceof  String)) {
143:                    throw new PropertyNotFoundException(
144:                            "Flow execution attribute names must be strings but "
145:                                    + property + " was not");
146:                }
147:                if (((String) property).length() == 0) {
148:                    throw new PropertyNotFoundException(
149:                            "The name of the flow execution attribute cannot be blank");
150:                }
151:            }
152:
153:            /**
154:             * Gets the type of value returned by the flow execution attribute.
155:             * @param execution the flow execution
156:             * @param attributeName the name of the attribute
157:             * @return the type of value returned by the attribute
158:             */
159:            protected abstract Class doGetAttributeType(
160:                    FlowExecution execution, String attributeName);
161:
162:            /**
163:             * Gets the value of the flow execution attribute.
164:             * @param execution the flow execution
165:             * @param attributeName the name of the attribute
166:             * @return the attribute value
167:             */
168:            protected abstract Object doGetAttribute(FlowExecution execution,
169:                    String attributeName);
170:
171:            /**
172:             * Sets the value of the flow execution attribute.
173:             * @param execution the flow execution
174:             * @param attributeName the name of the attribute
175:             * @param attributeValue the attribute value
176:             */
177:            protected abstract void doSetAttribute(FlowExecution execution,
178:                    String attributeName, Object attributeValue);
179:
180:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.