Source Code Cross Referenced for WMProcessInstanceState.java in  » Workflow-Engines » shark » org » enhydra » shark » api » client » wfmc » wapi » 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 » shark » org.enhydra.shark.api.client.wfmc.wapi 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*--
002:
003:         Copyright (C) 2002 Anthony Eden, Adrian Price.
004:         All rights reserved.
005:
006:         Redistribution and use in source and binary forms, with or without
007:         modification, are permitted provided that the following conditions
008:         are met:
009:
010:         1. Redistributions of source code must retain the above copyright
011:            notice, this list of conditions, and the following disclaimer.
012:
013:         2. Redistributions in binary form must reproduce the above copyright
014:            notice, this list of conditions, and the disclaimer that follows
015:            these conditions in the documentation and/or other materials
016:            provided with the distribution.
017:
018:         3. The names "OBE" and "Open Business Engine" must not be used to
019:            endorse or promote products derived from this software without prior
020:            written permission.  For written permission, please contact
021:            me@anthonyeden.com.
022:
023:         4. Products derived from this software may not be called "OBE" or
024:            "Open Business Engine", nor may "OBE" or "Open Business Engine"
025:            appear in their name, without prior written permission from
026:            Anthony Eden (me@anthonyeden.com).
027:
028:         In addition, I request (but do not require) that you include in the
029:         end-user documentation provided with the redistribution and/or in the
030:         software itself an acknowledgement equivalent to the following:
031:             "This product includes software developed by
032:              Anthony Eden (http://www.anthonyeden.com/)."
033:
034:         THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
035:         WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
036:         OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
037:         DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT,
038:         INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
039:         (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
040:         SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
041:         HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
042:         STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
043:         IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
044:         POSSIBILITY OF SUCH DAMAGE.
045:
046:         For more information on OBE, please see <http://obe.sourceforge.net/>.
047:
048:         */
049:
050:        package org.enhydra.shark.api.client.wfmc.wapi;
051:
052:        import org.enhydra.shark.api.common.SharkConstants;
053:
054:        /**
055:         * Describes the supported states of a process instance.  The states and their
056:         * descriptions are taken from WfMC Interface 2/3.
057:         * @author Adrian Price
058:         */
059:        public final class WMProcessInstanceState extends WMObjectState {
060:            static final long serialVersionUID = 8203181961666090141L;
061:
062:            /** @see #OPEN_NOTRUNNING_NOTSTARTED */
063:            public static final int OPEN_NOTRUNNING_NOTSTARTED_INT = 0;
064:            /** @see #OPEN_NOTRUNNING_SUSPENDED */
065:            public static final int OPEN_NOTRUNNING_SUSPENDED_INT = 1;
066:            /** @see #OPEN_RUNNING */
067:            public static final int OPEN_RUNNING_INT = 2;
068:            /** @see #CLOSED_ABORTED */
069:            public static final int CLOSED_ABORTED_INT = 3;
070:            /** @see #CLOSED_TERMINATED */
071:            public static final int CLOSED_TERMINATED_INT = 4;
072:            /** @see #CLOSED_COMPLETED */
073:            public static final int CLOSED_COMPLETED_INT = 5;
074:
075:            /** @see #OPEN_NOTRUNNING_NOTSTARTED */
076:            public static final String OPEN_NOTRUNNING_NOTSTARTED_TAG = SharkConstants.STATE_OPEN_NOT_RUNNING_NOT_STARTED;
077:            //        "open.notRunning.notStarted";
078:            /** @see #OPEN_NOTRUNNING_SUSPENDED */
079:            public static final String OPEN_NOTRUNNING_SUSPENDED_TAG = SharkConstants.STATE_OPEN_NOT_RUNNING_SUSPENDED;
080:            //        "open.notRunning.suspended";
081:            /** @see #OPEN_RUNNING */
082:            public static final String OPEN_RUNNING_TAG = SharkConstants.STATE_OPEN_RUNNING; // "open.running";
083:            /** @see #CLOSED_ABORTED */
084:            public static final String CLOSED_ABORTED_TAG = SharkConstants.STATE_CLOSED_ABORTED; // "closed.aborted";
085:            /** @see #CLOSED_TERMINATED */
086:            public static final String CLOSED_TERMINATED_TAG = SharkConstants.STATE_CLOSED_TERMINATED; // "closed.terminated";
087:            /** @see #CLOSED_COMPLETED */
088:            public static final String CLOSED_COMPLETED_TAG = SharkConstants.STATE_CLOSED_COMPLETED; // "closed.completed";
089:            private static final String[] TAGS = {
090:                    OPEN_NOTRUNNING_NOTSTARTED_TAG,
091:                    OPEN_NOTRUNNING_SUSPENDED_TAG, OPEN_RUNNING_TAG,
092:                    CLOSED_ABORTED_TAG, CLOSED_TERMINATED_TAG,
093:                    CLOSED_COMPLETED_TAG };
094:
095:            /** The process instance has been created, but was not started yet. */
096:            public static final WMProcessInstanceState OPEN_NOTRUNNING_NOTSTARTED = new WMProcessInstanceState(
097:                    OPEN_NOTRUNNING_NOTSTARTED_INT);
098:            /** Execution of the process instance was temporarily suspended. */
099:            public static final WMProcessInstanceState OPEN_NOTRUNNING_SUSPENDED = new WMProcessInstanceState(
100:                    OPEN_NOTRUNNING_SUSPENDED_INT);
101:            /** The process instance is executing. */
102:            public static final WMProcessInstanceState OPEN_RUNNING = new WMProcessInstanceState(
103:                    OPEN_RUNNING_INT);
104:            /**
105:             * Enactment of the process instance has been aborted by a user. (See the
106:             * specification of WMAbortProcessInstance for a definition of abortion in
107:             * contrast to termination).
108:             */
109:            public static final WMProcessInstanceState CLOSED_ABORTED = new WMProcessInstanceState(
110:                    CLOSED_ABORTED_INT);
111:            /**
112:             * Enactment of the process instance has been terminated by a user. (See
113:             * the specification of WMTerminateProcessInstance for a definition of
114:             * termination in contrast to abortion).
115:             */
116:            public static final WMProcessInstanceState CLOSED_TERMINATED = new WMProcessInstanceState(
117:                    CLOSED_TERMINATED_INT);
118:            /**
119:             * Enactment of the process instance has completed normally. (i.e., was not
120:             * forced by a user).
121:             */
122:            public static final WMProcessInstanceState CLOSED_COMPLETED = new WMProcessInstanceState(
123:                    CLOSED_COMPLETED_INT);
124:            private static final WMProcessInstanceState[] VALUES = {
125:                    OPEN_NOTRUNNING_NOTSTARTED, OPEN_NOTRUNNING_SUSPENDED,
126:                    OPEN_RUNNING, CLOSED_ABORTED, CLOSED_TERMINATED,
127:                    CLOSED_COMPLETED };
128:
129:            /** Abort the instance. */
130:            public static final int ABORT_ACTION = 0;
131:            /** Complete the instance. */
132:            public static final int COMPLETE_ACTION = 1;
133:            /** Create the instance. */
134:            public static final int CREATE_ACTION = 2;
135:            /** Delete the instance. */
136:            public static final int DELETE_ACTION = 3;
137:            /** Resume the instance. */
138:            public static final int RESUME_ACTION = 4;
139:            /** Start the instance. */
140:            public static final int START_ACTION = 5;
141:            /** Suspend the instance. */
142:            public static final int SUSPEND_ACTION = 6;
143:            /** Terminate the instance. */
144:            public static final int TERMINATE_ACTION = 7;
145:
146:            // new state = STATES[state][action]
147:            private static final int[][] STATES = {
148:                    //ABORT,              COMPLETE,             CREATE,         DELETE,                         RESUME,           START,            SUSPEND,                       TERMINATE,
149:                    { CLOSED_ABORTED_INT, ILLEGAL_ACTION, ILLEGAL_ACTION,
150:                            OPEN_NOTRUNNING_NOTSTARTED_INT, ILLEGAL_ACTION,
151:                            OPEN_RUNNING_INT, ILLEGAL_ACTION,
152:                            CLOSED_TERMINATED_INT }, // NOTSTARTED
153:                    { CLOSED_ABORTED_INT, ILLEGAL_ACTION, ILLEGAL_ACTION,
154:                            OPEN_NOTRUNNING_SUSPENDED_INT, OPEN_RUNNING_INT,
155:                            OPEN_RUNNING_INT, OPEN_NOTRUNNING_SUSPENDED_INT,
156:                            CLOSED_TERMINATED_INT }, // SUSPENDED
157:                    { CLOSED_ABORTED_INT, CLOSED_COMPLETED_INT, ILLEGAL_ACTION,
158:                            OPEN_RUNNING_INT, OPEN_RUNNING_INT,
159:                            OPEN_RUNNING_INT, OPEN_NOTRUNNING_SUSPENDED_INT,
160:                            CLOSED_TERMINATED_INT }, // RUNNING
161:                    { CLOSED_ABORTED_INT, ILLEGAL_ACTION, ILLEGAL_ACTION,
162:                            CLOSED_ABORTED_INT, ILLEGAL_ACTION, ILLEGAL_ACTION,
163:                            ILLEGAL_ACTION, ILLEGAL_ACTION }, // ABORTED
164:                    { ILLEGAL_ACTION, ILLEGAL_ACTION, ILLEGAL_ACTION,
165:                            CLOSED_TERMINATED_INT, ILLEGAL_ACTION,
166:                            ILLEGAL_ACTION, ILLEGAL_ACTION,
167:                            CLOSED_TERMINATED_INT }, // TERMINATED
168:                    { ILLEGAL_ACTION, CLOSED_COMPLETED_INT, ILLEGAL_ACTION,
169:                            CLOSED_COMPLETED_INT, ILLEGAL_ACTION,
170:                            ILLEGAL_ACTION, ILLEGAL_ACTION, ILLEGAL_ACTION } // COMPLETED
171:            };
172:            // action = ACTIONS[state][newState]
173:            private static final int[][] ACTIONS = {
174:                    // NOTSTARTED,    SUSPENDED,      RUNNING,        ABORTED,        TERMINATED,       COMPLETED
175:                    { NO_ACTION, ILLEGAL_ACTION, START_ACTION, ABORT_ACTION,
176:                            TERMINATE_ACTION, ILLEGAL_ACTION }, // NOTSTARTED
177:                    { ILLEGAL_ACTION, NO_ACTION, RESUME_ACTION, ABORT_ACTION,
178:                            TERMINATE_ACTION, ILLEGAL_ACTION }, // SUSPENDED
179:                    { ILLEGAL_ACTION, SUSPEND_ACTION, NO_ACTION, ABORT_ACTION,
180:                            TERMINATE_ACTION, COMPLETE_ACTION }, // RUNNING
181:                    { ILLEGAL_ACTION, ILLEGAL_ACTION, ILLEGAL_ACTION,
182:                            NO_ACTION, ILLEGAL_ACTION, ILLEGAL_ACTION }, // ABORTED
183:                    { ILLEGAL_ACTION, ILLEGAL_ACTION, ILLEGAL_ACTION,
184:                            ILLEGAL_ACTION, NO_ACTION, ILLEGAL_ACTION }, // TERMINATED
185:                    { ILLEGAL_ACTION, ILLEGAL_ACTION, ILLEGAL_ACTION,
186:                            ILLEGAL_ACTION, ILLEGAL_ACTION, NO_ACTION } // COMPLETED
187:            };
188:
189:            public static WMProcessInstanceState valueOf(String state) {
190:                return (WMProcessInstanceState) valueOf(TAGS, VALUES, state);
191:            }
192:
193:            public static WMProcessInstanceState valueOf(int state) {
194:                return VALUES[state];
195:            }
196:
197:            public static WMProcessInstanceState[] states() {
198:                return (WMProcessInstanceState[]) VALUES.clone();
199:            }
200:
201:            private WMProcessInstanceState(int state) {
202:                super (state);
203:            }
204:
205:            public boolean isClosed() {
206:                return _state == CLOSED_ABORTED_INT
207:                        || _state == CLOSED_TERMINATED_INT
208:                        || _state == CLOSED_COMPLETED_INT;
209:            }
210:
211:            public static boolean isClosed(int state) {
212:                return valueOf(state).isClosed();
213:            }
214:
215:            public boolean isOpen() {
216:                return _state == OPEN_NOTRUNNING_NOTSTARTED_INT
217:                        || _state == OPEN_NOTRUNNING_SUSPENDED_INT
218:                        || _state == OPEN_RUNNING_INT;
219:            }
220:
221:            public static boolean isOpen(int state) {
222:                return valueOf(state).isOpen();
223:            }
224:
225:            protected String[] getTags() {
226:                return TAGS;
227:            }
228:
229:            protected WMObjectState[] getValues() {
230:                return VALUES;
231:            }
232:
233:            protected int[] getStatesByAction() {
234:                return STATES[_state];
235:            }
236:
237:            protected int[] getActionsByState() {
238:                return ACTIONS[_state];
239:            }
240:
241:            public WMProcessInstanceState() {
242:            }
243:        }
w___w_w__._j___a_v__a_2__s___.__c___o__m_ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.