Interface ActivityTermination


  • public interface ActivityTermination
    This interface provides the means to control terminating events of an activity, that is, finishing, suspending and failing an activity. These transitions are used by runtime managers when the corresponding application has signalled an event.
    The activity has to be in a proper state, for instance, it will not be allowed to be started if it is not activated. For the appropriate state transitions refer to the ADEPT-metamodel.
    • Method Detail

      • activityFinished

        void activityFinished​(SessionToken session,
                              EBPInstanceReference activity,
                              DataContainer dataContainer)
                       throws InvalidActivityStateException
        Signals the termination of an activity, which means, setting the state of the process step accordingly, storing the values of the output parameters - encapsulated in the designated data container - and activating new process steps if appropriate. This method is called by the runtime manager.
        The activity needs to be managed by this execution manager and has to be in an appropriate state (NS_RUNNING).
        For tracking purpose the corresponding agent is logged and set as performing agent for the node. This does not apply if there are still enquiries on the activity. In this case the first agent (the one starting the enquiries) is set as performing agent for the node. Additionally, with open enquiries the worklist item is not removed but set to WorklistConstants.WorklistItemState.ENQUIRED.
        If the last process step is finished, the corresponding instance (and therefore the corresponding super-activity in case of a subprocess) is also set to finished.
        Parameters:
        session - The session which is used to check for access rights on this method.
        activity - The unique ID of the activity to set to NS_COMPLETED.
        dataContainer - The corresponding data container that contains the values of the output parameters of the activity. The caller is responsible for closing.
        Throws:
        InvalidActivityStateException - If the activity (process step) is not running, an InvalidActivityStateException will be raised.
        WrongExecutionManagerException - If the designated activity is not managed by this execution manager, a WrongExecutionManagerException will be raised.
        See Also:
        ProcessConstants.NodeState
      • activitySuspended

        void activitySuspended​(SessionToken session,
                               EBPInstanceReference activity,
                               DataContainer dataContainer)
                        throws InvalidActivityStateException
        Signals a suspending of an activity, which means, setting the state of the process step accordingly and storing the values of the output parameters - encapsulated in the designated data container. This method is called by the runtime manager. For tracking purpose the corresponding agent is logged and set as performing agent for the node.
        The activity needs to be managed by this execution manager and has to be in an appropriate state (NS_RUNNING).
        Parameters:
        session - The session which is used to check for access rights on this method. This can also be used to allow only a dependent session to resume the designated activity. The policy is determined by the corresponding implementation.
        activity - The unique ID of the activity to set to NS_SUSPENDED.
        dataContainer - The corresponding data container that contains the values of the output parameters of the activity. The caller is responsible for closing.
        Throws:
        InvalidActivityStateException - If the activity (process step) is not running, an InvalidActivityStateException will be raised.
        WrongExecutionManagerException - If the designated activity is not managed by this execution manager, a WrongExecutionManagerException will be raised.
        See Also:
        ProcessConstants.NodeState
      • activitySuspended

        void activitySuspended​(SessionToken session,
                               EBPInstanceReference activity,
                               DataContainer dataContainer,
                               String savepoint)
                        throws InvalidActivityStateException
        Signals a suspending of an activity, which means, setting the state of the process step accordingly and storing the values of the output parameters - encapsulated in the designated data container. For the current values the designated savepoint name will be used. This method is called by the runtime manager. For tracking purpose the corresponding agent is logged and set as performing agent for the node.
        The activity needs to be managed by this execution manager and has to be in an appropriate state (NS_RUNNING).
        Parameters:
        session - The session which is used to check for access rights on this method. This can also be used to allow only a dependent session to resume the designated activity. The policy is determined by the corresponding implementation.
        activity - The unique ID of the activity to set to NS_SUSPENDED.
        dataContainer - The corresponding data container that contains the values of the output parameters of the activity. The caller is responsible for closing.
        savepoint - The ID of the savepoint for the state defined by the designated data container. If there is already a savepoint of this name, it will be overwritten. This must not be the empty string! If this is null, the implicit savepoint will be used (and possibly overwritten).
        Throws:
        InvalidActivityStateException - If the activity (process step) is not running, an InvalidActivityStateException will be raised.
        WrongExecutionManagerException - If the designated activity is not managed by this execution manager, a WrongExecutionManagerException will be raised.
        See Also:
        ProcessConstants.NodeState
      • activityReset

        void activityReset​(SessionToken session,
                           EBPInstanceReference activity)
                    throws InvalidActivityStateException
        Signals a reset of a running activity, which means, the current state (including the written values) is completely dropped and resetting the state of the node to NS_ACTIVATED. This method is called by the runtime manager. For tracking purpose the agent executing the activity as well as the resetting agent is logged.
        The activity needs to be managed by this execution manager and has to be in an appropriate state (NS_RUNNING).
        Parameters:
        session - The session which is used to check for access rights on this method and to retrieve the resetting agent and the corresponding organisational position for logging purpose.
        activity - The reference identifying the activity to reset.
        Throws:
        InvalidActivityStateException - If the activity (process step) is not running or suspended or failed, an InvalidActivityStateException will be raised.
        WrongExecutionManagerException - If the designated activity is not managed by this execution manager, a WrongExecutionManagerException will be raised.
        See Also:
        ProcessConstants.NodeState
      • activityResetTo

        void activityResetTo​(SessionToken session,
                             EBPInstanceReference activity,
                             String savepoint)
                      throws InvalidActivityStateException
        Signals a reset of a running activity to the designated savepoint. That is, the current state (including the written values) is completely dropped until the designated savepoint. The state of the node is NS_SUSPENDED. This method is called by the runtime manager. For tracking purpose the agent executing the activity as well as the resetting agent is logged.
        The activity needs to be managed by this execution manager and has to be in an appropriate state (NS_RUNNING).
        Parameters:
        session - The session which is used to check for access rights on this method and to retrieve the resetting agent and the corresponding organisational position for logging purpose.
        activity - The reference identifying the activity to reset.
        savepoint - The savepoint to which to reset the activity. If this is null the last implicit savepoint will be used. If the savepoint does not exist, the activity will be reset completely.
        Throws:
        InvalidActivityStateException - If the activity (process step) is not running or suspended or failed, an InvalidActivityStateException will be raised.
        WrongExecutionManagerException - If the designated activity is not managed by this execution manager, a WrongExecutionManagerException will be raised.
        See Also:
        ProcessConstants.NodeState
      • activityFailed

        void activityFailed​(SessionToken session,
                            EBPInstanceReference activity,
                            DataContainer dataContainer,
                            String errorMessage,
                            String state,
                            long errorCode)
                     throws InvalidActivityStateException
        Signals the failure of an activity, which means, setting the state of the process step accordingly and starting appropriate measures, for instance, rolling back or restarting. This method is called by the runtime manager. For tracking purpose the corresponding agent is logged and set as performing agent for the node. The corresponding worklist item is removed.
        When failing the activity should provide adequate information, for instance, an error code and an error message which can be used to perform failure handling.
        The activity needs to be managed by this execution manager and has to be in an appropriate state (NS_RUNNING, NS_SUSPENDED or NS_SUSPENDED_SUPPR).
        Parameters:
        session - The session which is used to check for access rights on this method.
        activity - The unique ID of the activity to set to NS_COMPLETED.
        dataContainer - The corresponding data container that contains the values of the output parameters of the activity. The caller is responsible for closing.
        errorMessage - The error message to be interpreted by a user or by a failure handling routine.
        state - Arbitrary state information specific to the component, comparable to the vendor code in SQLException.
        errorCode - The error code specifying the type of error.
        Throws:
        InvalidActivityStateException - If the activity (process step) has the wrong iteration, an InvalidActivityStateException will be raised.
        WrongExecutionManagerException - If the designated activity is not managed by this execution manager, a WrongExecutionManagerException will be raised.
        See Also:
        ProcessConstants.NodeState
      • flushSavepoint

        void flushSavepoint​(SessionToken session,
                            EBPInstanceReference activity,
                            DataContainer dataContainer,
                            String savepoint)
                     throws InvalidActivityStateException
        Flushes the state of the designated savepoint in the designated data container, that is, the values of the output parameters and the application states for the designated savepoint and stores them internally. When resetting one may choose to reset to a specific savepoint and start/resume from this. This method is called by the runtime manager. For tracking purpose the corresponding agent is logged and set as performing agent for the node.
        The activity needs to be managed by this execution manager and has to be in an appropriate state (NS_RUNNING).
        Parameters:
        session - The session which is used to check for access rights on this method. This can also be used to allow only a dependent session to resume the designated activity. The policy is determined by the corresponding implementation.
        activity - The unique ID of the activity of which to flush the data container for the designated savepoint.
        dataContainer - The corresponding data container that contains the values of the output parameters of the activity. The caller is responsible for closing.
        savepoint - The savepoint which to flush. If this savepoint is not defined in the designated data container, a new savepoint will be created for the current values of the output parameters and application states. If this is null, the complete data container will be flushed.
        Throws:
        InvalidActivityStateException - If the activity (process step) is not running, an InvalidActivityStateException will be raised.
        WrongExecutionManagerException - If the designated activity is not managed by this execution manager, a WrongExecutionManagerException will be raised.
        See Also:
        ProcessConstants.NodeState
      • flushDataContainer

        void flushDataContainer​(SessionToken session,
                                EBPInstanceReference activity,
                                DataContainer dataContainer)
                         throws InvalidActivityStateException
        Flushes the current state of the designated data container, that is, the values of the output parameters and the application states and stores them internally with the last savepoint ID of the designated data container. When resetting one may choose to reset to a specific savepoint and start/resume from this. This method is called by the runtime manager. For tracking purpose the corresponding agent is logged and set as performing agent for the node.
        The activity needs to be managed by this execution manager and has to be in an appropriate state (NS_RUNNING).
        Parameters:
        session - The session which is used to check for access rights on this method. This can also be used to allow only a dependent session to resume the designated activity. The policy is determined by the corresponding implementation.
        activity - The unique ID of the activity of which to flush the data container for the designated savepoint.
        dataContainer - The corresponding data container that contains the values of the output parameters of the activity. The caller is responsible for closing.
        Throws:
        InvalidActivityStateException - If the activity (process step) is not running, an InvalidActivityStateException will be raised.
        WrongExecutionManagerException - If the designated activity is not managed by this execution manager, a WrongExecutionManagerException will be raised.
        See Also:
        ProcessConstants.NodeState