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 Summary
Modifier and TypeMethodDescriptioncreate(WorkflowDefinitionId workflowDefinitionId) Creates a new empty workflow definition with the specified ID.get(WorkflowDefinitionId workflowDefinitionId) Retrieves a workflow definition by its ID.booleanremove(WorkflowDefinitionId workflowDefinitionId) Removes a workflow definition by its ID.booleansave(WorkflowDefinition workflowDefinition) Saves a workflow definition.booleanupdate(WorkflowDefinition workflowDefinition) Updates an existing workflow definition.with(WorkflowCallerContext callerContext) Creates a new WorkflowDefinitions instance that operates with the specified caller context.
-
Method Details
-
get
Optional<WorkflowDefinition> get(WorkflowDefinitionId workflowDefinitionId) throws WorkflowException 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
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
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
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
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
-