Interface Function

All Superinterfaces:
CanCopy<Function>, HasId<String>, HasParent<Function,Model<?,?>>, Model<Function,String>, OriginAware<Function>, TransitionAware<Function>, Validatable

Represents a function that can be executed during workflow transitions. Functions are the primary mechanism for implementing custom business logic in workflows, such as sending notifications, updating databases, or performing calculations.
Since:
1.0
See Also:
  • Method Details

    • execute

      void execute(WorkflowExecutionContext context) throws WorkflowException
      Executes this function with the provided attributes. The function has access to all workflow attributes and can modify the workflow state as needed.
      Parameters:
      context - the execution context
      Throws:
      WorkflowException - if the function execution fails
    • withId

      Function withId(String id)
      Creates a new Function instance with the specified ID.
      Parameters:
      id - the new ID for the function
      Returns:
      a new Function instance with the specified ID
    • withFunctionContext

      Function withFunctionContext(FunctionContext functionContext)
      Creates a new Function instance with the specified function context.
      Parameters:
      functionContext - the new function context
      Returns:
      a new Function instance with the specified context
    • getType

      String getType()
      Returns the type of this function. The type identifies the category or class of the function (e.g., "email", "database", "custom").
      Returns:
      the function type
    • getValue

      String getValue()
      Returns the value of this function. The value identifies the specific function within the type (e.g., "send", "query", "functionId").
      Returns:
      the function value
    • getArgs

      Attributes getArgs()
      Returns the arguments for this function. Arguments configure the behavior of the function and are passed to the function during execution.
      Returns:
      the function arguments
    • getName

      String getName()
      Returns the human-readable name of this function.
      Returns:
      the function name
    • getFunctionType

      FunctionContext getFunctionType()
      Returns the function context that defines the execution environment and capabilities of this function.
      Returns:
      the function context