Source Code Cross Referenced for EventFactorySupport.java in  » Workflow-Engines » spring-webflow-1.0.4 » org » springframework » webflow » execution » support » 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.execution.support 
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.execution.support;
017:
018:        import org.springframework.webflow.core.collection.AttributeMap;
019:        import org.springframework.webflow.core.collection.CollectionUtils;
020:        import org.springframework.webflow.execution.Event;
021:
022:        /**
023:         * A convenience support class assisting in the creation of {@link Event} objects.
024:         * <p>
025:         * This class can be used as a simple utility class when you need to create
026:         * common event objects.  Alternatively you could extend it as a base support class
027:         * when creating custom event factories.
028:         * 
029:         * @author Keith Donald
030:         * @author Erwin Vervaet
031:         */
032:        public class EventFactorySupport {
033:
034:            /**
035:             * The default 'success' result event identifier ("success").
036:             */
037:            private static final String SUCCESS_EVENT_ID = "success";
038:
039:            /**
040:             * The default 'error' result event identifier ("error").
041:             */
042:            private static final String ERROR_EVENT_ID = "error";
043:
044:            /**
045:             * The default 'yes' result event identifier ("yes").
046:             */
047:            private static final String YES_EVENT_ID = "yes";
048:
049:            /**
050:             * The default 'no' result event identifier ("no").
051:             */
052:            private static final String NO_EVENT_ID = "no";
053:
054:            /**
055:             * The default 'null' result event identifier ("null").
056:             */
057:            private static final String NULL_EVENT_ID = "null";
058:
059:            /**
060:             * The default 'exception' event attribute name ("exception").
061:             */
062:            private static final String EXCEPTION_ATTRIBUTE_NAME = "exception";
063:
064:            /**
065:             * The default 'result' event attribute name ("result").
066:             */
067:            private static final String RESULT_ATTRIBUTE_NAME = "result";
068:
069:            /**
070:             * The success event identifier.
071:             */
072:            private String successEventId = SUCCESS_EVENT_ID;
073:
074:            /**
075:             * The error event identifier.
076:             */
077:            private String errorEventId = ERROR_EVENT_ID;
078:
079:            /**
080:             * The yes event identifier.
081:             */
082:            private String yesEventId = YES_EVENT_ID;
083:
084:            /**
085:             * The no event identifier.
086:             */
087:            private String noEventId = NO_EVENT_ID;
088:
089:            /**
090:             * The null event identifier.
091:             */
092:            private String nullEventId = NULL_EVENT_ID;
093:
094:            /**
095:             * The exception event attribute name.
096:             */
097:            private String exceptionAttributeName = EXCEPTION_ATTRIBUTE_NAME;
098:
099:            /**
100:             * The result event attribute name.
101:             */
102:            private String resultAttributeName = RESULT_ATTRIBUTE_NAME;
103:
104:            public String getSuccessEventId() {
105:                return successEventId;
106:            }
107:
108:            public void setSuccessEventId(String successEventId) {
109:                this .successEventId = successEventId;
110:            }
111:
112:            public String getErrorEventId() {
113:                return errorEventId;
114:            }
115:
116:            public void setErrorEventId(String errorEventId) {
117:                this .errorEventId = errorEventId;
118:            }
119:
120:            public String getYesEventId() {
121:                return yesEventId;
122:            }
123:
124:            public void setYesEventId(String yesEventId) {
125:                this .yesEventId = yesEventId;
126:            }
127:
128:            public String getNoEventId() {
129:                return noEventId;
130:            }
131:
132:            public void setNoEventId(String noEventId) {
133:                this .noEventId = noEventId;
134:            }
135:
136:            public String getNullEventId() {
137:                return nullEventId;
138:            }
139:
140:            public void setNullEventId(String nullEventId) {
141:                this .nullEventId = nullEventId;
142:            }
143:
144:            public String getExceptionAttributeName() {
145:                return exceptionAttributeName;
146:            }
147:
148:            public void setExceptionAttributeName(String exceptionAttributeName) {
149:                this .exceptionAttributeName = exceptionAttributeName;
150:            }
151:
152:            public String getResultAttributeName() {
153:                return resultAttributeName;
154:            }
155:
156:            public void setResultAttributeName(String resultAttributeName) {
157:                this .resultAttributeName = resultAttributeName;
158:            }
159:
160:            /**
161:             * Returns a "success" event.
162:             * @param source the source of the event
163:             */
164:            public Event success(Object source) {
165:                return event(source, getSuccessEventId());
166:            }
167:
168:            /**
169:             * Returns a "success" event with the provided result object as an
170:             * attribute. The result object is identified by the attribute name
171:             * {@link #getResultAttributeName()}.
172:             * @param source the source of the event
173:             * @param result the action success result
174:             */
175:            public Event success(Object source, Object result) {
176:                return event(source, getSuccessEventId(),
177:                        getResultAttributeName(), result);
178:            }
179:
180:            /**
181:             * Returns an "error" event.
182:             * @param source the source of the event
183:             */
184:            public Event error(Object source) {
185:                return event(source, getErrorEventId());
186:            }
187:
188:            /**
189:             * Returns an "error" event caused by the provided exception.
190:             * @param source the source of the event
191:             * @param e the exception that caused the error event, to be put as an
192:             * event attribute under the name {@link #getExceptionAttributeName()}
193:             */
194:            public Event error(Object source, Exception e) {
195:                return event(source, getErrorEventId(),
196:                        getExceptionAttributeName(), e);
197:            }
198:
199:            /**
200:             * Returns a "yes" event.
201:             * @param source the source of the event
202:             */
203:            public Event yes(Object source) {
204:                return event(source, getYesEventId());
205:            }
206:
207:            /**
208:             * Returns a "no" result event.
209:             * @param source the source of the event
210:             */
211:            public Event no(Object source) {
212:                return event(source, getNoEventId());
213:            }
214:
215:            /**
216:             * Returns an event to communicate an occurrence of a boolean expression.
217:             * @param source the source of the event
218:             * @param booleanResult the boolean
219:             * @return yes or no
220:             */
221:            public Event event(Object source, boolean booleanResult) {
222:                if (booleanResult) {
223:                    return yes(source);
224:                } else {
225:                    return no(source);
226:                }
227:            }
228:
229:            /**
230:             * Returns a event with the specified identifier.
231:             * @param source the source of the event
232:             * @param eventId the result event identifier
233:             * @return the event
234:             */
235:            public Event event(Object source, String eventId) {
236:                return new Event(source, eventId, null);
237:            }
238:
239:            /**
240:             * Returns a event with the specified identifier and the specified set of
241:             * attributes.
242:             * @param source the source of the event
243:             * @param eventId the result event identifier
244:             * @param attributes the event payload attributes
245:             * @return the event
246:             */
247:            public Event event(Object source, String eventId,
248:                    AttributeMap attributes) {
249:                return new Event(source, eventId, attributes);
250:            }
251:
252:            /**
253:             * Returns a result event with the specified identifier and
254:             * a single attribute.
255:             * @param source the source of the event
256:             * @param eventId the result id
257:             * @param attributeName the attribute name
258:             * @param attributeValue the attribute value
259:             * @return the event
260:             */
261:            public Event event(Object source, String eventId,
262:                    String attributeName, Object attributeValue) {
263:                return new Event(source, eventId, CollectionUtils
264:                        .singleEntryMap(attributeName, attributeValue));
265:            }
266:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.