Interface WorkflowDefinitionFactory


public interface WorkflowDefinitionFactory
Factory interface for creating, retrieving, and managing workflow definitions. WorkflowDefinitionFactory provides the core functionality for workflow definition lifecycle management, including creation, retrieval, updates, and deletion.

All operations are performed within the context of a caller, ensuring proper access control and audit trails. The factory supports multi-tenancy through the WorkflowCallerContext parameter.

Since:
1.0
See Also:
  • Method Details

    • init

      void init(ExtensionProvider extensionProvider, Properties properties) throws WorkflowException
      Initializes the workflow definition factory with the specified extension provider and configuration properties. This method must be called before using any other methods of the factory.
      Parameters:
      extensionProvider - the extension provider for resolving workflow extensions
      properties - configuration properties for the factory
      Throws:
      WorkflowException - if initialization fails
    • get

      Optional<WorkflowDefinition> get(WorkflowCallerContext callerContext, WorkflowDefinitionId workflowDefinitionId) throws WorkflowException
      Retrieves a workflow definition by ID. Returns an Optional that will be empty if the workflow definition is not found.
      Parameters:
      callerContext - the context of the caller requesting the workflow
      workflowDefinitionId - the ID of the workflow to retrieve
      Returns:
      an Optional containing the workflow if found, empty otherwise
      Throws:
      WorkflowException - if there's an error retrieving the workflow
    • create

      WorkflowDefinition create(WorkflowCallerContext callerContext, WorkflowDefinitionId workflowDefinitionId) throws WorkflowException
      Creates a new workflow definition with the specified ID. This method creates a new, empty workflow definition that can be configured and saved.
      Parameters:
      callerContext - the context of the caller creating the workflow
      workflowDefinitionId - the ID for the new workflow
      Returns:
      a new, empty workflow definition
      Throws:
      WorkflowException - if there's an error creating the workflow
    • remove

      boolean remove(WorkflowCallerContext callerContext, WorkflowDefinitionId workflowDefinitionId) throws WorkflowException
      Removes a workflow definition by ID. Returns true if the workflow was successfully removed, false if it didn't exist.
      Parameters:
      callerContext - the context of the caller removing the workflow
      workflowDefinitionId - the ID of the workflow to remove
      Returns:
      true if the workflow was removed, false if it didn't exist
      Throws:
      WorkflowException - if there's an error removing the workflow
    • save

      boolean save(WorkflowCallerContext callerContext, WorkflowDefinition workflowDefinition) throws WorkflowException
      Saves a workflow definition. This method persists the workflow definition to the underlying storage system.
      Parameters:
      callerContext - the context of the caller saving the workflow
      workflowDefinition - the workflow definition to save
      Returns:
      true if the workflow was saved successfully, false otherwise
      Throws:
      WorkflowException - if there's an error saving the workflow
    • update

      boolean update(WorkflowCallerContext callerContext, WorkflowDefinition workflowDefinition) throws WorkflowException
      Updates an existing workflow definition. This method modifies the existing workflow definition in the underlying storage system.
      Parameters:
      callerContext - the context of the caller updating the workflow
      workflowDefinition - the workflow definition to update
      Returns:
      true if the workflow was updated successfully, false otherwise
      Throws:
      WorkflowException - if there's an error updating the workflow