Source Code Cross Referenced for Outcome.java in  » Wiki-Engine » JSPWiki » com » ecyrd » jspwiki » workflow » 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 » Wiki Engine » JSPWiki » com.ecyrd.jspwiki.workflow 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* 
002:            JSPWiki - a JSP-based WikiWiki clone.
003:
004:            Copyright (C) 2001-2002 Janne Jalkanen (Janne.Jalkanen@iki.fi)
005:
006:            This program is free software; you can redistribute it and/or modify
007:            it under the terms of the GNU Lesser General Public License as published by
008:            the Free Software Foundation; either version 2.1 of the License, or
009:            (at your option) any later version.
010:
011:            This program is distributed in the hope that it will be useful,
012:            but WITHOUT ANY WARRANTY; without even the implied warranty of
013:            MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
014:            GNU Lesser General Public License for more details.
015:
016:            You should have received a copy of the GNU Lesser General Public License
017:            along with this program; if not, write to the Free Software
018:            Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
019:         */
020:        package com.ecyrd.jspwiki.workflow;
021:
022:        /**
023:         * Resolution of a workflow Step, such as "approve," "deny," "hold," "task
024:         * error," or other potential resolutions.
025:         *
026:         * @author Andrew Jaquith
027:         * @since 2.5
028:         */
029:        public final class Outcome {
030:
031:            /** Complete workflow step (without errors) */
032:            public static final Outcome STEP_COMPLETE = new Outcome(
033:                    "outcome.step.complete", true);
034:
035:            /** Terminate workflow step (without errors) */
036:            public static final Outcome STEP_ABORT = new Outcome(
037:                    "outcome.step.abort", true);
038:
039:            /** Continue workflow step (without errors) */
040:            public static final Outcome STEP_CONTINUE = new Outcome(
041:                    "outcome.step.continue", false);
042:
043:            /** Acknowlege the Decision. */
044:            public static final Outcome DECISION_ACKNOWLEDGE = new Outcome(
045:                    "outcome.decision.acknowledge", true);
046:
047:            /** Approve the Decision (and complete the step). */
048:            public static final Outcome DECISION_APPROVE = new Outcome(
049:                    "outcome.decision.approve", true);
050:
051:            /** Deny the Decision (and complete the step). */
052:            public static final Outcome DECISION_DENY = new Outcome(
053:                    "outcome.decision.deny", true);
054:
055:            /** Put the Decision on hold (and pause the step). */
056:            public static final Outcome DECISION_HOLD = new Outcome(
057:                    "outcome.decision.hold", false);
058:
059:            /** Reassign the Decision to another actor (and pause the step). */
060:            public static final Outcome DECISION_REASSIGN = new Outcome(
061:                    "outcome.decision.reassign", false);
062:
063:            private static final Outcome[] OUTCOMES = new Outcome[] {
064:                    STEP_COMPLETE, STEP_ABORT, STEP_CONTINUE,
065:                    DECISION_ACKNOWLEDGE, DECISION_APPROVE, DECISION_DENY,
066:                    DECISION_HOLD, DECISION_REASSIGN };
067:
068:            private final String m_key;
069:
070:            private final boolean m_completion;
071:
072:            /**
073:             * Private constructor to prevent direct instantiation.
074:             *
075:             * @param key
076:             *            message key for the Outcome
077:             * @param completion
078:             *            whether this Outcome should be interpreted as the logical
079:             *            completion of a Step.
080:             */
081:            private Outcome(String key, boolean completion) {
082:                if (key == null) {
083:                    throw new IllegalArgumentException("Key cannot be null.");
084:                }
085:                m_key = key;
086:                m_completion = completion;
087:            }
088:
089:            /**
090:             * Returns <code>true</code> if this Outcome represents a completion
091:             * condition for a Step.
092:             *
093:             * @return the result
094:             */
095:            public boolean isCompletion() {
096:                return m_completion;
097:            }
098:
099:            /**
100:             * The i18n key for this outcome, which is prefixed by <code>outcome.</code>.
101:             * If calling classes wish to return a locale-specific name for this task
102:             * (such as "approve this request"), they can use this method to obtain the
103:             * correct key suffix.
104:             *
105:             * @return the i18n key for this outcome
106:             */
107:            public String getMessageKey() {
108:                return m_key;
109:            }
110:
111:            /**
112:             * The hashcode of an Outcome is identical to the hashcode of its message
113:             * key, multiplied by 2 if it is a "completion" Outcome.
114:             * @return the hash code
115:             */
116:            public int hashCode() {
117:                return m_key.hashCode() * (m_completion ? 1 : 2);
118:            }
119:
120:            /**
121:             * Two Outcome objects are equal if their message keys are equal.
122:             * @param obj the object to test
123:             * @return <code>true</code> if logically equal, <code>false</code> if not
124:             */
125:            public boolean equals(Object obj) {
126:                if (!(obj instanceof  Outcome)) {
127:                    return false;
128:                }
129:                return m_key.equals(((Outcome) obj).getMessageKey());
130:            }
131:
132:            /**
133:             * Returns a named Outcome. If an Outcome matching the supplied key is not
134:             * found, this method throws a {@link NoSuchOutcomeException}.
135:             *
136:             * @param key
137:             *            the name of the outcome
138:             * @return the Outcome
139:             * @throws NoSuchOutcomeException
140:             *             if an Outcome matching the key isn't found.
141:             */
142:            public static Outcome forName(String key)
143:                    throws NoSuchOutcomeException {
144:                if (key != null) {
145:                    for (int i = 0; i < OUTCOMES.length; i++) {
146:                        if (OUTCOMES[i].m_key.equals(key)) {
147:                            return OUTCOMES[i];
148:                        }
149:                    }
150:                }
151:                throw new NoSuchOutcomeException("Outcome " + key
152:                        + " not found.");
153:            }
154:
155:            /**
156:             * {@inheritDoc}
157:             */
158:            public String toString() {
159:                return "[Outcome:" + m_key + "]";
160:            }
161:
162:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.