# Class CodeActionUtils OptimaJet.Workflow.Core.CodeActions.CodeActionUtils Provides lookup helpers for scheme-local and runtime-global compiled code actions and creates identifiers used by generated code. Namespace: [OptimaJet.Workflow.Core.CodeActions](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.CodeActions/) ```csharp public static class CodeActionUtils ``` ## Methods `public static Task<(CodeActionsInvoker invoker, bool isGlobal)> GetCodeActionsInvokerForActionAsync(string actionName, WorkflowRuntime runtime, ProcessDefinition processDefinition)` Finds the scheme-local or runtime-global invoker that defines the named [CodeActionType.Action](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/CodeActionType/). When both sources define the action, their relative positions in [WorkflowRuntimeSettings.ExecutionSearchOrder](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime/WorkflowRuntimeSettings/) determine which invoker is returned. ### Parameters | Name | Type | Description | | --- | --- | --- | | `actionName` | `String` | The name of the action to locate. | | `runtime` | `WorkflowRuntime` | The runtime that supplies the search order and global code actions and loads the root process scheme when `processDefinition` is a subprocess scheme. | | `processDefinition` | `ProcessDefinition` | The current process scheme. Its compiled code actions are the local source; for a subprocess scheme, the root process scheme is the local source. | ### Returns | Type | Description | | --- | --- | | `Task` | A tuple whose `invoker` is the first matching local or global invoker, or [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) when neither source defines the action. `isGlobal` is [true](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool) when the invoker was selected from [WorkflowRuntime.GlobalActionsInvoker](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime/WorkflowRuntime/); it is [false](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool) for a local invoker and when no invoker is found. | ### Remarks This method searches only the local and global compiled sources. It does not query [WorkflowRuntime.ActionProvider](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime/WorkflowRuntime/). `public static Task<(CodeActionsInvoker invoker, bool isGlobal)> GetCodeActionsInvokerForConditionAsync(string conditionName, WorkflowRuntime runtime, ProcessDefinition processDefinition)` Finds the scheme-local or runtime-global invoker that defines the named [CodeActionType.Condition](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/CodeActionType/). When both sources define the condition, their relative positions in [WorkflowRuntimeSettings.ExecutionSearchOrder](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime/WorkflowRuntimeSettings/) determine which invoker is returned. ### Parameters | Name | Type | Description | | --- | --- | --- | | `conditionName` | `String` | The condition name to locate. | | `runtime` | `WorkflowRuntime` | The runtime that supplies the search order and global code actions and loads the root process scheme when `processDefinition` is a subprocess scheme. | | `processDefinition` | `ProcessDefinition` | The current process scheme. Its compiled conditions are the local source; for a subprocess scheme, the root process scheme is the local source. | ### Returns | Type | Description | | --- | --- | | `Task` | A tuple whose `invoker` is the first matching local or global invoker, or [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) when neither source defines the condition. `isGlobal` is [true](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool) when the invoker was selected from [WorkflowRuntime.GlobalActionsInvoker](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime/WorkflowRuntime/); it is [false](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool) for a local invoker and when no invoker is found. | ### Remarks This method searches only the local and global compiled sources. It does not query [WorkflowRuntime.ActionProvider](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime/WorkflowRuntime/). `public static Task<(CodeActionsInvoker invoker, bool isGlobal)> GetCodeActionsInvokerForRuleGetAsync(string ruleGetName, WorkflowRuntime runtime, ProcessDefinition processDefinition)` Finds the scheme-local or runtime-global invoker that defines the named [CodeActionType.RuleGet](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/CodeActionType/). When both sources define the rule, their relative positions in [WorkflowRuntimeSettings.ExecutionSearchOrder](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime/WorkflowRuntimeSettings/) determine which invoker is returned. ### Parameters | Name | Type | Description | | --- | --- | --- | | `ruleGetName` | `String` | The name of the rule that returns workflow participant identities. | | `runtime` | `WorkflowRuntime` | The runtime that supplies the search order and global code actions and loads the root process scheme when `processDefinition` is a subprocess scheme. | | `processDefinition` | `ProcessDefinition` | The current process scheme. Its compiled rules are the local source; for a subprocess scheme, the root process scheme is the local source. | ### Returns | Type | Description | | --- | --- | | `Task` | A tuple whose `invoker` is the first matching local or global invoker, or [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) when neither source defines the rule. `isGlobal` is [true](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool) when the invoker was selected from [WorkflowRuntime.GlobalActionsInvoker](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime/WorkflowRuntime/); it is [false](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool) for a local invoker and when no invoker is found. | ### Remarks This method searches only the local and global compiled sources. It does not query [WorkflowRuntime.RuleProvider](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime/WorkflowRuntime/). `public static Task<(CodeActionsInvoker invoker, bool isGlobal)> GetCodeActionsInvokerForRuleCheckAsync(string ruleCheckName, WorkflowRuntime runtime, ProcessDefinition processDefinition)` Finds the scheme-local or runtime-global invoker that defines the named [CodeActionType.RuleCheck](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/CodeActionType/). When both sources define the rule, their relative positions in [WorkflowRuntimeSettings.ExecutionSearchOrder](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime/WorkflowRuntimeSettings/) determine which invoker is returned. ### Parameters | Name | Type | Description | | --- | --- | --- | | `ruleCheckName` | `String` | The name of the rule that checks a workflow participant identity. | | `runtime` | `WorkflowRuntime` | The runtime that supplies the search order and global code actions and loads the root process scheme when `processDefinition` is a subprocess scheme. | | `processDefinition` | `ProcessDefinition` | The current process scheme. Its compiled rules are the local source; for a subprocess scheme, the root process scheme is the local source. | ### Returns | Type | Description | | --- | --- | | `Task` | A tuple whose `invoker` is the first matching local or global invoker, or [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) when neither source defines the rule. `isGlobal` is [true](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool) when the invoker was selected from [WorkflowRuntime.GlobalActionsInvoker](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime/WorkflowRuntime/); it is [false](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool) for a local invoker and when no invoker is found. | ### Remarks This method searches only the local and global compiled sources. It does not query [WorkflowRuntime.RuleProvider](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime/WorkflowRuntime/). `public static string GetClassName(CodeActionDefinition codeActionDefinition)` Creates the C# class name used to compile the specified [CodeActionDefinition](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/CodeActionDefinition/). ### Parameters | Name | Type | Description | | --- | --- | --- | | `codeActionDefinition` | `CodeActionDefinition` | The definition whose logical name and type are included in the class name. | ### Returns | Type | Description | | --- | --- | | `String` | The identifier-compatible `{Name}_{Type}_Class` name. | `public static string GetNamespaceName(string namespacePostfix)` Creates the C# namespace used to compile code actions for the specified postfix. ### Parameters | Name | Type | Description | | --- | --- | --- | | `namespacePostfix` | `String` | The value appended to [CodeActionUtils.NamespaceForCodeActions](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.CodeActions/CodeActionUtils/) after an underscore. | ### Returns | Type | Description | | --- | --- | | `String` | The identifier-compatible `{NamespaceForCodeActions}_{namespacePostfix}` namespace name. | `public static string GetMethodName(CodeActionDefinition codeActionDefinition)` Creates the compiled C# method name for `codeActionDefinition`, selecting the synchronous or asynchronous form from [CodeActionDefinition.IsAsync](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/CodeActionDefinition/). ### Parameters | Name | Type | Description | | --- | --- | --- | | `codeActionDefinition` | `CodeActionDefinition` | The definition whose logical name and type are included in the method name. | ### Returns | Type | Description | | --- | --- | | `String` | The identifier-compatible `{Name}_{Type}` name, with an `Async` suffix when [CodeActionDefinition.IsAsync](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/CodeActionDefinition/) is [true](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool). | `public static string GetMethodName(string name, CodeActionType type)` Creates the synchronous compiled C# method name for the specified logical name and code-action type. ### Parameters | Name | Type | Description | | --- | --- | --- | | `name` | `String` | The logical name of the action, condition, or rule. | | `type` | `CodeActionType` | The [CodeActionType](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/CodeActionType/) value used as the method-name suffix. | ### Returns | Type | Description | | --- | --- | | `String` | The identifier-compatible `{Name}_{Type}` name. | `public static string GetAsyncMethodName(string name, CodeActionType type)` Creates the asynchronous compiled C# method name for the specified logical name and code-action type. ### Parameters | Name | Type | Description | | --- | --- | --- | | `name` | `String` | The logical name of the action, condition, or rule. | | `type` | `CodeActionType` | The [CodeActionType](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/CodeActionType/) value used as the method-name suffix. | ### Returns | Type | Description | | --- | --- | | `String` | The identifier-compatible `{Name}_{Type}Async` name. | ## Fields `public static string NamespaceForCodeActions` Specifies the namespace prefix used for generated code-action types. ### Remarks [CodeActionUtils.GetNamespaceName(string)](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.CodeActions/CodeActionUtils/) joins this value and its postfix with an underscore, then converts the result to an identifier-compatible name. [Previous CodeActionsInvoker](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.CodeActions/CodeActionsInvoker/) [Next CodeForCompillation](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.CodeActions/CodeForCompillation/)