KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > opensymphony > workflow > spi > WorkflowStore


1 /*
2  * Copyright (c) 2002-2003 by OpenSymphony
3  * All rights reserved.
4  */

5 package com.opensymphony.workflow.spi;
6
7 import com.opensymphony.module.propertyset.PropertySet;
8
9 import com.opensymphony.workflow.StoreException;
10 import com.opensymphony.workflow.query.WorkflowExpressionQuery;
11 import com.opensymphony.workflow.query.WorkflowQuery;
12
13 import java.util.*;
14
15
16 /**
17  * Interface for pluggable workflow stores configured in osworkflow.xml.
18  * Only one instance of a workflow store is ever created, meaning that
19  * if your persistence connections (such as java.sql.Connection) time out,
20  * it would be un-wise to use just one Connection for the entire object.
21  *
22  * @author <a HREF="mailto:plightbo@hotmail.com">Pat Lightbody</a>
23  */

24 public interface WorkflowStore {
25     //~ Methods ////////////////////////////////////////////////////////////////
26

27     /**
28      * Set the state of the workflow instance.
29      * @param entryId The workflow instance id.
30      * @param state The state to move the workflow instance to.
31      */

32     public void setEntryState(long entryId, int state) throws StoreException;
33
34     /**
35      * Returns a PropertySet that is associated with this workflow instance ID.
36      * @param entryId The workflow instance id.
37      * @return a property set unique to this entry ID
38      */

39     public PropertySet getPropertySet(long entryId) throws StoreException;
40
41     /**
42      * Persists a step with the given parameters.
43      *
44      * @param entryId The workflow instance id.
45      * @param stepId the ID of the workflow step associated with this new
46      * Step (not to be confused with the step primary key)
47      * @param owner the owner of the step
48      * @param startDate the start date of the step
49      * @param status the status of the step
50      * @param previousIds the previous step IDs
51      * @return a representation of the workflow step persisted
52      */

53     public Step createCurrentStep(long entryId, int stepId, String JavaDoc owner, Date startDate, Date dueDate, String JavaDoc status, long[] previousIds) throws StoreException;
54
55     /**
56      * Persists a new workflow entry that has <b>not been initialized</b>.
57      *
58      * @param workflowName the workflow name that this entry is an instance of
59      * @return a representation of the workflow instance persisted
60      */

61     public WorkflowEntry createEntry(String JavaDoc workflowName) throws StoreException;
62
63     /**
64      * Returns a list of all current steps for the given workflow instance ID.
65      *
66      * @param entryId The workflow instance id.
67      * @return a List of Steps
68      * @see com.opensymphony.workflow.spi.Step
69      */

70     public List findCurrentSteps(long entryId) throws StoreException;
71
72     /**
73      * Pulls up the workflow entry data for the entry ID given.
74      *
75      * @param entryId The workflow instance id.
76      * @return a representation of the workflow instance persisted
77      */

78     public WorkflowEntry findEntry(long entryId) throws StoreException;
79
80     /**
81      * Returns a list of all steps that are finished for the given workflow instance ID.
82      *
83      * @param entryId The workflow instance id.
84      * @return a List of Steps
85      * @see com.opensymphony.workflow.spi.Step
86      */

87     public List findHistorySteps(long entryId) throws StoreException;
88
89     /**
90      * Called once when the store is first created.
91      *
92      * @param props properties set in osworkflow.xml
93      */

94     public void init(Map props) throws StoreException;
95
96     public Step markFinished(Step step, int actionId, Date finishDate, String JavaDoc status, String JavaDoc caller) throws StoreException;
97
98     /**
99      * Called when a step is finished and can be moved to workflow history.
100      *
101      * @param step the step to be moved to workflow history
102      */

103     public void moveToHistory(Step step) throws StoreException;
104
105     /**
106      * @deprecated use {@link WorkflowStore#query(WorkflowExpressionQuery)} instead.
107      * @param query the query to use
108      * @return a List of workflow instance ID's
109      */

110     public List query(WorkflowQuery query) throws StoreException;
111
112     /**
113      * @param query the query to use
114      * @return a List of workflow instance ID's
115      */

116     public List query(WorkflowExpressionQuery query) throws StoreException;
117 }
118
Popular Tags