Class ProcessInstance
OptimaJet.Workflow.Core.Model.ProcessInstance
Represent a instance of a specific process
Namespace: OptimaJet.Workflow.Core.Model
public sealed class ProcessInstanceInheritance
- System.Object
Properties
Name
Type
ProcessId #GuidReturns Id of the process
ParentProcessId #Nullable<Guid>Returns Id of the parent process if this process is subprocess (parallel branch)
RootProcessId #GuidReturns Id of the root process in the subprocesses hierarchy if this process is subprocess (parallel branch)
SchemeId #GuidReturns Id of the scheme of the process
PreviousState #StringReturns the name of the state which was initial for last executed direct transition TransitionDefinition.From
ExecutedTimer #StringReturns the name of the currently executing timer, filled if the transition process was initiated by a timer
PreviousStateForDirect #StringReturns the name of the state which was initial for last executed transition marked as direct TransitionDefinition.From
PreviousStateForReverse #StringReturns the name of the state which was initial for last executed transition marked as reverse TransitionDefinition.From
PreviousActivityName #StringReturns the name of the activity which was initial for last executed transition TransitionDefinition.From
PreviousActivityForDirectName #StringReturns the name of the activity which was initial for last executed transition marked as direct TransitionDefinition.From
PreviousActivityForReverseName #StringReturns the name of the activity which was initial for last executed transition marked as reverse TransitionDefinition.From
CurrentCommand #StringReturns the name of the currently executing command, filled if the transition process was initiated by a command
IdentityId #StringReturns the user id which execute a command or set a state
ImpersonatedIdentityId #StringReturns the user id for whom executes a command or sets a state
ExecutedActivityState #StringReturns the name of the state which is final for currently executing transition TransitionDefinition.To
ExecutedActivity #ActivityDefinitionReturns the activity which is final for currently executing transition TransitionDefinition.To
ExecutedTransition #TransitionDefinitionReturns the currently executing transition TransitionDefinition.To
CurrentActivityName #StringReturns 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 #StringReturns the code of the scheme of the process
CurrentState #StringReturns the name of the current state. State which was final for last executed transition TransitionDefinition.From
TenantId #StringReturns the tenant's identifier
StartTransitionalProcessActivity #StringReturns the name of the activity from which the transitional process was started.
CurrentActivity #ActivityDefinitionReturns the name of the current activity. Activity which was final for last executed transition TransitionDefinition.From
IsPreExecution #BooleanReturns true within pre-execution mode
SubprocessName #StringIf the process is a subprocess, its name will be here
CreationDate #DateTimeDate of the process creation
LastTransitionDate #Nullable<DateTime>Date of the last transition execution
StartTransitionTime #Nullable<DateTime>Date of the start transition execution
LogEnabled #BooleanThe flag indicates that this process is logging
ActionParameterBeforeSubstitution #StringAction parameter before substitution
CalendarName #StringWork calendar name
ExternalParametersProvider #IWorkflowExternalParametersProviderReturns the external parameter provider IWorkflowExternalParametersProvider
ProcessScheme #ProcessDefinitionReturns parsed scheme of the process ProcessDefinition
IsSchemeObsolete #BooleanSign that the scheme of the process is obsolete
IsSubprocess #BooleanReturns true if the process is subprocess
ProcessParameters #ParametersCollectionReturns the list of process parameters ParameterDefinitionWithValue
MergedSubprocessParameters #ParametersCollectionReturns the list of process parameters ParameterDefinitionWithValue from a subprocess which was merged with current process.
this[string, ParameterPurpose] #dynamicGet and set a parameter
Localizer #LocalizerProvides 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
runtimeWorkflowRuntimeThe instance of the runtime
schemeIdGuidId of the scheme of the process
processIdGuidId of the process
processSchemeProcessDefinitionParsed scheme of the process
isSchemeObsoleteBooleanSign that the scheme of the process is obsolete
tenantIdStringId of tenant
calendarNameStringWork calendar name
Returns
Type
Description
ProcessInstanceProcessInstance 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
Stringpublic Task SaveAsync(WorkflowRuntime runtime) #Save runtime (asynchronous version)
Parameters
Name
Type
Description
Returns
Type
Description
Taskpublic ProcessInstance Clone() #Clones ProcessInstance object
Returns
Type
Description
ProcessInstanceCloned ProcessInstance object
public void AddParameter(ParameterDefinitionWithValue parameter) #Adds parameter to process parameters collection
Parameters
Name
Type
Description
public void AddParameters(IEnumerable<ParameterDefinitionWithValue> parameters) #Adds parameters to process parameters collection
Parameters
Name
Type
Description
parametersIEnumerable<ParameterDefinitionWithValue>Collection of parameters with value ParameterDefinitionWithValue
public bool IsParameterExisting(string name) #Checks that the parameter whether exists or not
Parameters
Name
Type
Description
nameStringName of the parameter
Returns
Type
Description
Booleantrue if exists
public ParameterDefinitionWithValue GetParameter(string name) #Returns parameter with value ParameterDefinitionWithValue with specific name
Parameters
Name
Type
Description
nameStringName of the parameter
Returns
Type
Description
ParameterDefinitionWithValueParameter with value ParameterDefinitionWithValue
public Task<ParameterDefinitionWithValue> GetParameterAsync(string name) #Returns parameter with value ParameterDefinitionWithValue with specific name (asynchronous version)
Parameters
Name
Type
Description
nameStringName 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
nameStringName 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
nameStringName 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
nameStringName of the parameter
value{T}Value of the parameter
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
nameStringName of the parameter
value{T}Value of the parameter
Returns
Type
Description
Taskpublic void SetImplicitSerializedParameter(string name, string value, ParameterPurpose purposeIfMissing = ParameterPurpose.Temporary) #Sets implicit parameter using it's json serialized value
Parameters
Name
Type
Description
nameStringName of the parameter
valueStringJSON serialized value of implicit parameter
purposeIfMissingParameterPurposeParameter purpose
public void RemoveParameter(string name) #Remove parameter from process parameters
Parameters
Name
Type
Description
nameStringParameter name
public void SetProcessParameters(List<ParameterDefinitionWithValue> parameters) #Replace process parameters collection by new value
Parameters
Name
Type
Description
parametersList<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
nameStringName of the condition to check
parameterStringAdditional action parameter
Returns
Type
Description
BooleanCondition 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
nameStringName of the condition to check
parameterStringAdditional 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
nameStringName of the action to execute
parameterStringAdditional 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
nameStringName of the action to execute
parameterStringAdditional action parameter
Returns
Type
Description
Taskpublic string GetLocalizedStateName(string name, CultureInfo culture = null) #Returns localized state name in specific culture
Parameters
Name
Type
Description
nameStringSystem state name
Returns
Type
Description
StringLocalized state name if exists, else input
namepublic string GetLocalizedCommandName(string name, CultureInfo culture = null) #Returns localized command name in specific culture
Parameters
Name
Type
Description
nameStringSystem command name
Returns
Type
Description
StringLocalized command name if exists, else input
namepublic string GetLocalizedParameterName(string name, CultureInfo culture = null) #Returns localized parameter name in specific culture
Parameters
Name
Type
Description
nameStringSystem parameter name
Returns
Type
Description
StringLocalized parameter name if exists, else input
namepublic string GetLocalizedActionName(string name, CultureInfo culture = null) #Returns localized action name in specific culture
Parameters
Name
Type
Description
nameStringSystem action name
Returns
Type
Description
StringLocalized action name if exists, else input
namepublic string GetLocalizedConditionName(string name, CultureInfo culture = null) #Returns localized condition name in specific culture
Parameters
Name
Type
Description
nameStringSystem condition name
Returns
Type
Description
StringLocalized condition name if exists, else input
namepublic string GetLocalizedSchemeName(CultureInfo culture = null) #Returns localized scheme name in specific culture
Parameters
Name
Type
Description
Returns
Type
Description
StringLocalized 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
keyStringKey for search localized comment
Returns
Type
Description
StringLocalized value if exists, else input
keypublic string ProcessParametersToString(ParameterPurpose purpose) #Returns process parameters formatted to string
Parameters
Name
Type
Description
Returns
Type
Description
StringFormatted 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
activityNameStringActivity 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
activityNameStringActivity 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
stateNameStringState 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
stateNameStringState name to set and execute
public string SubstituteValue(string parameter) #Returns a substituted value (asynchronous version)
Parameters
Name
Type
Description
parameterStringParameter name
Returns
Type
Description
Stringpublic Task<string> SubstituteValueAsync(string parameter) #Returns a substituted value (asynchronous version)
Parameters
Name
Type
Description
parameterStringParameter name
Returns
Type
Description
Task<String>public T GetRootPersistedParameter<T>(string parameterName) #Returns the persisted parameter from the root process
Parameters
Name
Type
Description
parameterNameStringParameter 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
parameterNameStringParameter name
Returns
Type
Description
Task<T>public ParameterDefinitionWithValue GetRootPersistedParameter(string parameterName) #Returns the persisted parameter from the root process ParameterDefinitionWithValue
Parameters
Name
Type
Description
parameterNameStringParameter name
Returns
Type
Description
ParameterDefinitionWithValuepublic Task<ParameterDefinitionWithValue> GetRootPersistedParameterAsync(string parameterName) #Returns the persisted parameter from the root process ParameterDefinitionWithValue (asynchronous version)
Parameters
Name
Type
Description
parameterNameStringParameter 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
parameterNameStringParameter 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
parameterNameStringParameter name
value{T}Value
Returns
Type
Description
Taskpublic void RemoveRootPersistenceParameter(string parameterName) #Remove the persistence parameter from the root process
Parameters
Name
Type
Description
parameterNameStringParameter name
public Task RemoveRootPersistenceParameterAsync(string parameterName) #Remove the persistence parameter from the root process (asynchronous version)
Parameters
Name
Type
Description
parameterNameStringParameter name
Returns
Type
Description
Task