Source Code Cross Referenced for FlowExecutionPropertyResolver.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 java.util.Map;
019:
020:        import javax.faces.el.PropertyNotFoundException;
021:        import javax.faces.el.PropertyResolver;
022:
023:        import org.springframework.webflow.execution.FlowExecution;
024:
025:        /**
026:         * Custom property resolver that resolves supported properties of the current flow execution.
027:         * Supports resolving all scopes as java.util.Maps: "flowScope", "conversationScope", and "flashScope".
028:         * Also supports attribute searching when no scope prefix is specified. The search order is 
029:         * flash, flow, conversation.
030:         * 
031:         * @author Keith Donald
032:         */
033:        public class FlowExecutionPropertyResolver extends
034:                AbstractFlowExecutionPropertyResolver {
035:
036:            /**
037:             * The name of the special flash scope execution property.
038:             */
039:            private static final String FLASH_SCOPE_PROPERTY = "flashScope";
040:
041:            /**
042:             * The name of the special flow scope execution property.
043:             */
044:            private static final String FLOW_SCOPE_PROPERTY = "flowScope";
045:
046:            /**
047:             * The name of the special conversation scope execution property.
048:             */
049:            private static final String CONVERSATION_SCOPE_PROPERTY = "conversationScope";
050:
051:            /**
052:             * Creates a new flow executon property resolver that resolves flash, flow, and conversation scope attributes.
053:             * @param resolverDelegate the resolver to delegate to when the property is not a flow execution attribute
054:             */
055:            public FlowExecutionPropertyResolver(
056:                    PropertyResolver resolverDelegate) {
057:                super (resolverDelegate);
058:            }
059:
060:            protected Class doGetAttributeType(FlowExecution execution,
061:                    String attributeName) {
062:                if (FLASH_SCOPE_PROPERTY.equals(attributeName)) {
063:                    return Map.class;
064:                } else if (FLOW_SCOPE_PROPERTY.equals(attributeName)) {
065:                    return Map.class;
066:                } else if (CONVERSATION_SCOPE_PROPERTY.equals(attributeName)) {
067:                    return Map.class;
068:                } else {
069:                    // perform an attribute search
070:
071:                    // try flash scope first
072:                    Object value = execution.getActiveSession().getFlashMap()
073:                            .get(attributeName);
074:                    if (value != null) {
075:                        return value.getClass();
076:                    }
077:                    // try flow scope
078:                    value = execution.getActiveSession().getScope().get(
079:                            attributeName);
080:                    if (value != null) {
081:                        return value.getClass();
082:                    }
083:                    // try conversation scope
084:                    value = execution.getConversationScope().get(attributeName);
085:                    if (value != null) {
086:                        return value.getClass();
087:                    }
088:                    // cannot determine
089:                    return null;
090:                }
091:            }
092:
093:            protected Object doGetAttribute(FlowExecution execution,
094:                    String attributeName) {
095:                if (FLASH_SCOPE_PROPERTY.equals(attributeName)) {
096:                    return execution.getActiveSession().getFlashMap().asMap();
097:                } else if (FLOW_SCOPE_PROPERTY.equals(attributeName)) {
098:                    return execution.getActiveSession().getScope().asMap();
099:                } else if (CONVERSATION_SCOPE_PROPERTY.equals(attributeName)) {
100:                    return execution.getConversationScope().asMap();
101:                } else {
102:                    // perform an attribute search
103:
104:                    // try flash scope
105:                    Object value = execution.getActiveSession().getFlashMap()
106:                            .get(attributeName);
107:                    if (value != null) {
108:                        return value;
109:                    }
110:                    // try flow scope
111:                    value = execution.getActiveSession().getScope().get(
112:                            attributeName);
113:                    if (value != null) {
114:                        return value;
115:                    }
116:                    // try conversation scope
117:                    value = execution.getConversationScope().get(attributeName);
118:                    if (value != null) {
119:                        return value;
120:                    }
121:                    // cannot resolve as expected
122:                    throw new PropertyNotFoundException(
123:                            "Readable flow execution attribute '"
124:                                    + attributeName
125:                                    + "' not found in any scope (flash, flow, or conversation)");
126:                }
127:            }
128:
129:            protected void doSetAttribute(FlowExecution execution,
130:                    String attributeName, Object attributeValue) {
131:                // perform a search
132:                if (execution.getActiveSession().getFlashMap().contains(
133:                        attributeName)) {
134:                    execution.getActiveSession().getFlashMap().put(
135:                            attributeName, attributeValue);
136:                } else if (execution.getActiveSession().getScope().contains(
137:                        attributeName)) {
138:                    execution.getActiveSession().getScope().put(attributeName,
139:                            attributeValue);
140:                } else if (execution.getConversationScope().contains(
141:                        attributeName)) {
142:                    execution.getConversationScope().put(attributeName,
143:                            attributeValue);
144:                } else {
145:                    // cannot resolve as expected
146:                    throw new PropertyNotFoundException(
147:                            "Settable flow execution attribute '"
148:                                    + attributeName
149:                                    + "' not found in any scope (flash, flow, or conversation)");
150:                }
151:            }
152:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.