Package com.yworkflow.builder
Interface WorkflowInstanceOptionalBuilder
public interface WorkflowInstanceOptionalBuilder
Optional builder interface for configuring additional components of a WorkflowEngine. This
interface provides methods to configure optional components such as extensions, interceptors,
transactions, and other advanced features.
All methods in this interface return the builder instance to allow for fluent chaining of
configuration methods. The build() method creates the final WorkflowEngine instance.
- Since:
- 1.0
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionaddInterceptor(WorkflowInterceptor interceptor) Adds an interceptor to the workflow engine.addTransaction(WorkflowTransaction transaction) Adds a transaction manager to the workflow engine.build()Builds and returns the configured WorkflowEngine instance.withCallerContext(WorkflowCallerContext callerContext) Configures the workflow engine with a default caller context.withClock(WorkflowClock clock) Configures the workflow engine with a custom clock.withDefinitionRepository(WorkflowDefinitionRepository workflowDefinitionRepository) Configures the workflow engine to use the specified workflow definition repository.withExtensions(ExtensionProvider extensionProvider) Configures the workflow engine with an extension provider.withFactory(WorkflowDefinitionFactory workflowFactory) Configures the workflow engine to use the specified workflow definition factory.withGlobalAttributes(Attributes globalAttributes) Configures the workflow engine with global attributes.withProperties(Properties properties) Configures the workflow engine with the specified properties.
-
Method Details
-
build
Builds and returns the configured WorkflowEngine instance.- Returns:
- the configured WorkflowEngine instance
- Throws:
WorkflowException- if the WorkflowEngine cannot be built due to configuration errors
-
withFactory
Configures the workflow engine to use the specified workflow definition factory. The factory is responsible for creating workflow definitions from various sources.- Parameters:
workflowFactory- the workflow definition factory to use- Returns:
- this builder instance for method chaining
-
withDefinitionRepository
WorkflowInstanceOptionalBuilder withDefinitionRepository(WorkflowDefinitionRepository workflowDefinitionRepository) Configures the workflow engine to use the specified workflow definition repository. The repository provides storage and retrieval of workflow definitions.- Parameters:
workflowDefinitionRepository- the workflow definition repository to use- Returns:
- this builder instance for method chaining
-
withProperties
Configures the workflow engine with the specified properties. Properties can be used to configure various aspects of the engine behavior.- Parameters:
properties- the properties to configure- Returns:
- this builder instance for method chaining
-
addInterceptor
Adds an interceptor to the workflow engine. Interceptors allow for cross-cutting concerns such as logging, monitoring, or security.- Parameters:
interceptor- the interceptor to add- Returns:
- this builder instance for method chaining
-
addTransaction
Adds a transaction manager to the workflow engine. The transaction manager provides transactional support for workflow operations.- Parameters:
transaction- the transaction manager to add- Returns:
- this builder instance for method chaining
-
withGlobalAttributes
Configures the workflow engine with global attributes. Global attributes are shared across all workflow instances and can be used for configuration or shared data.- Parameters:
globalAttributes- the global attributes to set- Returns:
- this builder instance for method chaining
-
withCallerContext
Configures the workflow engine with a default caller context. This context will be used for operations that don't specify a specific caller context.- Parameters:
callerContext- the default caller context to use- Returns:
- this builder instance for method chaining
-
withExtensions
Configures the workflow engine with an extension provider. The extension provider is responsible for resolving extensions such as conditions, functions, and validators by name or class.- Parameters:
extensionProvider- the extension provider to use- Returns:
- this builder instance for method chaining
-
withClock
Configures the workflow engine with a custom clock. The clock is used for time-based operations and can be useful for testing or time zone handling.- Parameters:
clock- the clock to use- Returns:
- this builder instance for method chaining
-