Assembly: OptimaJet.Workflow.Core

Interface IWorkflowRuleProvider

OptimaJet.Workflow.Core.Runtime.IWorkflowRuleProvider

Defines named authorization rules used to evaluate workflow participant identities for transition restrictions.

public interface IWorkflowRuleProvider

Type Hierarchy

Methods

List<string> GetRules(string schemeCode, NamesSearchType namesSearchType) #
Gets the rule names implemented by this provider for a process scheme.

Parameters

Name
Type
Description
schemeCode
String
The effective process scheme code used to resolve scheme-specific rules, or null when the caller has no process scheme context.
namesSearchType
NamesSearchType
The filtering mode. NamesSearchType.All includes rules excluded by provider-specific exclusion settings and is used for runtime rule resolution. NamesSearchType.NotExcluded omits those rules, for example when the Designer builds its list of available rules.

Returns

Type
Description
List<String>
A non-null list of rule names implemented by this provider for the requested scheme and filtering mode.
bool Check(ProcessInstance processInstance, WorkflowRuntime runtime, string identityId, string ruleName, string parameter) #
Determines whether a workflow participant identity satisfies a rule.

Parameters

Name
Type
Description
processInstance
ProcessInstance
The process instance whose state and parameters provide the evaluation context.
runtime
WorkflowRuntime
The workflow runtime executing the evaluation.
identityId
String
The application-defined value identifying the workflow participant to evaluate, such as a login, user name, database identifier, or another identifier understood by the provider.
ruleName
String
parameter
String
The provider-defined rule parameter. During standard restriction evaluation, this is the value from ActorDefinition.Value after workflow substitutions have been applied.

Returns

Type
Description
Boolean
true if identityId belongs to the set defined by the rule; otherwise, false.

Remarks

The runtime calls this method when IWorkflowRuleProvider.IsCheckAsync(string, string) returns false for the same rule and scheme.
Task<bool> CheckAsync(ProcessInstance processInstance, WorkflowRuntime runtime, string identityId, string ruleName, string parameter, CancellationToken token) #
Asynchronously determines whether a workflow participant identity satisfies a rule.

Parameters

Name
Type
Description
processInstance
ProcessInstance
The process instance whose state and parameters provide the evaluation context.
runtime
WorkflowRuntime
The workflow runtime executing the evaluation.
identityId
String
The application-defined value identifying the workflow participant to evaluate, such as a login, user name, database identifier, or another identifier understood by the provider.
ruleName
String
parameter
String
The provider-defined rule parameter. During standard restriction evaluation, this is the value from ActorDefinition.Value after workflow substitutions have been applied.
token
CancellationToken
The token supplied by the current workflow operation to observe cancellation.

Returns

Type
Description
Task<Boolean>
A task whose result is true if identityId belongs to the set defined by the rule; otherwise, false.

Remarks

The runtime calls this method when IWorkflowRuleProvider.IsCheckAsync(string, string) returns true for the same rule and scheme.
IEnumerable<string> GetIdentities(ProcessInstance processInstance, WorkflowRuntime runtime, string ruleName, string parameter) #
Gets all workflow participant identities that satisfy a rule.

Parameters

Name
Type
Description
processInstance
ProcessInstance
The process instance whose state and parameters provide the lookup context.
runtime
WorkflowRuntime
The workflow runtime executing the lookup.
ruleName
String
parameter
String
The provider-defined rule parameter. During standard actor calculation, this is the value from ActorDefinition.Value after workflow substitutions have been applied.

Returns

Type
Description
IEnumerable<String>
A non-null sequence of application-defined workflow participant identities. Each value must use the same identity representation accepted by IWorkflowRuleProvider.Check(ProcessInstance, WorkflowRuntime, string, string, string).

Remarks

The runtime calls this method when IWorkflowRuleProvider.IsGetIdentitiesAsync(string, string) returns false for the same rule and scheme.
Task<IEnumerable<string>> GetIdentitiesAsync(ProcessInstance processInstance, WorkflowRuntime runtime, string ruleName, string parameter, CancellationToken token) #
Asynchronously gets all workflow participant identities that satisfy a rule.

Parameters

Name
Type
Description
processInstance
ProcessInstance
The process instance whose state and parameters provide the lookup context.
runtime
WorkflowRuntime
The workflow runtime executing the lookup.
ruleName
String
parameter
String
The provider-defined rule parameter. During standard actor calculation, this is the value from ActorDefinition.Value after workflow substitutions have been applied.
token
CancellationToken
The token supplied by the current workflow operation to observe cancellation.

Returns

Type
Description
Task<String>
A task whose result is a non-null sequence of application-defined workflow participant identities. Each value must use the same identity representation accepted by IWorkflowRuleProvider.Check(ProcessInstance, WorkflowRuntime, string, string, string).

Remarks

The runtime calls this method when IWorkflowRuleProvider.IsGetIdentitiesAsync(string, string) returns true for the same rule and scheme.
bool IsCheckAsync(string ruleName, string schemeCode) #

Parameters

Name
Type
Description
ruleName
String
schemeCode
String
The effective process scheme code used to resolve the rule.

Returns

Remarks

This choice is independent of the identity lookup mode returned by IWorkflowRuleProvider.IsGetIdentitiesAsync(string, string).
bool IsGetIdentitiesAsync(string ruleName, string schemeCode) #

Parameters

Name
Type
Description
ruleName
String
schemeCode
String
The effective process scheme code used to resolve the rule.

Returns

Remarks

This choice is independent of the rule-checking mode returned by IWorkflowRuleProvider.IsCheckAsync(string, string).

Remarks

A rule supports two related operations. IWorkflowRuleProvider.Check(ProcessInstance, WorkflowRuntime, string, string, string) determines whether one workflow participant identity satisfies the rule, while IWorkflowRuleProvider.GetIdentities(ProcessInstance, WorkflowRuntime, string, string) returns all identities that satisfy it. The runtime uses these operations when validating RestrictionDefinition instances and when calculating the participants allowed to execute a transition.

Implementations advertise their rule names through IWorkflowRuleProvider.GetRules(string, NamesSearchType). For each advertised rule, IWorkflowRuleProvider.IsCheckAsync(string, string) selects between IWorkflowRuleProvider.Check(ProcessInstance, WorkflowRuntime, string, string, string) and IWorkflowRuleProvider.CheckAsync(ProcessInstance, WorkflowRuntime, string, string, string, CancellationToken), while IWorkflowRuleProvider.IsGetIdentitiesAsync(string, string) independently selects between IWorkflowRuleProvider.GetIdentities(ProcessInstance, WorkflowRuntime, string, string) and IWorkflowRuleProvider.GetIdentitiesAsync(ProcessInstance, WorkflowRuntime, string, string, CancellationToken).

The rule-specific parameter normally originates from ActorDefinition.Value. During standard runtime evaluation, workflow substitutions are applied before the resulting value is passed to this provider.