Assembly: OptimaJet.Workflow.Core

Class OfflineApi

OptimaJet.Workflow.Core.Runtime.OfflineApi

Provides API operations for building approval maps and executing ordered batches of workflow commands.

public sealed class OfflineApi

Constructors

public OfflineApi(WorkflowRuntime runtimeOwner) #
Initializes a new OfflineApi instance for the specified WorkflowRuntime.

Parameters

Name
Type
Description
runtimeOwner
WorkflowRuntime
Runtime used to query process state and execute commands.

Methods

public Task<Dictionary<string, ActivityDto>> GetApprovalMapAsync(ProcessDefinition scheme, Func<TransitionDefinition, Task<bool>> predicate = null, bool ignoreSubprocesses = false) #
Gets the possible approval transitions for a process scheme.

Parameters

Name
Type
Description
scheme
ProcessDefinition
Process scheme containing transitions to evaluate.
predicate
Func<TransitionDefinition, Boolean>
Optional asynchronous validation callback executed for each transition before it is added to the map. If omitted, all applicable transitions are included.
ignoreSubprocesses
Boolean
true to skip transitions where either end of the transition has a nesting level greater than zero.

Returns

Type
Description
Task<String, ActivityDto>
A dictionary of activity names and corresponding ActivityDto objects with their possible approval transitions.
public Task<Dictionary<string, ActivityDto>> GetApprovalMapAsync(ProcessInstance pi, string identityId) #
Gets the approval map for a running process instance and marks activities that are currently active.

Parameters

Name
Type
Description
pi
ProcessInstance
Process instance to analyze.
identityId
String
The workflow participant identity evaluated against actor restrictions on transitions.

Returns

Type
Description
Task<String, ActivityDto>
A dictionary of activity names and corresponding ActivityDto objects where matching activities are marked with ActivityDto.IsCurrent when they are active in the process tree.
public Task<List<CommandExecutionResult>> ExecuteSomeCommandsAsync(IEnumerable<Command> commands) #
Executes multiple commands, grouping them by process identifier and ordering each group by command date.

Parameters

Name
Type
Description
commands
IEnumerable<Command>
Commands to execute.

Returns

Type
Description
Task<CommandExecutionResult>
One execution result per input command, returned in the original input order. An exception while executing a command interrupts only the remaining commands in the same process group.
public Task<List<CommandExecutionResult>> ExecuteSomeCommandsAsync(Guid processId, IEnumerable<Command> commands) #
Executes several commands for one process, in command date order.

Parameters

Name
Type
Description
processId
Guid
Identifier of the process for which all commands are executed.
commands
IEnumerable<Command>
Commands to execute. Their Command.ProcessId values are ignored.

Returns

Type
Description
Task<CommandExecutionResult>
Execution results in the original input order. If executing a command throws, later commands by date are not executed and are marked as interrupted.