Workflow Engine .NET

Assembly: OptimaJet.Workflow.Core

Class ProcessInstance

OptimaJet.Workflow.Core.Model.ProcessInstance

Represent a instance of a specific process

public sealed class ProcessInstance

Inheritance

  • System.Object

Properties

Name
Type
ProcessId #
Guid
Returns Id of the process
ParentProcessId #
Nullable<Guid>
Returns Id of the parent process if this process is subprocess (parallel branch)
RootProcessId #
Guid
Returns Id of the root process in the subprocesses hierarchy if this process is subprocess (parallel branch)
SchemeId #
Guid
Returns Id of the scheme of the process
PreviousState #
String
Returns the name of the state which was initial for last executed direct transition TransitionDefinition.From
ExecutedTimer #
String
Returns the name of the currently executing timer, filled if the transition process was initiated by a timer
PreviousStateForDirect #
String
Returns the name of the state which was initial for last executed transition marked as direct TransitionDefinition.From
PreviousStateForReverse #
String
Returns the name of the state which was initial for last executed transition marked as reverse TransitionDefinition.From
PreviousActivityName #
String
Returns the name of the activity which was initial for last executed transition TransitionDefinition.From
PreviousActivityForDirectName #
String
Returns the name of the activity which was initial for last executed transition marked as direct TransitionDefinition.From
PreviousActivityForReverseName #
String
Returns the name of the activity which was initial for last executed transition marked as reverse TransitionDefinition.From
CurrentCommand #
String
Returns the name of the currently executing command, filled if the transition process was initiated by a command
IdentityId #
String
Returns the user id which execute a command or set a state
ImpersonatedIdentityId #
String
Returns the user id for whom executes a command or sets a state
ExecutedActivityState #
String
Returns the name of the state which is final for currently executing transition TransitionDefinition.To
ExecutedActivity #
ActivityDefinition
Returns the activity which is final for currently executing transition TransitionDefinition.To
ExecutedTransition #
TransitionDefinition
Returns the currently executing transition TransitionDefinition.To
CurrentActivityName #
String
Returns the name of the current activity. Activity which was final for last executed transition TransitionDefinition.From
IdentityIds #
List<String>
Returns the list of user ids which have the ability to execute a transition which leads to set executed activity. (which have the ability to execute current transition) Only available in pre-execution mode
IdentityIdsForCurrentActivity #
List<String>
Returns the list of user ids which have the ability to execute a transition which leads to set executed activity. (which have the ability to execute current transition) The main difference between this property and IdentityIds, is that it takes into account only the last transition that leads into current activity Only available in pre-execution mode
SchemeCode #
String
Returns the code of the scheme of the process
CurrentState #
String
Returns the name of the current state. State which was final for last executed transition TransitionDefinition.From
TenantId #
String
Returns the tenant's identifier
StartTransitionalProcessActivity #
String
Returns the name of the activity from which the transitional process was started.
CurrentActivity #
ActivityDefinition
Returns the name of the current activity. Activity which was final for last executed transition TransitionDefinition.From
IsPreExecution #
Boolean
Returns true within pre-execution mode
SubprocessName #
String
If the process is a subprocess, its name will be here
CreationDate #
DateTime
Date of the process creation
LastTransitionDate #
Nullable<DateTime>
Date of the last transition execution
StartTransitionTime #
Nullable<DateTime>
Date of the start transition execution
LogEnabled #
Boolean
The flag indicates that this process is logging
ActionParameterBeforeSubstitution #
String
Action parameter before substitution
CalendarName #
String
Work calendar name
ExternalParametersProvider #
IWorkflowExternalParametersProvider
Returns the external parameter provider IWorkflowExternalParametersProvider
ProcessScheme #
ProcessDefinition
Returns parsed scheme of the process ProcessDefinition
IsSchemeObsolete #
Boolean
Sign that the scheme of the process is obsolete
IsSubprocess #
Boolean
Returns true if the process is subprocess
ProcessParameters #
ParametersCollection
Returns the list of process parameters ParameterDefinitionWithValue
MergedSubprocessParameters #
ParametersCollection
Returns the list of process parameters ParameterDefinitionWithValue from a subprocess which was merged with current process.
this[string, ParameterPurpose] #
dynamic
Get and set a parameter
Localizer #
Localizer
Provides localized strings. For search used sources from runtime owner and ProcessInstance.ProcessScheme

Methods

public static ProcessInstance Create(WorkflowRuntime runtime, Guid schemeId, Guid processId, ProcessDefinition processScheme, bool isSchemeObsolete, string tenantId = null, string calendarName = null) #
Create ProcessInstance object

Parameters

Name
Type
Description
runtime
WorkflowRuntime
The instance of the runtime
schemeId
Guid
Id of the scheme of the process
processId
Guid
Id of the process
processScheme
ProcessDefinition
Parsed scheme of the process
isSchemeObsolete
Boolean
Sign that the scheme of the process is obsolete
tenantId
String
Id of tenant
calendarName
String
Work calendar name

Returns

Type
Description
ProcessInstance
ProcessInstance object
public string GetSchemeCodeForActionCall() #
Returns the code of the scheme from which the actions are called. For a subprocess it will be RootSchemeCode for root (ordinary) process it will be SchemeCode

Returns

Type
Description
String
public void Save(WorkflowRuntime runtime) #
Save the runtime

Parameters

Name
Type
Description
runtime
WorkflowRuntime
public Task SaveAsync(WorkflowRuntime runtime) #
Save runtime (asynchronous version)

Parameters

Name
Type
Description
runtime
WorkflowRuntime

Returns

Type
Description
Task
public ICalendar GetCalendar() #
Get work calendar

Returns

Type
Description
ICalendar
Work calendar
public ProcessInstance Clone() #
Clones ProcessInstance object

Returns

Type
Description
ProcessInstance
Cloned ProcessInstance object
public void AddParameter(ParameterDefinitionWithValue parameter) #
Adds parameter to process parameters collection

Parameters

Name
Type
Description
parameter
ParameterDefinitionWithValue
Parameter with value ParameterDefinitionWithValue
public void AddParameters(IEnumerable<ParameterDefinitionWithValue> parameters) #
Adds parameters to process parameters collection

Parameters

Name
Type
Description
parameters
IEnumerable<ParameterDefinitionWithValue>
Collection of parameters with value ParameterDefinitionWithValue
public bool IsParameterExisting(string name) #
Checks that the parameter whether exists or not

Parameters

Name
Type
Description
name
String
Name of the parameter

Returns

Type
Description
Boolean
true if exists
public ParameterDefinitionWithValue GetParameter(string name) #
Returns parameter with value ParameterDefinitionWithValue with specific name

Parameters

Name
Type
Description
name
String
Name of the parameter

Returns

Type
Description
ParameterDefinitionWithValue
Parameter with value ParameterDefinitionWithValue
public Task<ParameterDefinitionWithValue> GetParameterAsync(string name) #
Returns parameter with value ParameterDefinitionWithValue with specific name (asynchronous version)

Parameters

Name
Type
Description
name
String
Name of the parameter

Returns

Type
Description
Task<ParameterDefinitionWithValue>
Parameter with value ParameterDefinitionWithValue
public T GetParameter<T>(string name) #
Returns parameter's value by specific name

Parameters

Name
Type
Description
name
String
Name of the parameter

Returns

Type
Description
{T}
Value of the parameter
public Task<T> GetParameterAsync<T>(string name) #
Returns parameter's value by specific name (asynchronous version)

Parameters

Name
Type
Description
name
String
Name of the parameter

Returns

Type
Description
Task<T>
Value of the parameter
public void SetParameter<T>(string name, T value, ParameterPurpose purposeIfMissing = ParameterPurpose.Temporary) #
Set value of the parameter with specific name. If the definition of the parameter with specific name is absent in the scheme of the process ProcessDefinition.Parameters, there will be created Temporary parameter ParameterDefinition.Purpose with specified name

Parameters

Name
Type
Description
name
String
Name of the parameter
value
{T}
Value of the parameter
purposeIfMissing
ParameterPurpose
Purpose if it is missing ParameterPurpose
public Task SetParameterAsync<T>(string name, T value, ParameterPurpose purposeIfMissing = ParameterPurpose.Temporary) #
Set value of the parameter with specific name (asynchronous version). If the definition of the parameter with specific name is absent in the scheme of the process ProcessDefinition.Parameters, there will be created Temporary parameter ParameterDefinition.Purpose with specified name

Parameters

Name
Type
Description
name
String
Name of the parameter
value
{T}
Value of the parameter
purposeIfMissing
ParameterPurpose
Purpose if it is missing ParameterPurpose

Returns

Type
Description
Task
public void SetImplicitSerializedParameter(string name, string value, ParameterPurpose purposeIfMissing = ParameterPurpose.Temporary) #
Sets implicit parameter using it's json serialized value

Parameters

Name
Type
Description
name
String
Name of the parameter
value
String
JSON serialized value of implicit parameter
purposeIfMissing
ParameterPurpose
Parameter purpose
public void RemoveParameter(string name) #
Remove parameter from process parameters

Parameters

Name
Type
Description
name
String
Parameter name
public void SetProcessParameters(List<ParameterDefinitionWithValue> parameters) #
Replace process parameters collection by new value

Parameters

Name
Type
Description
parameters
List<ParameterDefinitionWithValue>
>Collection of parameters with value ParameterDefinitionWithValue
public void InitPersistenceParametersFromScheme() #
Initiates persistence parameters from the scheme
public bool ExecuteConditionFromCodeActions(string name, WorkflowRuntime runtime, string parameter) #
Check condition from global or local code actions with specific name

Parameters

Name
Type
Description
name
String
Name of the condition to check
runtime
WorkflowRuntime
The instance of WorkflowRuntime
parameter
String
Additional action parameter

Returns

Type
Description
Boolean
Condition result
public Task<bool> ExecuteConditionFromCodeActionsAsync(string name, WorkflowRuntime runtime, string parameter) #
Check condition from global or local code actions with specific name (asynchronous version)

Parameters

Name
Type
Description
name
String
Name of the condition to check
runtime
WorkflowRuntime
The instance of WorkflowRuntime
parameter
String
Additional action parameter

Returns

Type
Description
Task<Boolean>
Condition result
public void ExecuteCodeAction(string name, WorkflowRuntime runtime, string parameter) #
Execute action from global or local code actions with specific name

Parameters

Name
Type
Description
name
String
Name of the action to execute
runtime
WorkflowRuntime
The instance of WorkflowRuntime
parameter
String
Additional action parameter
public Task ExecuteCodeActionAsync(string name, WorkflowRuntime runtime, string parameter) #
Execute action from global or local code actions with specific name (asynchronous version)

Parameters

Name
Type
Description
name
String
Name of the action to execute
runtime
WorkflowRuntime
The instance of WorkflowRuntime
parameter
String
Additional action parameter

Returns

Type
Description
Task
public string GetLocalizedStateName(string name, CultureInfo culture = null) #
Returns localized state name in specific culture

Parameters

Name
Type
Description
name
String
System state name
culture
CultureInfo
Desired culture. If null then used CultureInfo.CurrentCulture

Returns

Type
Description
String
Localized state name if exists, else input name
public string GetLocalizedCommandName(string name, CultureInfo culture = null) #
Returns localized command name in specific culture

Parameters

Name
Type
Description
name
String
System command name
culture
CultureInfo
Desired culture. If null then used CultureInfo.CurrentCulture

Returns

Type
Description
String
Localized command name if exists, else input name
public string GetLocalizedParameterName(string name, CultureInfo culture = null) #
Returns localized parameter name in specific culture

Parameters

Name
Type
Description
name
String
System parameter name
culture
CultureInfo
Desired culture. If null then used CultureInfo.CurrentCulture

Returns

Type
Description
String
Localized parameter name if exists, else input name
public string GetLocalizedActionName(string name, CultureInfo culture = null) #
Returns localized action name in specific culture

Parameters

Name
Type
Description
name
String
System action name
culture
CultureInfo
Desired culture. If null then used CultureInfo.CurrentCulture

Returns

Type
Description
String
Localized action name if exists, else input name
public string GetLocalizedConditionName(string name, CultureInfo culture = null) #
Returns localized condition name in specific culture

Parameters

Name
Type
Description
name
String
System condition name
culture
CultureInfo
Desired culture. If null then used CultureInfo.CurrentCulture

Returns

Type
Description
String
Localized condition name if exists, else input name
public string GetLocalizedSchemeName(CultureInfo culture = null) #
Returns localized scheme name in specific culture

Parameters

Name
Type
Description
culture
CultureInfo
Desired culture. If null then used CultureInfo.CurrentCulture

Returns

Type
Description
String
Localized scheme name if exists, else just ProcessDefinition.Name
public string GetLocalizedComment(string key, CultureInfo culture = null) #
Returns localized comment in specific culture

Parameters

Name
Type
Description
key
String
Key for search localized comment
culture
CultureInfo
Desired culture. If null then used CultureInfo.CurrentCulture

Returns

Type
Description
String
Localized value if exists, else input key
public string ProcessParametersToString(ParameterPurpose purpose) #
Returns process parameters formatted to string

Parameters

Name
Type
Description
purpose
ParameterPurpose
Parameter purpose to filter parameters ParameterPurpose

Returns

Type
Description
String
Formatted string with parameters values
public void SetActivityAfterActionExecution(string activityName) #
Activity will be set and executed immediately after the current Action execution will be completed.

Parameters

Name
Type
Description
activityName
String
Activity name to set and execute
public void SetActivityAfterActivityExecution(string activityName) #
Activity will be set and executed immediately after the current Activity execution (i.e execution of all Actions of this Activity) will be completed.

Parameters

Name
Type
Description
activityName
String
Activity name to set and execute
public void SetStateAfterActionExecution(string stateName) #
State will be set and executed immediately after the current Action execution will be completed.

Parameters

Name
Type
Description
stateName
String
State name to set and execute
public void SetStateAfterActivityExecution(string stateName) #
State will be set and executed immediately after the current Activity execution (i.e execution of all Actions of this Activity) will be completed.

Parameters

Name
Type
Description
stateName
String
State name to set and execute
public string SubstituteValue(string parameter) #
Returns a substituted value (asynchronous version)

Parameters

Name
Type
Description
parameter
String
Parameter name

Returns

Type
Description
String
public Task<string> SubstituteValueAsync(string parameter) #
Returns a substituted value (asynchronous version)

Parameters

Name
Type
Description
parameter
String
Parameter name

Returns

Type
Description
Task<String>
public T GetRootPersistedParameter<T>(string parameterName) #
Returns the persisted parameter from the root process

Parameters

Name
Type
Description
parameterName
String
Parameter name

Returns

Type
Description
{T}
public Task<T> GetRootPersistedParameterAsync<T>(string parameterName) #
Returns the persisted parameter from the root process (asynchronous version)

Parameters

Name
Type
Description
parameterName
String
Parameter name

Returns

Type
Description
Task<T>
public ParameterDefinitionWithValue GetRootPersistedParameter(string parameterName) #
Returns the persisted parameter from the root process ParameterDefinitionWithValue

Parameters

Name
Type
Description
parameterName
String
Parameter name

Returns

Type
Description
ParameterDefinitionWithValue
public Task<ParameterDefinitionWithValue> GetRootPersistedParameterAsync(string parameterName) #
Returns the persisted parameter from the root process ParameterDefinitionWithValue (asynchronous version)

Parameters

Name
Type
Description
parameterName
String
Parameter name

Returns

Type
Description
Task<ParameterDefinitionWithValue>
public void SetRootPersistenceParameter<T>(string parameterName, T value) #
Set the persistence parameter to the root process

Parameters

Name
Type
Description
parameterName
String
Parameter name
value
{T}
Value
public Task SetRootPersistenceParameterAsync<T>(string parameterName, T value) #
Set the persistence parameter to the root process (asynchronous version)

Parameters

Name
Type
Description
parameterName
String
Parameter name
value
{T}
Value

Returns

Type
Description
Task
public void RemoveRootPersistenceParameter(string parameterName) #
Remove the persistence parameter from the root process

Parameters

Name
Type
Description
parameterName
String
Parameter name
public Task RemoveRootPersistenceParameterAsync(string parameterName) #
Remove the persistence parameter from the root process (asynchronous version)

Parameters

Name
Type
Description
parameterName
String
Parameter name

Returns

Type
Description
Task