Package com.axelor.workflow
Class WorkflowContext
java.lang.Object
com.axelor.workflow.WorkflowContext
The tenant and acting user, read from the ambient context where they are used rather than carried
on events: every thread that runs workflow logic is already bound to the right ones.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceA scope opened by one of the methods below; closing it ends that scope on the thread. -
Method Summary
Modifier and TypeMethodDescriptionstatic StringThe current tenant, normalized to""so cache keys match in single-tenant setups.static LongThe acting user's id, or null for a system run.static WorkflowContext.Scopedeploy()Mark definition writes on this thread as a module deployment, exempt from the guard against changing a definition that has parked runs.static WorkflowContext.ScopeMark definition writes on this thread as a Studio deploy: likedeploy()it re-derivesactive, but it keeps the in-flight guard and the agent check.static booleanWhether definition writes on this thread are authoritative deployments.static booleanWhether definition writes on this thread are an interactive (Studio) deploy.static booleanWhether workflow dispatch is currently suppressed on this thread.static WorkflowContext.Scopesuppress()Suppress workflow dispatch on this thread: saves inside the scope start no workflow.
-
Method Details
-
suppress
Suppress workflow dispatch on this thread: saves inside the scope start no workflow. For bulk imports, migrations and demo data. Nestable; use with try-with-resources:try (var ignored = WorkflowContext.suppress()) { importer.importAll(data); // no workflows fire on these saves } -
isSuppressed
public static boolean isSuppressed()Whether workflow dispatch is currently suppressed on this thread. -
deploy
Mark definition writes on this thread as a module deployment, exempt from the guard against changing a definition that has parked runs. Nestable. -
isDeploying
public static boolean isDeploying()Whether definition writes on this thread are authoritative deployments. -
interactiveDeploy
Mark definition writes on this thread as a Studio deploy: likedeploy()it re-derivesactive, but it keeps the in-flight guard and the agent check. -
isInteractiveDeploy
public static boolean isInteractiveDeploy()Whether definition writes on this thread are an interactive (Studio) deploy. -
currentTenant
The current tenant, normalized to""so cache keys match in single-tenant setups. -
currentUserId
The acting user's id, or null for a system run.
-