Assembly: OptimaJet.Workflow.Core

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.

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. When both sources define the action, their relative positions in WorkflowRuntimeSettings.ExecutionSearchOrder 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<CodeActionsInvoker, Boolean>
A tuple whose invoker is the first matching local or global invoker, or null when neither source defines the action. isGlobal is true when the invoker was selected from WorkflowRuntime.GlobalActionsInvoker; it is false 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.
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. When both sources define the condition, their relative positions in WorkflowRuntimeSettings.ExecutionSearchOrder 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<CodeActionsInvoker, Boolean>
A tuple whose invoker is the first matching local or global invoker, or null when neither source defines the condition. isGlobal is true when the invoker was selected from WorkflowRuntime.GlobalActionsInvoker; it is false 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.
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. When both sources define the rule, their relative positions in WorkflowRuntimeSettings.ExecutionSearchOrder 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<CodeActionsInvoker, Boolean>
A tuple whose invoker is the first matching local or global invoker, or null when neither source defines the rule. isGlobal is true when the invoker was selected from WorkflowRuntime.GlobalActionsInvoker; it is false 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.
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. When both sources define the rule, their relative positions in WorkflowRuntimeSettings.ExecutionSearchOrder 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<CodeActionsInvoker, Boolean>
A tuple whose invoker is the first matching local or global invoker, or null when neither source defines the rule. isGlobal is true when the invoker was selected from WorkflowRuntime.GlobalActionsInvoker; it is false 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.
public static string GetClassName(CodeActionDefinition codeActionDefinition) #
Creates the C# class name used to compile the specified 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 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.

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 is true.
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 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 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) joins this value and its postfix with an underscore, then converts the result to an identifier-compatible name.