Assembly: OptimaJet.Workflow.Core

Class CodeActionsInvoker

OptimaJet.Workflow.Core.CodeActions.CodeActionsInvoker

Stores compiled actions, conditions, and rules and invokes them by their logical names.

public sealed class CodeActionsInvoker

Methods

public void AddCompilledType(Type compilledType) #
Discovers generated public static code-action methods on compilledType and registers delegates for invoking them.

Parameters

Name
Type
Description
compilledType
Type
The compiled type that contains code action methods.

Exceptions

Type
Description
ArgumentException
Thrown when a public static method does not end with a recognized CodeActionType, or when the same generated method name is registered more than once.

Remarks

The final underscore-delimited segment of each method name, before an optional Async suffix, must identify its CodeActionType. Invocation methods reconstruct the registered method name with CodeActionUtils.GetMethodName(string, CodeActionType) or CodeActionUtils.GetAsyncMethodName(string, CodeActionType).
public bool InvokeCondition(string name, ProcessInstance processInstance, WorkflowRuntime runtime, string parameter) #
Invokes a synchronous CodeActionType.Condition code action.

Parameters

Name
Type
Description
name
String
The logical CodeActionType.Condition name used for lookup.
processInstance
ProcessInstance
The ProcessInstance passed to the invoked code action method.
runtime
WorkflowRuntime
The WorkflowRuntime passed to the invoked code action method.
parameter
String
The parameter string passed to the invoked condition.

Returns

Type
Description
Boolean
The Boolean value returned by the condition.

Exceptions

Type
Description
KeyNotFoundException
Thrown when no synchronous condition is registered for name.
public Task<bool> InvokeConditionAsync(string name, ProcessInstance processInstance, WorkflowRuntime runtime, string parameter, CancellationToken token) #
Invokes an asynchronous CodeActionType.Condition code action.

Parameters

Name
Type
Description
name
String
The logical CodeActionType.Condition name used for lookup.
processInstance
ProcessInstance
The ProcessInstance passed to the invoked code action method.
runtime
WorkflowRuntime
The WorkflowRuntime passed to the invoked code action method.
parameter
String
The parameter string passed to the invoked condition.
token
CancellationToken
The CancellationToken forwarded to the invoked async method.

Returns

Type
Description
Task<Boolean>
A Task<bool> whose result is true if the invoked condition evaluates to true.

Exceptions

Type
Description
KeyNotFoundException
Thrown when no asynchronous condition is registered for name.
public void InvokeAction(string name, ProcessInstance processInstance, WorkflowRuntime runtime, string parameter) #
Invokes a synchronous CodeActionType.Action code action.

Parameters

Name
Type
Description
name
String
The logical CodeActionType.Action name used for lookup.
processInstance
ProcessInstance
The ProcessInstance passed to the invoked code action method.
runtime
WorkflowRuntime
The WorkflowRuntime passed to the invoked code action method.
parameter
String
The parameter string passed to the invoked action.

Exceptions

Type
Description
KeyNotFoundException
Thrown when no synchronous action is registered for name.
public Task InvokeActionAsync(string name, ProcessInstance processInstance, WorkflowRuntime runtime, string parameter, CancellationToken token) #
Invokes an asynchronous CodeActionType.Action code action.

Parameters

Name
Type
Description
name
String
The logical CodeActionType.Action name used for lookup.
processInstance
ProcessInstance
The ProcessInstance passed to the invoked code action method.
runtime
WorkflowRuntime
The WorkflowRuntime passed to the invoked code action method.
parameter
String
The parameter string passed to the invoked action.
token
CancellationToken
The CancellationToken forwarded to the invoked async method.

Returns

Type
Description
Task
A Task that represents the asynchronous execution.

Exceptions

Type
Description
KeyNotFoundException
Thrown when no asynchronous action is registered for name.
public IEnumerable<string> InvokeRuleGet(string name, ProcessInstance processInstance, WorkflowRuntime runtime, string parameter) #
Invokes a synchronous CodeActionType.RuleGet code action.

Parameters

Name
Type
Description
name
String
The logical CodeActionType.RuleGet name used for lookup.
processInstance
ProcessInstance
The ProcessInstance passed to the invoked code action method.
runtime
WorkflowRuntime
The WorkflowRuntime passed to the invoked code action method.
parameter
String
The parameter string passed to the invoked rule.

Returns

Type
Description
IEnumerable<String>
The workflow participant identities returned by the rule.

Exceptions

Type
Description
KeyNotFoundException
Thrown when no synchronous identity-producing rule is registered for name.
public Task<IEnumerable<string>> InvokeRuleGetAsync(string name, ProcessInstance processInstance, WorkflowRuntime runtime, string parameter, CancellationToken token) #
Invokes an asynchronous CodeActionType.RuleGet code action.

Parameters

Name
Type
Description
name
String
The logical CodeActionType.RuleGet name used for lookup.
processInstance
ProcessInstance
The ProcessInstance passed to the invoked code action method.
runtime
WorkflowRuntime
The WorkflowRuntime passed to the invoked code action method.
parameter
String
The parameter string passed to the invoked rule.
token
CancellationToken
The CancellationToken forwarded to the invoked async method.

Returns

Type
Description
Task<String>
The workflow participant identities returned by the rule.

Exceptions

Type
Description
KeyNotFoundException
Thrown when no asynchronous identity-producing rule is registered for name.
public bool InvokeRuleCheck(string name, ProcessInstance processInstance, WorkflowRuntime runtime, string identityId, string parameter) #
Invokes a synchronous CodeActionType.RuleCheck code action.

Parameters

Name
Type
Description
name
String
The logical CodeActionType.RuleCheck name used for lookup.
processInstance
ProcessInstance
The ProcessInstance passed to the invoked code action method.
runtime
WorkflowRuntime
The WorkflowRuntime passed to the invoked code action method.
identityId
String
The workflow participant identity evaluated by the rule-check action.
parameter
String
The parameter string passed to the invoked rule.

Returns

Type
Description
Boolean
true if the rule accepts the workflow participant identity; otherwise, false.

Exceptions

Type
Description
KeyNotFoundException
Thrown when no synchronous identity-checking rule is registered for name.
public Task<bool> InvokeRuleCheckAsync(string name, ProcessInstance processInstance, WorkflowRuntime runtime, string identityId, string parameter, CancellationToken token) #
Invokes an asynchronous CodeActionType.RuleCheck code action.

Parameters

Name
Type
Description
name
String
The logical CodeActionType.RuleCheck name used for lookup.
processInstance
ProcessInstance
The ProcessInstance passed to the invoked code action method.
runtime
WorkflowRuntime
The WorkflowRuntime passed to the invoked code action method.
identityId
String
The workflow participant identity evaluated by the rule-check action.
parameter
String
The parameter string passed to the invoked rule.
token
CancellationToken
The CancellationToken forwarded to the invoked async method.

Returns

Type
Description
Task<Boolean>
true if the rule accepts the workflow participant identity; otherwise, false.

Exceptions

Type
Description
KeyNotFoundException
Thrown when no asynchronous identity-checking rule is registered for name.
public bool ExistsCondition(string name) #
Determines whether a CodeActionType.Condition code action with the given logical name exists.

Parameters

Name
Type
Description
name
String
The logical CodeActionType.Condition name.

Returns

Type
Description
Boolean
true if a synchronous or asynchronous condition is registered; otherwise, false.
public bool ExistsAction(string name) #
Determines whether a CodeActionType.Action code action with the given logical name exists.

Parameters

Name
Type
Description
name
String
The logical CodeActionType.Action name.

Returns

Type
Description
Boolean
true if a synchronous or asynchronous action is registered; otherwise, false.
public bool ExistsRuleGet(string name) #
Determines whether a CodeActionType.RuleGet code action with the given logical name exists.

Parameters

Name
Type
Description
name
String
The logical CodeActionType.RuleGet name.

Returns

Type
Description
Boolean
true if a synchronous or asynchronous identity-producing rule is registered; otherwise, false.
public bool ExistsRuleCheck(string name) #
Determines whether a CodeActionType.RuleCheck code action with the given logical name exists.

Parameters

Name
Type
Description
name
String
The logical CodeActionType.RuleCheck name.

Returns

Type
Description
Boolean
true if a synchronous or asynchronous identity-checking rule is registered; otherwise, false.
public bool IsConditionAsync(string name) #
Determines whether the named CodeActionType.Condition code action is registered as asynchronous.

Parameters

Name
Type
Description
name
String
The logical CodeActionType.Condition name.

Returns

Type
Description
Boolean
true if the condition action is available asynchronously.
public bool IsActionAsync(string name) #
Determines whether the named CodeActionType.Action code action is registered as asynchronous.

Parameters

Name
Type
Description
name
String
The logical CodeActionType.Action name.

Returns

Type
Description
Boolean
true if the action is available asynchronously.
public bool IsGetRuleAsync(string name) #
Determines whether the named CodeActionType.RuleGet code action is registered as asynchronous.

Parameters

Name
Type
Description
name
String
The logical CodeActionType.RuleGet name.

Returns

Type
Description
Boolean
true if the rule-get action is available asynchronously.
public bool IsCheckRuleAsync(string name) #
Determines whether the named CodeActionType.RuleCheck code action is registered as asynchronous.

Parameters

Name
Type
Description
name
String
The logical CodeActionType.RuleCheck name.

Returns

Type
Description
Boolean
true if the rule-check action is available asynchronously.