KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > lenya > workflow > WorkflowInstance


1 /*
2  * Copyright 1999-2004 The Apache Software Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */

17
18 /* $Id: WorkflowInstance.java 42598 2004-03-01 16:18:28Z gregor $ */
19
20 package org.apache.lenya.workflow;
21
22 /**
23  * <p>A workflow instance is an incarnation of a workflow schema. It consists of</p>
24  * <ul>
25  * <li>a current state,</li>
26  * <li>a mapping which assigns values to all state variables.</li>
27  * </ul>
28  */

29 public interface WorkflowInstance {
30     /**
31      * Returns the workflow this instance belongs to.
32      * @return A Workflow object.
33      */

34     Workflow getWorkflow();
35
36     /**
37      * Returns the current state of this WorkflowInstance.
38      *
39      * @return the current state
40      */

41     State getCurrentState();
42
43     /**
44      * Returns the executable events in a certain situation.
45      * @param situation The situation.
46      * @return An array of events.
47      * @throws WorkflowException when something went wrong.
48      */

49     Event[] getExecutableEvents(Situation situation) throws WorkflowException;
50
51     /**
52      * Indicates that the user invoked an event.
53      *
54      * @param situation The situation in which the event was invoked.
55      * @param event The event that was invoked.
56      * @throws WorkflowException when something went wrong.
57      */

58     void invoke(Situation situation, Event event) throws WorkflowException;
59
60     /**
61      * Returns the current value of a variable.
62      * @param variableName A variable name.
63      * @return A boolean value.
64      * @throws WorkflowException when the variable does not exist.
65      */

66     boolean getValue(String JavaDoc variableName) throws WorkflowException;
67
68     /**
69      * Adds a workflow listener.
70      * @param listener The listener to add.
71      */

72     void addWorkflowListener(WorkflowListener listener);
73
74     /**
75      * Removes a workflow listener.
76      * @param listener The listener to remove.
77      */

78     void removeWorkflowListener(WorkflowListener listener);
79
80     /**
81      * Returns if the transition for a certain event is synchronized.
82      * @param event An event.
83      * @return A boolean value.
84      */

85     boolean isSynchronized(Event event) throws WorkflowException;
86 }
87
Popular Tags