Package com.yworkflow

Interface WorkflowDefinitions


public interface WorkflowDefinitions
Manages workflow definitions within the yWorkflow engine. This interface provides operations for creating, retrieving, updating, and removing workflow definitions.

A workflow definition is a static blueprint that describes the structure and behavior of a workflow, including its states, transitions, conditions, and business logic. Multiple workflow instances can be created from a single workflow definition.

All operations in this interface can be executed with a specific caller context using the with(WorkflowCallerContext) method, which allows for access control and audit trails.

Since:
1.0
See Also:
  • Method Details

    • get

      Retrieves a workflow definition by its ID.
      Parameters:
      workflowDefinitionId - the unique identifier of the workflow definition
      Returns:
      an Optional containing the workflow definition if found, empty otherwise
      Throws:
      WorkflowException - if an error occurs while retrieving the workflow definition
    • create

      WorkflowDefinition create(WorkflowDefinitionId workflowDefinitionId) throws WorkflowException
      Creates a new empty workflow definition with the specified ID.
      Parameters:
      workflowDefinitionId - the unique identifier for the new workflow definition
      Returns:
      a new empty workflow definition
      Throws:
      WorkflowException - if an error occurs while creating the workflow definition
    • remove

      boolean remove(WorkflowDefinitionId workflowDefinitionId) throws WorkflowException
      Removes a workflow definition by its ID.
      Parameters:
      workflowDefinitionId - the unique identifier of the workflow definition to remove
      Returns:
      true if the workflow definition was successfully removed, false if it didn't exist
      Throws:
      WorkflowException - if an error occurs while removing the workflow definition
    • save

      boolean save(WorkflowDefinition workflowDefinition) throws WorkflowException
      Saves a workflow definition. If the workflow definition already exists, it will be updated.
      Parameters:
      workflowDefinition - the workflow definition to save
      Returns:
      true if the workflow definition was successfully saved
      Throws:
      WorkflowException - if an error occurs while saving the workflow definition
    • update

      boolean update(WorkflowDefinition workflowDefinition) throws WorkflowException
      Updates an existing workflow definition.
      Parameters:
      workflowDefinition - the workflow definition to update
      Returns:
      true if the workflow definition was successfully updated
      Throws:
      WorkflowException - if an error occurs while updating the workflow definition
    • with

      Creates a new WorkflowDefinitions instance that operates with the specified caller context. This allows for access control and audit trails for workflow definition operations.
      Parameters:
      callerContext - the caller context to use for operations
      Returns:
      a new WorkflowDefinitions instance with the specified caller context