com.opensymphony.workflow.spi.jdbc
Class JDBCWorkflowStore

java.lang.Object
  extended by com.opensymphony.workflow.spi.jdbc.JDBCWorkflowStore
All Implemented Interfaces:
WorkflowStore
Direct Known Subclasses:
MySQLWorkflowStore

public class JDBCWorkflowStore
extends Object
implements WorkflowStore

JDBC implementation.

The following properties are all required:

Author:
Pat Lightbody

Field Summary
protected  boolean closeConnWhenDone
           
protected  String currentPrevTable
           
protected  String currentTable
           
protected  javax.sql.DataSource ds
           
protected  String entryId
           
protected  String entryName
           
protected  String entrySequence
           
protected  String entryState
           
protected  String entryTable
           
protected  String historyPrevTable
           
protected  String historyTable
           
protected  String stepActionId
           
protected  String stepCaller
           
protected  String stepDueDate
           
protected  String stepEntryId
           
protected  String stepFinishDate
           
protected  String stepId
           
protected  String stepOwner
           
protected  String stepPreviousId
           
protected  String stepSequence
           
protected  String stepStartDate
           
protected  String stepStatus
           
protected  String stepStepId
           
 
Constructor Summary
JDBCWorkflowStore()
           
 
Method Summary
protected  void addPreviousSteps(Connection conn, long id, long[] previousIds)
           
 boolean checkIfORExists(NestedExpression nestedExpression)
           
protected  void cleanup(Connection connection, Statement statement, ResultSet result)
           
protected  long createCurrentStep(Connection conn, long entryId, int wfStepId, String owner, Date startDate, Date dueDate, String status)
           
 Step createCurrentStep(long entryId, int wfStepId, String owner, Date startDate, Date dueDate, String status, long[] previousIds)
          Persists a step with the given parameters.
 WorkflowEntry createEntry(String workflowName)
          Persists a new workflow entry that has not been initialized.
 List findCurrentSteps(long entryId)
          Returns a list of all current steps for the given workflow instance ID.
 WorkflowEntry findEntry(long theEntryId)
          Pulls up the workflow entry data for the entry ID given.
 List findHistorySteps(long entryId)
          Returns a list of all steps that are finished for the given workflow instance ID.
protected  Connection getConnection()
           
protected  long getNextEntrySequence(Connection c)
           
protected  long getNextStepSequence(Connection c)
           
 com.opensymphony.module.propertyset.PropertySet getPropertySet(long entryId)
          Returns a PropertySet that is associated with this workflow instance ID.
 void init(Map props)
          Called once when the store is first created.
 Step markFinished(Step step, int actionId, Date finishDate, String status, String caller)
          Mark the specified step as finished.
 void moveToHistory(Step step)
          Called when a step is finished and can be moved to workflow history.
 List query(WorkflowExpressionQuery e)
           
 List query(WorkflowQuery query)
           
 void setEntryState(long id, int state)
          Set the state of the workflow instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ds

protected javax.sql.DataSource ds

currentPrevTable

protected String currentPrevTable

currentTable

protected String currentTable

entryId

protected String entryId

entryName

protected String entryName

entrySequence

protected String entrySequence

entryState

protected String entryState

entryTable

protected String entryTable

historyPrevTable

protected String historyPrevTable

historyTable

protected String historyTable

stepActionId

protected String stepActionId

stepCaller

protected String stepCaller

stepDueDate

protected String stepDueDate

stepEntryId

protected String stepEntryId

stepFinishDate

protected String stepFinishDate

stepId

protected String stepId

stepOwner

protected String stepOwner

stepPreviousId

protected String stepPreviousId

stepSequence

protected String stepSequence

stepStartDate

protected String stepStartDate

stepStatus

protected String stepStatus

stepStepId

protected String stepStepId

closeConnWhenDone

protected boolean closeConnWhenDone
Constructor Detail

JDBCWorkflowStore

public JDBCWorkflowStore()
Method Detail

setEntryState

public void setEntryState(long id,
                          int state)
                   throws StoreException
Description copied from interface: WorkflowStore
Set the state of the workflow instance.

Specified by:
setEntryState in interface WorkflowStore
Parameters:
id - The workflow instance id.
state - The state to move the workflow instance to.
Throws:
StoreException

getPropertySet

public com.opensymphony.module.propertyset.PropertySet getPropertySet(long entryId)
Description copied from interface: WorkflowStore
Returns a PropertySet that is associated with this workflow instance ID.

Specified by:
getPropertySet in interface WorkflowStore
Parameters:
entryId - The workflow instance id.
Returns:
a property set unique to this entry ID

checkIfORExists

public boolean checkIfORExists(NestedExpression nestedExpression)

createCurrentStep

public Step createCurrentStep(long entryId,
                              int wfStepId,
                              String owner,
                              Date startDate,
                              Date dueDate,
                              String status,
                              long[] previousIds)
                       throws StoreException
Description copied from interface: WorkflowStore
Persists a step with the given parameters.

Specified by:
createCurrentStep in interface WorkflowStore
Parameters:
entryId - The workflow instance id.
wfStepId - the ID of the workflow step associated with this new Step (not to be confused with the step primary key)
owner - the owner of the step
startDate - the start date of the step
status - the status of the step
previousIds - the previous step IDs
Returns:
a representation of the workflow step persisted
Throws:
StoreException

createEntry

public WorkflowEntry createEntry(String workflowName)
                          throws StoreException
Description copied from interface: WorkflowStore
Persists a new workflow entry that has not been initialized.

Specified by:
createEntry in interface WorkflowStore
Parameters:
workflowName - the workflow name that this entry is an instance of
Returns:
a representation of the workflow instance persisted
Throws:
StoreException

findCurrentSteps

public List findCurrentSteps(long entryId)
                      throws StoreException
Description copied from interface: WorkflowStore
Returns a list of all current steps for the given workflow instance ID.

Specified by:
findCurrentSteps in interface WorkflowStore
Parameters:
entryId - The workflow instance id.
Returns:
a List of Steps
Throws:
StoreException
See Also:
Step

findEntry

public WorkflowEntry findEntry(long theEntryId)
                        throws StoreException
Description copied from interface: WorkflowStore
Pulls up the workflow entry data for the entry ID given.

Specified by:
findEntry in interface WorkflowStore
Parameters:
theEntryId - The workflow instance id.
Returns:
a representation of the workflow instance persisted
Throws:
StoreException

findHistorySteps

public List findHistorySteps(long entryId)
                      throws StoreException
Description copied from interface: WorkflowStore
Returns a list of all steps that are finished for the given workflow instance ID.

Specified by:
findHistorySteps in interface WorkflowStore
Parameters:
entryId - The workflow instance id.
Returns:
a List of Steps
Throws:
StoreException
See Also:
Step

init

public void init(Map props)
          throws StoreException
Description copied from interface: WorkflowStore
Called once when the store is first created.

Specified by:
init in interface WorkflowStore
Parameters:
props - properties set in osworkflow.xml
Throws:
StoreException

markFinished

public Step markFinished(Step step,
                         int actionId,
                         Date finishDate,
                         String status,
                         String caller)
                  throws StoreException
Description copied from interface: WorkflowStore
Mark the specified step as finished.

Specified by:
markFinished in interface WorkflowStore
Parameters:
step - the step to finish.
actionId - The action that caused the step to finish.
finishDate - the date when the step was finished.
status - The status to set the finished step to.
caller - The caller that caused the step to finish.
Returns:
the finished step
Throws:
StoreException

moveToHistory

public void moveToHistory(Step step)
                   throws StoreException
Description copied from interface: WorkflowStore
Called when a step is finished and can be moved to workflow history.

Specified by:
moveToHistory in interface WorkflowStore
Parameters:
step - the step to be moved to workflow history
Throws:
StoreException

query

public List query(WorkflowExpressionQuery e)
           throws StoreException
Specified by:
query in interface WorkflowStore
Parameters:
e - the query to use
Returns:
a List of workflow instance ID's
Throws:
StoreException

query

public List query(WorkflowQuery query)
           throws StoreException
Specified by:
query in interface WorkflowStore
Parameters:
query - the query to use
Returns:
a List of workflow instance ID's
Throws:
StoreException

getConnection

protected Connection getConnection()
                            throws SQLException
Throws:
SQLException

getNextEntrySequence

protected long getNextEntrySequence(Connection c)
                             throws SQLException
Throws:
SQLException

getNextStepSequence

protected long getNextStepSequence(Connection c)
                            throws SQLException
Throws:
SQLException

addPreviousSteps

protected void addPreviousSteps(Connection conn,
                                long id,
                                long[] previousIds)
                         throws SQLException
Throws:
SQLException

cleanup

protected void cleanup(Connection connection,
                       Statement statement,
                       ResultSet result)

createCurrentStep

protected long createCurrentStep(Connection conn,
                                 long entryId,
                                 int wfStepId,
                                 String owner,
                                 Date startDate,
                                 Date dueDate,
                                 String status)
                          throws SQLException
Throws:
SQLException

OpenSymphony Workflow Project Page