org.apache.ode.bpel.dao

## Interface ProcessInstanceDAO

- All Known Implementing Classes:
    ProcessInstanceDaoImpl, ProcessInstanceDaoImpl, ProcessInstanceDAOImpl

      public interface ProcessInstanceDAO

  BPEL process instance data access object. This object serves as the root object for data related to a particular process instance; this state includes auditing events, scopes, pick/received waiters, and the serialized process instance image.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Interface and Description
    --- | ---
    `static class` | `ProcessInstanceDAO.EventsFirstLastCountTuple` Transport object holding the date of the first and last instance event along with the number events.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `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` | `delete(java.util.Set<ProcessConf.CLEANUP_CATEGORY> cleanupCategories, boolean deleteMyRoleMex)` 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<java.lang.String>` | `getMessageExchangeIds()`
    `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).
    `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.

- - ### Method Detail

    - #### getCreateTime

          java.util.Date getCreateTime()

      Get the time when the process instance was created.
      Returns:
        time of instance creation

    - #### getLastActiveTime

          java.util.Date getLastActiveTime()

      Get the time when the process instance was last active (re-hydrated).
      Returns:
        time of activity

    - #### setLastActiveTime

          void setLastActiveTime(java.util.Date dt)

      Set last activity time for the process instance
      Parameters:
        `dt` - tiem of activity

    - #### setFault

          void setFault(FaultDAO fault)

      The un-caught fault associated with the process. This will be `null` if no fault occurred or if all faults are caught and processed.
      Parameters:
        `fault` - the fault

    - #### setFault

          void setFault(javax.xml.namespace.QName faultName,
                      java.lang.String explanation,
                      int faultLineNo,
                      int activityId,
                      org.w3c.dom.Element faultMessage)

    - #### getFault

          FaultDAO getFault()

      The un-caught fault associated with the process. This will be `null` if no fault occurred or if all faults are caught and processed.
      Returns:
        the fault

    - #### getExecutionState

          byte[] getExecutionState()

      Get the (opaque) instance execution state.
      Returns:
        opaque execution state

    - #### setExecutionState

          void setExecutionState(byte[] execState)

      Set the (opaque) instance execution state.
      Parameters:
        `execState` - execuction state

    - #### getProcess

          ProcessDAO getProcess()

      Get the process.
      Returns:
        process reference.

    - #### getRootScope

          ScopeDAO getRootScope()

      Get the root (global) scope for the process.
      Returns:
        the root scope

    - #### setState

          void setState(short state)

      Set the state of the process instance; one of the `STATE_XXX` constants defined in ProcessState. This should automatically populate the previous state.
      Parameters:
        `state` - new state of the process instance

    - #### getState

          short getState()

      Get the state of the process instance; one of the `STATE_XXX` constants defined in ProcessState.
      Returns:
        state of process instance

    - #### getPreviousState

          short getPreviousState()

      Returns the next to last state.
      Returns:

    - #### createScope

          ScopeDAO createScope(ScopeDAO parentScope,
                             java.lang.String name,
                             int scopeModelId)

      Creates a new scope.
      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

          java.lang.Long getInstanceId()

      Get the instance identifier.
      Returns:
        the instance identifier

    - #### getScope

          ScopeDAO getScope(java.lang.Long scopeInstanceId)

      Returns a scope using its instance id.
      Parameters:
        `scopeInstanceId` -
      Returns:

    - #### getScopes

          java.util.Collection<ScopeDAO> getScopes(java.lang.String scopeName)

      Returns all the scopes with the associated name.
      Parameters:
        `scopeName` -
      Returns:

    - #### getScopes

          java.util.Collection<ScopeDAO> getScopes()

      Returns all the scopes belonging to this isntance.
      Parameters:
        `scopeName` -
      Returns:

    - #### getInstantiatingCorrelator

          CorrelatorDAO getInstantiatingCorrelator()

      Return the correlator which results in the instantiation of the process instance.
      Returns:

    - #### getVariables

          XmlDataDAO[] getVariables(java.lang.String variableName,
                                  int scopeModelId)

      Returns all variable instances matching the variable name for a specified scope.

    - #### getCorrelationSets

          java.util.Set<CorrelationSetDAO> getCorrelationSets()

      Get all the correlation sets for this process.
      Returns:
        `Set` of `CorrelationSetDAO` objects

    - #### getCorrelationSet

          CorrelationSetDAO getCorrelationSet(java.lang.String name)

      Get a correlation set by its name from this process
      Parameters:
        `name` -
      Returns:
        a `CorrelationSetDAO` object

    - #### finishCompletion

          void finishCompletion()

      A simple callback to allow the ProcessInstance to perform post-completion duties. The DAO's state indicates whether any fault has occured.

    - #### delete

          void delete(java.util.Set<ProcessConf.CLEANUP_CATEGORY> cleanupCategories)

      Delete the process instance object from the database.

    - #### delete

          void delete(java.util.Set<ProcessConf.CLEANUP_CATEGORY> cleanupCategories,
                    boolean deleteMyRoleMex)

      Delete the process instance object from the database.
      Parameters:
        `cleanupCategories` - the categories of entities to delete
        `deleteMyRoleMex` - will clean up the my role mex if set to true

    - #### insertBpelEvent

          void insertBpelEvent(ProcessInstanceEvent event)

      Insert a BPEL event to the database (associating with this process).
      Parameters:
        `event` - BPEL event

    - #### getEventsFirstLastCount

          ProcessInstanceDAO.EventsFirstLastCountTuple getEventsFirstLastCount()

      Get a triple containing the first
      Returns:

    - #### genMonotonic

          long genMonotonic()

      Get the next number from a monotonically increasing sequence.
      Returns:
        next number in seqeunce

    - #### getConnection

          BpelDAOConnection getConnection()

    - #### getActivityFailureCount

          int getActivityFailureCount()

      Get number of activities in the failure state.

    - #### getActivityFailureDateTime

          java.util.Date getActivityFailureDateTime()

      Get date/time of last activity failure.

    - #### getActivityRecoveries

          java.util.Collection<ActivityRecoveryDAO> getActivityRecoveries()

      Returns all activity recovery objects for this process instance.

    - #### createActivityRecovery

          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. Specify the reason and optional data associated with the failure. Date/time failure occurred, and the recovery channel and available recovery actions.

    - #### deleteActivityRecovery

          void deleteActivityRecovery(java.lang.String channel)

      Delete previously registered activity recovery.

    - #### getMessageExchangeIds

          java.util.Collection<java.lang.String> getMessageExchangeIds()