Workflow Engine .NET

Assembly: OptimaJet.Workflow.Core

Interface IPersistenceProvider

OptimaJet.Workflow.Core.Persistence.IPersistenceProvider

Interface of a persistence provider, which provide storing of process's instance specific parameters and global parameters

public interface IPersistenceProvider : IApprovalProvider, IFormDataProvider

Properties

Name
Type
Id #
String
Unique identifier of the persistence provider implementation
ConnectionString #
String
Connection string of the persistence provider
IsBulkOperationsSupported #
Boolean

Methods

void Init(WorkflowRuntime runtime) #
Init the provider

Parameters

Name
Type
Description
runtime
WorkflowRuntime
Workflow runtime instance which owned the provider
Task InitializeProcessAsync(ProcessInstance processInstance) #
Initialize a process instance in persistence store

Parameters

Name
Type
Description
processInstance
ProcessInstance
Instance of the process

Returns

Type
Description
Task
Task FillProcessParametersAsync(ProcessInstance processInstance) #
Fills system ParameterPurpose.System and persisted ParameterPurpose.Persistence parameters of the process

Parameters

Name
Type
Description
processInstance
ProcessInstance
Instance of the process

Returns

Type
Description
Task
Task FillPersistedProcessParametersAsync(ProcessInstance processInstance) #
Fills persisted ParameterPurpose.Persistence parameters of the process

Parameters

Name
Type
Description
processInstance
ProcessInstance
Instance of the process

Returns

Type
Description
Task
Task FillPersistedProcessParameterAsync(ProcessInstance processInstance, string parameterName) #
Fills persisted ParameterPurpose.Persistence parameter of the process

Parameters

Name
Type
Description
processInstance
ProcessInstance
Instance of the process
parameterName
String

Returns

Type
Description
Task
Task FillSystemProcessParametersAsync(ProcessInstance processInstance) #
Fills system ParameterPurpose.System parameters of the process

Parameters

Name
Type
Description
processInstance
ProcessInstance
Instance of the process

Returns

Type
Description
Task
Task SavePersistenceParametersAsync(ProcessInstance processInstance) #
Saves persisted ParameterPurpose.Persistence parameters of the process to store

Parameters

Name
Type
Description
processInstance
ProcessInstance
Instance of the process

Returns

Type
Description
Task
Task SavePersistenceParameterAsync(ProcessInstance processInstance, string parameterName) #
Save persisted ParameterPurpose.Persistence parameter of the process to store

Parameters

Name
Type
Description
processInstance
ProcessInstance
Instance of the process
parameterName
String
Name of parameter for save

Returns

Type
Description
Task
Task RemoveParameterAsync(ProcessInstance processInstance, string parameterName) #
Remove persisted ParameterPurpose.Persistence parameter of the process from store

Parameters

Name
Type
Description
processInstance
ProcessInstance
Instance of the process
parameterName
String
Name of parameter for save

Returns

Type
Description
Task
Task SetWorkflowInitializedAsync(ProcessInstance processInstance) #
Set process instance status to ProcessStatus.Initialized

Parameters

Name
Type
Description
processInstance
ProcessInstance
Instance of the process

Returns

Type
Description
Task
Task SetWorkflowIdledAsync(ProcessInstance processInstance) #
Set process instance status to ProcessStatus.Idled

Parameters

Name
Type
Description
processInstance
ProcessInstance
Instance of the process

Returns

Type
Description
Task
Task SetWorkflowRunningAsync(ProcessInstance processInstance) #
Set process instance status to ProcessStatus.Running

Parameters

Name
Type
Description
processInstance
ProcessInstance
Instance of the process

Returns

Type
Description
Task
Task SetWorkflowFinalizedAsync(ProcessInstance processInstance) #
Set process instance status to ProcessStatus.Finalized

Parameters

Name
Type
Description
processInstance
ProcessInstance
Instance of the process

Returns

Type
Description
Task
Task SetProcessStatusAsync(Guid processId, ProcessStatus newStatus) #
Set process instance status to newStatus

Parameters

Name
Type
Description
processId
Guid
Process id
newStatus
ProcessStatus
New process status

Returns

Type
Description
Task
Task SetWorkflowTerminatedAsync(ProcessInstance processInstance) #
Set process instance status to ProcessStatus.Terminated

Parameters

Name
Type
Description
processInstance
ProcessInstance
Instance of the process

Returns

Type
Description
Task
Task WriteInitialRecordToHistoryAsync(ProcessInstance processInstance) #
Write to table WorkflowProcessTransitionHistory initial record with first activity if can.

Parameters

Name
Type
Description
processInstance
ProcessInstance
Instance of the process

Returns

Type
Description
Task
Task UpdatePersistenceStateAsync(ProcessInstance processInstance, TransitionDefinition transition) #
Updates system parameters of the process in the store

Parameters

Name
Type
Description
processInstance
ProcessInstance
Instance of the process
transition
TransitionDefinition
Last executed transition

Returns

Type
Description
Task
Task<bool> IsProcessExistsAsync(Guid processId) #
Checks existence of the process

Parameters

Name
Type
Description
processId
Guid
Id of the process

Returns

Type
Description
Task<Boolean>
Task<bool> IsProcessExistsAsync(Guid processId, string tenantId) #
Checks existence of the process in the specified tenant

Parameters

Name
Type
Description
processId
Guid
Id of the process
tenantId
String
Tenant id of the process

Returns

Type
Description
Task<Boolean>
Task<ProcessStatus> GetInstanceStatusAsync(Guid processId) #
Returns status of the process ProcessStatus

Parameters

Name
Type
Description
processId
Guid
Id of the process

Returns

Type
Description
Task<ProcessStatus>
Status of the process
Task BindProcessToNewSchemeAsync(ProcessInstance processInstance) #
Saves information about changed scheme to the store

Parameters

Name
Type
Description
processInstance
ProcessInstance
Instance of the process with changed scheme ProcessInstance.ProcessScheme

Returns

Type
Description
Task
Task RegisterTimerAsync(Guid processId, Guid rootProcessId, string name, DateTime nextExecutionDateTime, string tenantId, bool notOverrideIfExists) #
Register a new timer

Parameters

Name
Type
Description
processId
Guid
Id of the process
rootProcessId
Guid
Id of the root process
name
String
Timer name TimerDefinition.Name
nextExecutionDateTime
DateTime
Next date and time of timer's execution
tenantId
String
Tenant's identifier (if exist)
notOverrideIfExists
Boolean
If true specifies that the existing timer with same name will not be overriden TimerDefinition.NotOverrideIfExists

Returns

Type
Description
Task
Task ClearTimersAsync(Guid processId, List<string> timersIgnoreList) #
Removes all timers from the store, exclude listed in ignore list

Parameters

Name
Type
Description
processId
Guid
Id of the process
timersIgnoreList
List<String>
Ignore list

Returns

Type
Description
Task
Task<List<ProcessTimer>> GetTimersForProcessAsync(Guid processId) #
Get all timers of a process

Parameters

Name
Type
Description
processId
Guid
Id of the process

Returns

Type
Description
Task<ProcessTimer>
Task DeleteProcessAsync(Guid processId) #
Remove all information about the process from the store

Parameters

Name
Type
Description
processId
Guid
Id of the process

Returns

Type
Description
Task
Task DeleteProcessAsync(Guid[] processIds) #
Remove all information about the process from the store

Parameters

Name
Type
Description
processIds
Guid[]
List of ids of the process

Returns

Type
Description
Task
Task SaveGlobalParameterAsync<T>(string type, string name, T value) #
Saves a global parameter value

Parameters

Name
Type
Description
type
String
Logical type of the parameter
name
String
Name of the parameter
value
{T}
Value of the parameter

Returns

Type
Description
Task
Task<T> LoadGlobalParameterAsync<T>(string type, string name) #
Returns a global parameter value

Parameters

Name
Type
Description
type
String
Logical type of the parameter
name
String
Name of the parameter

Returns

Type
Description
Task<T>
Value of the parameter
Task<Dictionary<string, T>> LoadGlobalParametersWithNamesAsync<T>(string type, Sorting sort = null) #
Returns a values and names of global parameters

Parameters

Name
Type
Description
type
String
Logical type of the parameter
sort
Sorting
Field for sorting parameters

Returns

Type
Description
Task<String,{T>
Dictionary of parameter names and values
Task<List<T>> LoadGlobalParametersAsync<T>(string type, Sorting sort = null) #
Returns a global parameter values

Parameters

Name
Type
Description
type
String
Logical type of the parameter
sort
Sorting
Field for sorting parameters

Returns

Type
Description
Task<List<T>>
List of parameter values
Task<PagedResponse<T>> LoadGlobalParametersWithPagingAsync<T>(string type, Paging paging, string name = null, Sorting sort = null) #
Returns a global parameter values with paging and total quantity

Parameters

Name
Type
Description
type
String
Logical type of the parameter
paging
Paging
Paging settings
name
String
[Nullable] Search by name
sort
Sorting
Field for sorting parameters

Returns

Type
Description
Task<PagedResponse<T>>
Returns a global parameter values with paging and total quantity
Task DeleteGlobalParametersAsync(string type, string name = null) #
Deletes a global parameter

Parameters

Name
Type
Description
type
String
Logical type of the parameter
name
String
Name of the parameter

Returns

Type
Description
Task
Task SaveTenantGlobalParameterAsync<T>(TenantGlobalParameterKey key, T value) #
Saves a tenant-scoped global parameter value

Parameters

Name
Type
Description
key
TenantGlobalParameterKey
Global parameter key. TenantGlobalParameterKey.Name is required.
value
{T}
Value of the parameter

Returns

Type
Description
Task
Task<T> LoadTenantGlobalParameterAsync<T>(TenantGlobalParameterKey key) #
Returns a tenant-scoped global parameter value

Parameters

Name
Type
Description
key
TenantGlobalParameterKey
Global parameter key. TenantGlobalParameterKey.Name is required.

Returns

Type
Description
Task<T>
Value of the parameter
Task<Dictionary<string, T>> LoadTenantGlobalParametersWithNamesAsync<T>(TenantGlobalParameterScope scope, Sorting sort = null) #
Returns values and names of tenant-scoped global parameters

Parameters

Name
Type
Description
scope
TenantGlobalParameterScope
Global parameter scope.
sort
Sorting
Field for sorting parameters

Returns

Type
Description
Task<String,{T>
Dictionary of parameter names and values
Task<List<T>> LoadTenantGlobalParametersAsync<T>(TenantGlobalParameterScope scope, Sorting sort = null) #
Returns tenant-scoped global parameter values

Parameters

Name
Type
Description
scope
TenantGlobalParameterScope
Global parameter scope.
sort
Sorting
Field for sorting parameters

Returns

Type
Description
Task<List<T>>
List of parameter values
Task<PagedResponse<T>> LoadTenantGlobalParametersWithPagingAsync<T>(TenantGlobalParameterScope scope, Paging paging, Sorting sort = null) #
Returns tenant-scoped global parameter values with paging and total quantity

Parameters

Name
Type
Description
scope
TenantGlobalParameterScope
Global parameter scope.
paging
Paging
Paging settings
sort
Sorting
Field for sorting parameters

Returns

Type
Description
Task<PagedResponse<T>>
Returns tenant-scoped global parameter values with paging and total quantity
Task DeleteTenantGlobalParametersAsync(TenantGlobalParameterScope scope) #
Deletes tenant-scoped global parameters

Parameters

Name
Type
Description
scope
TenantGlobalParameterScope
Global parameter scope.

Returns

Type
Description
Task
Task DeleteTenantGlobalParameterAsync(TenantGlobalParameterKey key) #
Deletes a tenant-scoped global parameter

Parameters

Name
Type
Description
key
TenantGlobalParameterKey
Global parameter key.

Returns

Type
Description
Task
Task<List<ProcessHistoryItem>> GetProcessHistoryAsync(Guid processId, Paging paging = null) #
Returns the history of process

Parameters

Name
Type
Description
processId
Guid
Id of the process
paging
Paging

Returns

Type
Description
Task<ProcessHistoryItem>
Task<int> GetProcessHistoryCountAsync(Guid processId) #

Parameters

Name
Type
Description
processId
Guid

Returns

Type
Description
Task<Int32>
Task BulkInitProcessesAsync(List<ProcessInstance> instances, ProcessStatus status, CancellationToken token) #

Parameters

Name
Type
Description
instances
List<ProcessInstance>
status
ProcessStatus
token
CancellationToken

Returns

Type
Description
Task
Task BulkInitProcessesAsync(List<ProcessInstance> instances, List<TimerToRegister> timers, ProcessStatus status, CancellationToken token) #

Parameters

Name
Type
Description
instances
List<ProcessInstance>
timers
List<TimerToRegister>
status
ProcessStatus
token
CancellationToken

Returns

Type
Description
Task
Task<List<IProcessInstanceTreeItem>> GetProcessInstanceTreeAsync(Guid rootProcessId) #

Parameters

Name
Type
Description
rootProcessId
Guid

Returns

Type
Description
Task<IProcessInstanceTreeItem>
Task<bool> MultiServerRuntimesExistAsync() #

Returns

Type
Description
Task<Boolean>
Task<WorkflowRuntimeModel> CreateWorkflowRuntimeAsync(string runtimeId, RuntimeStatus status) #

Parameters

Name
Type
Description
runtimeId
String
status
RuntimeStatus

Returns

Type
Description
Task<WorkflowRuntimeModel>
Task<WorkflowRuntimeModel> UpdateWorkflowRuntimeStatusAsync(WorkflowRuntimeModel runtime, RuntimeStatus status) #

Parameters

Name
Type
Description
runtime
WorkflowRuntimeModel
status
RuntimeStatus

Returns

Type
Description
Task<WorkflowRuntimeModel>
Task<(bool Success, WorkflowRuntimeModel UpdatedModel)> UpdateWorkflowRuntimeRestorerAsync(WorkflowRuntimeModel runtime, string restorerId) #

Parameters

Name
Type
Description
runtime
WorkflowRuntimeModel
restorerId
String

Returns

Type
Description
Task<WorkflowRuntimeModel>
Task<List<Guid>> GetRunningProcessesAsync(string runtimeId = null) #

Parameters

Name
Type
Description
runtimeId
String

Returns

Type
Description
Task<Guid>
Task<List<ProcessTimer>> GetActiveTimersForProcessAsync(Guid processId) #

Parameters

Name
Type
Description
processId
Guid

Returns

Type
Description
Task<ProcessTimer>
Task DeleteInactiveTimersByProcessIdAsync(Guid processId) #

Parameters

Name
Type
Description
processId
Guid

Returns

Type
Description
Task
Task DeleteTimerAsync(Guid timerId) #

Parameters

Name
Type
Description
timerId
Guid

Returns

Type
Description
Task
Task<List<WorkflowTimer>> GetTopTimersToExecuteAsync(int top) #

Parameters

Name
Type
Description
top
Int32

Returns

Type
Description
Task<WorkflowTimer>
Task<int> SetTimerIgnoreAsync(Guid id) #

Parameters

Name
Type
Description
id
Guid

Returns

Type
Description
Task<Int32>
Task<int> ActiveMultiServerRuntimesCountAsync(string currentRuntimeId) #

Parameters

Name
Type
Description
currentRuntimeId
String

Returns

Type
Description
Task<Int32>
Task<WorkflowRuntimeModel> GetWorkflowRuntimeModelAsync(string runtimeId) #

Parameters

Name
Type
Description
runtimeId
String

Returns

Type
Description
Task<WorkflowRuntimeModel>
Task<List<WorkflowRuntimeModel>> GetWorkflowRuntimesAsync() #

Returns

Type
Description
Task<WorkflowRuntimeModel>
Task<int> SendRuntimeLastAliveSignalAsync() #

Returns

Type
Description
Task<Int32>
Task<DateTime?> GetNextTimerDateAsync(TimerCategory timerCategory, int timerInterval) #

Parameters

Name
Type
Description
timerCategory
TimerCategory
timerInterval
Int32

Returns

Type
Description
Task<DateTime>
Task DeleteWorkflowRuntimeAsync(string name) #

Parameters

Name
Type
Description
name
String

Returns

Type
Description
Task
Task DropUnusedWorkflowProcessSchemeAsync() #

Returns

Type
Description
Task
Task<List<ProcessInstanceItem>> GetProcessInstancesAsync(List<(string parameterName, SortDirection sortDirection)> orderParameters = null, Paging paging = null) #

Parameters

Name
Type
Description
orderParameters
List<SortDirection>
paging
Paging

Returns

Type
Description
Task<ProcessInstanceItem>
Task<int> GetProcessInstancesCountAsync() #

Returns

Type
Description
Task<Int32>
Task<List<SchemeItem>> GetSchemesAsync(List<(string parameterName, SortDirection sortDirection)> orderParameters, Paging paging) #

Parameters

Name
Type
Description
orderParameters
List<SortDirection>
paging
Paging

Returns

Type
Description
Task<SchemeItem>
Task<int> GetSchemesCountAsync() #

Returns

Type
Description
Task<Int32>