Interface Callback<M extends Model>


public interface Callback<M extends Model>
Interface for callbacks registered in the module or spt for actions defined in an mpt. The implementer can do pre and post operations to override the default behavior.

Callbacks are instantiated once per workflow invocation. Their state is maintained throughout a workflow call, but never across multiple workflow calls. Thus you can make your callback stateful to share data across preWorkflow and postWorkflow within a workflow invocation in a threadsafe way.

  • Method Details

    • preWorkflow

      default void preWorkflow​(ActionBasedWorkflowContext<M> context) throws java.lang.Exception
      This method is called before the IntrinsicAction's workflow is executed. Only input is accessible from this method. A sample use for this method is to perform validations on top of IntrinsicAction's validations.
      Parameters:
      context - context of the current action based workflow
      Throws:
      java.lang.Exception - throw an exception to abort the workflow - however if there are data validation errors, you should flag the corresponding Models with ErrorDefs
    • preMergeInputToCurrent

      default void preMergeInputToCurrent​(ActionBasedWorkflowContext<M> context) throws java.lang.Exception
      This method is called just before the workflow merges the input records onto the current records. A good use of this method is to do some computation which requires a comparison of the old and new values for a record
      Parameters:
      context - context of the current action based workflow
      Throws:
      java.lang.Exception - throw an exception to abort the workflow - however if there are data validation errors, you should flag the corresponding Models with ErrorDefs
    • preWrite

      default void preWrite​(ActionBasedWorkflowContext<M> context) throws java.lang.Exception
      This method is called before the write activity is executed in the IntrinsicAction. This method is called after the merge and linkage has happened therefore both current and input are accessible in this method. A good use of this method is to do validations/computations that involve the use of both current and input, or to set UDF values on the current.
      Parameters:
      context - context of the current action based workflow
      Throws:
      java.lang.Exception - throw an exception to abort the workflow - however if there are data validation errors, you should flag the corresponding Models with ErrorDefs
    • postWrite

      default void postWrite​(ActionBasedWorkflowContext<M> context) throws java.lang.Exception
      This method is called after the IntrinsicAction's write is executed. A good use of this method can be to check action write results, before any finaly workflow activities happen (and therefore before postWorkflow is called).
      Parameters:
      context - context of the current action based workflow
      Throws:
      java.lang.Exception - throw an exception to abort the workflow - however if there are data validation errors, you should flag the corresponding Models with ErrorDefs
    • postWorkflow

      default void postWorkflow​(ActionBasedWorkflowContext<M> context) throws java.lang.Exception
      This method is called after the IntrinsicAction's workflow is executed. A good use of this method can be to send some notifications or make a call to any other Action.
      Parameters:
      context - context of the current action based workflow
      Throws:
      java.lang.Exception - throw an exception to abort the workflow - however if there are data validation errors, you should flag the corresponding Models with ErrorDefs
    • postWorkflowFinally

      default void postWorkflowFinally​(ActionBasedWorkflowContext<M> context, java.lang.Throwable wfException) throws java.lang.Exception
      This method is called after the IntrinsicAction's workflow is executed even if exception was thrown in the workflow. A good use of this method can be to send some notifications or make a call to any other Action.
      Parameters:
      context - context of the current action based workflow
      wfException - exception thrown in workflow
      Throws:
      java.lang.Exception - throw an exception to abort the workflow - however if there are data validation errors, you should flag the corresponding Models with ErrorDefs