org.apache.ode.daohib.bpel
Class ProcessInstanceDaoImpl

java.lang.Object
  extended by org.apache.ode.daohib.bpel.HibernateDao
      extended by org.apache.ode.daohib.bpel.ProcessInstanceDaoImpl
All Implemented Interfaces:
ProcessInstanceDAO

public class ProcessInstanceDaoImpl
extends HibernateDao
implements ProcessInstanceDAO

Hibernate-based ProcessInstanceDAO implementation.


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.ode.bpel.dao.ProcessInstanceDAO
ProcessInstanceDAO.EventsFirstLastCountTuple
 
Field Summary
 
Fields inherited from class org.apache.ode.daohib.bpel.HibernateDao
_hobj, _sm
 
Constructor Summary
ProcessInstanceDaoImpl(SessionManager sm, HProcessInstance instance)
           
 
Method Summary
protected  void clearSelectors()
           
 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).
 java.util.Collection<MessageExchangeDAO> getMessageExchanges()
           
 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)
          TODO this is never used, except by test cases - should be removed
 void insertBpelEvent(ProcessInstanceEvent event)
          Insert a BPEL event to the database (associating with this process).
 void setExecutionState(byte[] bytes)
          Set the (opaque) instance execution state.
 void setFault(FaultDAO fault)
          The un-caught fault associated with the process.
 void setFault(javax.xml.namespace.QName name, java.lang.String explanation, int lineNo, int activityId, org.w3c.dom.Element faultData)
           
 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.daohib.bpel.HibernateDao
equals, getDHandle, getHibernateObj, getId, getSession, hashCode, update
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProcessInstanceDaoImpl

public ProcessInstanceDaoImpl(SessionManager sm,
                              HProcessInstance instance)
Method Detail

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
See Also:
ProcessInstanceDAO.getCreateTime()

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 name,
                     java.lang.String explanation,
                     int lineNo,
                     int activityId,
                     org.w3c.dom.Element faultData)
Specified by:
setFault in interface ProcessInstanceDAO
See Also:
ProcessInstanceDAO.setFault(javax.xml.namespace.QName, String, int, int, org.w3c.dom.Element)

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
See Also:
ProcessInstanceDAO.getFault()

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
See Also:
ProcessInstanceDAO.getExecutionState()

setExecutionState

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

Specified by:
setExecutionState in interface ProcessInstanceDAO
Parameters:
bytes - execuction state
See Also:
ProcessInstanceDAO.setExecutionState(byte[])

getProcess

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

Specified by:
getProcess in interface ProcessInstanceDAO
Returns:
process reference.
See Also:
ProcessInstanceDAO.getProcess()

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
See Also:
ProcessInstanceDAO.getRootScope()

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
See Also:
ProcessInstanceDAO.setState(short)

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
See Also:
ProcessInstanceDAO.getState()

getPreviousState

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

Specified by:
getPreviousState in interface ProcessInstanceDAO
Returns:
See Also:
ProcessInstanceDAO.getPreviousState()

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

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
See Also:
ProcessInstanceDAO.getInstanceId()

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:
See Also:
ProcessInstanceDAO.getScopes(java.lang.String)

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:

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:
See Also:
ProcessInstanceDAO.getInstantiatingCorrelator()

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
See Also:
ProcessInstanceDAO.getLastActiveTime()

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
See Also:
ProcessInstanceDAO.setLastActiveTime(java.util.Date)

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

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

getVariables

public XmlDataDAO[] getVariables(java.lang.String variableName,
                                 int scopeModelId)
TODO this is never used, except by test cases - should be removed

Specified by:
getVariables in interface ProcessInstanceDAO
See Also:
ProcessInstanceDAO.getVariables(java.lang.String, int)

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
See Also:
ProcessInstanceDAO.finishCompletion()

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

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

getEventsFirstLastCount

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

Specified by:
getEventsFirstLastCount in interface ProcessInstanceDAO
Returns:

getMessageExchanges

public java.util.Collection<MessageExchangeDAO> getMessageExchanges()

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

clearSelectors

protected void clearSelectors()

getActivityFailureCount

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

Specified by:
getActivityFailureCount in interface ProcessInstanceDAO

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

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

deleteActivityRecovery

public void deleteActivityRecovery(java.lang.String channel)
Delete previously registered activity recovery.

Specified by:
deleteActivityRecovery in interface ProcessInstanceDAO

getConnection

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