Package com.yworkflow.common.caller
Interface WorkflowCallerContext
- All Known Implementing Classes:
ImmutableWorkflowCallerContext
public interface WorkflowCallerContext
Represents the context of a caller in the yWorkflow system, combining both the caller identity
and tenant information. This context is used throughout the workflow engine to provide access
control, audit trails, and multi-tenancy support.
WorkflowCallerContext instances are immutable and provide fluent methods for creating new contexts with different caller or tenant information. This allows for easy context switching and delegation scenarios.
The context is used in various workflow operations to determine permissions, track audit information, and ensure proper tenant isolation. It can be passed to workflow engine components to establish the execution context.
- Since:
- 1.0
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionactAs(WorkflowCaller caller) Creates a new WorkflowCallerContext with the specified caller, keeping the same tenant ID.static WorkflowCallerContextCreates a new anonymous WorkflowCallerContext with an empty tenant ID.static WorkflowCallerContextas(WorkflowCaller caller) Creates a new WorkflowCallerContext for the specified caller with an empty tenant ID.caller()Returns the caller associated with this context.Creates a new WorkflowCallerContext with the specified tenant ID, keeping the same caller.tenantId()Returns the tenant ID associated with this caller context.
-
Method Details
-
tenantId
TenantId tenantId()Returns the tenant ID associated with this caller context.- Returns:
- the tenant ID
-
caller
WorkflowCaller caller()Returns the caller associated with this context.- Returns:
- the workflow caller
-
from
Creates a new WorkflowCallerContext with the specified tenant ID, keeping the same caller.- Parameters:
tenantId- the new tenant ID- Returns:
- a new WorkflowCallerContext with the specified tenant ID
-
actAs
Creates a new WorkflowCallerContext with the specified caller, keeping the same tenant ID.- Parameters:
caller- the new caller- Returns:
- a new WorkflowCallerContext with the specified caller
-
as
Creates a new WorkflowCallerContext for the specified caller with an empty tenant ID. This is a convenience method for single-tenant scenarios.- Parameters:
caller- the caller for the context- Returns:
- a new WorkflowCallerContext with the specified caller and empty tenant
-
anonymous
Creates a new anonymous WorkflowCallerContext with an empty tenant ID. This is useful for system operations or when caller identity is not required.- Returns:
- a new anonymous WorkflowCallerContext
-