org.apache.ode.dao.jpa
Class ProcessInstanceDAOImpl

java.lang.Object
  extended by org.apache.ode.dao.jpa.OpenJPADAO
      extended by org.apache.ode.dao.jpa.ProcessInstanceDAOImpl
All Implemented Interfaces:
ProcessInstanceDAO

public class ProcessInstanceDAOImpl
extends OpenJPADAO
implements ProcessInstanceDAO


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.ode.bpel.dao.ProcessInstanceDAO
ProcessInstanceDAO.EventsFirstLastCountTuple
 
Field Summary
static java.lang.String COUNT_FAILED_INSTANCES_BY_STATUS_AND_PROCESS_ID
           
static java.lang.String COUNT_INSTANCE_IDS_BY_PROCESS
           
static java.lang.String DELETE_INSTANCES_BY_PROCESS
           
static java.lang.String SELECT_FAULT_IDS_BY_PROCESS
           
static java.lang.String SELECT_INSTANCE_IDS_BY_PROCESS
           
 
Constructor Summary
ProcessInstanceDAOImpl()
           
ProcessInstanceDAOImpl(CorrelatorDAOImpl correlator, ProcessDAOImpl process)
           
 
Method Summary
 void createActivityRecovery(java.lang.String channel, long activityId, java.lang.String reason, java.util.Date dateTime, org.w3c.dom.Element data, java.lang.String[] actions, int retries)
          Create an activity recovery object for a given activity instance.
 ScopeDAO createScope(ScopeDAO parentScope, java.lang.String name, int scopeModelId)
          Creates a new scope.
 void delete(java.util.Set<ProcessConf.CLEANUP_CATEGORY> cleanupCategories)
          Delete the process instance object from the database.
 void deleteActivityRecovery(java.lang.String channel)
          Delete previously registered activity recovery.
 void finishCompletion()
          A simple callback to allow the ProcessInstance to perform post-completion duties.
 long genMonotonic()
          Get the next number from a monotonically increasing sequence.
 int getActivityFailureCount()
          Get number of activities in the failure state.
 java.util.Date getActivityFailureDateTime()
          Get date/time of last activity failure.
 java.util.Collection<ActivityRecoveryDAO> getActivityRecoveries()
          Returns all activity recovery objects for this process instance.
 BpelDAOConnection getConnection()
           
 CorrelationSetDAO getCorrelationSet(java.lang.String name)
          Get a correlation set by its name from this process
 java.util.Set<CorrelationSetDAO> getCorrelationSets()
          Get all the correlation sets for this process.
 java.util.Date getCreateTime()
          Get the time when the process instance was created.
 ProcessInstanceDAO.EventsFirstLastCountTuple getEventsFirstLastCount()
          Get a triple containing the first
 byte[] getExecutionState()
          Get the (opaque) instance execution state.
 FaultDAO getFault()
          The un-caught fault associated with the process.
 java.lang.Long getInstanceId()
          Get the instance identifier.
 CorrelatorDAO getInstantiatingCorrelator()
          Return the correlator which results in the instantiation of the process instance.
 java.util.Date getLastActiveTime()
          Get the time when the process instance was last active (re-hydrated).
 short getPreviousState()
          Returns the next to last state.
 ProcessDAO getProcess()
          Get the process.
 ScopeDAO getRootScope()
          Get the root (global) scope for the process.
 ScopeDAO getScope(java.lang.Long scopeInstanceId)
          Returns a scope using its instance id.
 java.util.Collection<ScopeDAO> getScopes()
          Returns all the scopes belonging to this isntance.
 java.util.Collection<ScopeDAO> getScopes(java.lang.String scopeName)
          Returns all the scopes with the associated name.
 short getState()
          Get the state of the process instance; one of the STATE_XXX constants defined in ProcessState.
 XmlDataDAO[] getVariables(java.lang.String variableName, int scopeModelId)
          Returns all variable instances matching the variable name for a specified scope.
 void insertBpelEvent(ProcessInstanceEvent event)
          Insert a BPEL event to the database (associating with this process).
 java.util.Collection<CorrelationSetDAO> selectCorrelationSets(java.util.Collection<ProcessInstanceDAO> instances)
           
 void setActivityFailureCount(int activityFailureCount)
           
 void setExecutionState(byte[] execState)
          Set the (opaque) instance execution state.
 void setFault(FaultDAO fault)
          The un-caught fault associated with the process.
 void setFault(javax.xml.namespace.QName faultName, java.lang.String explanation, int faultLineNo, int activityId, org.w3c.dom.Element faultMessage)
           
 void setLastActiveTime(java.util.Date dt)
          Set last activity time for the process instance
 void setState(short state)
          Set the state of the process instance; one of the STATE_XXX constants defined in ProcessState.
 
Methods inherited from class org.apache.ode.dao.jpa.OpenJPADAO
batchUpdateByIds, getConn, getEM, getSingleResult
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DELETE_INSTANCES_BY_PROCESS

public static final java.lang.String DELETE_INSTANCES_BY_PROCESS
See Also:
Constant Field Values

SELECT_INSTANCE_IDS_BY_PROCESS

public static final java.lang.String SELECT_INSTANCE_IDS_BY_PROCESS
See Also:
Constant Field Values

COUNT_INSTANCE_IDS_BY_PROCESS

public static final java.lang.String COUNT_INSTANCE_IDS_BY_PROCESS
See Also:
Constant Field Values

SELECT_FAULT_IDS_BY_PROCESS

public static final java.lang.String SELECT_FAULT_IDS_BY_PROCESS
See Also:
Constant Field Values

COUNT_FAILED_INSTANCES_BY_STATUS_AND_PROCESS_ID

public static final java.lang.String COUNT_FAILED_INSTANCES_BY_STATUS_AND_PROCESS_ID
See Also:
Constant Field Values
Constructor Detail

ProcessInstanceDAOImpl

public ProcessInstanceDAOImpl()

ProcessInstanceDAOImpl

public ProcessInstanceDAOImpl(CorrelatorDAOImpl correlator,
                              ProcessDAOImpl process)
Method Detail

createActivityRecovery

public void createActivityRecovery(java.lang.String channel,
                                   long activityId,
                                   java.lang.String reason,
                                   java.util.Date dateTime,
                                   org.w3c.dom.Element data,
                                   java.lang.String[] actions,
                                   int retries)
Description copied from interface: ProcessInstanceDAO
Create an activity recovery object for a given activity instance. Specify the reason and optional data associated with the failure. Date/time failure occurred, and the recovery channel and available recovery actions.

Specified by:
createActivityRecovery in interface ProcessInstanceDAO

createScope

public ScopeDAO createScope(ScopeDAO parentScope,
                            java.lang.String name,
                            int scopeModelId)
Description copied from interface: ProcessInstanceDAO
Creates a new scope.

Specified by:
createScope in interface ProcessInstanceDAO
Parameters:
parentScope - parent scope of the new scope, or null if this is the root scope.
name - scope name
Returns:
the newly created scope

selectCorrelationSets

public java.util.Collection<CorrelationSetDAO> selectCorrelationSets(java.util.Collection<ProcessInstanceDAO> instances)

delete

public void delete(java.util.Set<ProcessConf.CLEANUP_CATEGORY> cleanupCategories)
Description copied from interface: ProcessInstanceDAO
Delete the process instance object from the database.

Specified by:
delete in interface ProcessInstanceDAO

deleteActivityRecovery

public void deleteActivityRecovery(java.lang.String channel)
Description copied from interface: ProcessInstanceDAO
Delete previously registered activity recovery.

Specified by:
deleteActivityRecovery in interface ProcessInstanceDAO

finishCompletion

public void finishCompletion()
Description copied from interface: ProcessInstanceDAO
A simple callback to allow the ProcessInstance to perform post-completion duties. The DAO's state indicates whether any fault has occured.

Specified by:
finishCompletion in interface ProcessInstanceDAO

genMonotonic

public long genMonotonic()
Description copied from interface: ProcessInstanceDAO
Get the next number from a monotonically increasing sequence.

Specified by:
genMonotonic in interface ProcessInstanceDAO
Returns:
next number in seqeunce

getActivityFailureCount

public int getActivityFailureCount()
Description copied from interface: ProcessInstanceDAO
Get number of activities in the failure state.

Specified by:
getActivityFailureCount in interface ProcessInstanceDAO

setActivityFailureCount

public void setActivityFailureCount(int activityFailureCount)

getActivityFailureDateTime

public java.util.Date getActivityFailureDateTime()
Description copied from interface: ProcessInstanceDAO
Get date/time of last activity failure.

Specified by:
getActivityFailureDateTime in interface ProcessInstanceDAO

getActivityRecoveries

public java.util.Collection<ActivityRecoveryDAO> getActivityRecoveries()
Description copied from interface: ProcessInstanceDAO
Returns all activity recovery objects for this process instance.

Specified by:
getActivityRecoveries in interface ProcessInstanceDAO

getCorrelationSet

public CorrelationSetDAO getCorrelationSet(java.lang.String name)
Description copied from interface: ProcessInstanceDAO
Get a correlation set by its name from this process

Specified by:
getCorrelationSet in interface ProcessInstanceDAO
Returns:
a CorrelationSetDAO object

getCorrelationSets

public java.util.Set<CorrelationSetDAO> getCorrelationSets()
Description copied from interface: ProcessInstanceDAO
Get all the correlation sets for this process.

Specified by:
getCorrelationSets in interface ProcessInstanceDAO
Returns:
Set of CorrelationSetDAO objects

getCreateTime

public java.util.Date getCreateTime()
Description copied from interface: ProcessInstanceDAO
Get the time when the process instance was created.

Specified by:
getCreateTime in interface ProcessInstanceDAO
Returns:
time of instance creation

getEventsFirstLastCount

public ProcessInstanceDAO.EventsFirstLastCountTuple getEventsFirstLastCount()
Description copied from interface: ProcessInstanceDAO
Get a triple containing the first

Specified by:
getEventsFirstLastCount in interface ProcessInstanceDAO
Returns:

getExecutionState

public byte[] getExecutionState()
Description copied from interface: ProcessInstanceDAO
Get the (opaque) instance execution state.

Specified by:
getExecutionState in interface ProcessInstanceDAO
Returns:
opaque execution state

getFault

public FaultDAO getFault()
Description copied from interface: ProcessInstanceDAO
The un-caught fault associated with the process. This will be null if no fault occurred or if all faults are caught and processed.

Specified by:
getFault in interface ProcessInstanceDAO
Returns:
the fault

getInstanceId

public java.lang.Long getInstanceId()
Description copied from interface: ProcessInstanceDAO
Get the instance identifier.

Specified by:
getInstanceId in interface ProcessInstanceDAO
Returns:
the instance identifier

getInstantiatingCorrelator

public CorrelatorDAO getInstantiatingCorrelator()
Description copied from interface: ProcessInstanceDAO
Return the correlator which results in the instantiation of the process instance.

Specified by:
getInstantiatingCorrelator in interface ProcessInstanceDAO
Returns:

getLastActiveTime

public java.util.Date getLastActiveTime()
Description copied from interface: ProcessInstanceDAO
Get the time when the process instance was last active (re-hydrated).

Specified by:
getLastActiveTime in interface ProcessInstanceDAO
Returns:
time of activity

getPreviousState

public short getPreviousState()
Description copied from interface: ProcessInstanceDAO
Returns the next to last state.

Specified by:
getPreviousState in interface ProcessInstanceDAO
Returns:

getProcess

public ProcessDAO getProcess()
Description copied from interface: ProcessInstanceDAO
Get the process.

Specified by:
getProcess in interface ProcessInstanceDAO
Returns:
process reference.

getRootScope

public ScopeDAO getRootScope()
Description copied from interface: ProcessInstanceDAO
Get the root (global) scope for the process.

Specified by:
getRootScope in interface ProcessInstanceDAO
Returns:
the root scope

getScope

public ScopeDAO getScope(java.lang.Long scopeInstanceId)
Description copied from interface: ProcessInstanceDAO
Returns a scope using its instance id.

Specified by:
getScope in interface ProcessInstanceDAO
Returns:

getScopes

public java.util.Collection<ScopeDAO> getScopes(java.lang.String scopeName)
Description copied from interface: ProcessInstanceDAO
Returns all the scopes with the associated name.

Specified by:
getScopes in interface ProcessInstanceDAO
Returns:

getScopes

public java.util.Collection<ScopeDAO> getScopes()
Description copied from interface: ProcessInstanceDAO
Returns all the scopes belonging to this isntance.

Specified by:
getScopes in interface ProcessInstanceDAO
Returns:

getState

public short getState()
Description copied from interface: ProcessInstanceDAO
Get the state of the process instance; one of the STATE_XXX constants defined in ProcessState.

Specified by:
getState in interface ProcessInstanceDAO
Returns:
state of process instance

getVariables

public XmlDataDAO[] getVariables(java.lang.String variableName,
                                 int scopeModelId)
Description copied from interface: ProcessInstanceDAO
Returns all variable instances matching the variable name for a specified scope.

Specified by:
getVariables in interface ProcessInstanceDAO

insertBpelEvent

public void insertBpelEvent(ProcessInstanceEvent event)
Description copied from interface: ProcessInstanceDAO
Insert a BPEL event to the database (associating with this process).

Specified by:
insertBpelEvent in interface ProcessInstanceDAO
Parameters:
event - BPEL event

setExecutionState

public void setExecutionState(byte[] execState)
Description copied from interface: ProcessInstanceDAO
Set the (opaque) instance execution state.

Specified by:
setExecutionState in interface ProcessInstanceDAO
Parameters:
execState - execuction state

setFault

public void setFault(FaultDAO fault)
Description copied from interface: ProcessInstanceDAO
The un-caught fault associated with the process. This will be null if no fault occurred or if all faults are caught and processed.

Specified by:
setFault in interface ProcessInstanceDAO
Parameters:
fault - the fault

setFault

public void setFault(javax.xml.namespace.QName faultName,
                     java.lang.String explanation,
                     int faultLineNo,
                     int activityId,
                     org.w3c.dom.Element faultMessage)
Specified by:
setFault in interface ProcessInstanceDAO

setLastActiveTime

public void setLastActiveTime(java.util.Date dt)
Description copied from interface: ProcessInstanceDAO
Set last activity time for the process instance

Specified by:
setLastActiveTime in interface ProcessInstanceDAO
Parameters:
dt - tiem of activity

setState

public void setState(short state)
Description copied from interface: ProcessInstanceDAO
Set the state of the process instance; one of the STATE_XXX constants defined in ProcessState. This should automatically populate the previous state.

Specified by:
setState in interface ProcessInstanceDAO
Parameters:
state - new state of the process instance

getConnection

public BpelDAOConnection getConnection()
Specified by:
getConnection in interface ProcessInstanceDAO