Assembly: OptimaJet.Workflow.Core

Class ProcessDefinition

OptimaJet.Workflow.Core.Model.ProcessDefinition

Represents the parsed and built form of a scheme used to create and execute process instances, including its activities, transitions, commands, parameters, timers, and other definitions.

public sealed class ProcessDefinition : BaseDefinition

Type Hierarchy

Constructors

Properties

[JsonIgnore] [JsonIgnore] public CodeActionsInvoker CodeActionsInvoker { get; } #
Gets the ProcessDefinition.CodeActionsInvoker that invokes compiled code actions represented by CodeActionDefinition instances in this process scheme.
[JsonIgnore] [JsonIgnore] public ExpressionsInvoker ExpressionsInvoker { get; } #
Gets the ProcessDefinition.ExpressionsInvoker that evaluates compiled ConditionType.Expression conditions for this process scheme.
[JsonIgnore] [JsonIgnore] public SubprocessNameGetterInvoker SubprocessNameGetterInvoker { get; } #
Gets the ProcessDefinition.SubprocessNameGetterInvoker that evaluates configured TransitionDefinition.SubprocessName values for this process scheme.
[JsonIgnore] [JsonIgnore] public ExpressionManager ExpressionManager { get; } #
Gets the ProcessDefinition.ExpressionManager that compiles, caches, and evaluates expressions for this process scheme.
public List<ActorDefinition> Actors { get; set; } #
Gets or sets the ActorDefinition instances available to the process scheme, including actors whose ActorDefinition.IsPredefined value is true.
public List<ParameterDefinition> Parameters { get; set; } #
Gets or sets the ParameterDefinition instances available to the process scheme, including definitions from DefaultDefinitions.DefaultParameters.
public List<CommandDefinition> Commands { get; set; } #
Gets or sets the CommandDefinition instances contained in the process scheme.
public List<TimerDefinition> Timers { get; set; } #
Gets or sets the TimerDefinition instances contained in the process scheme.
public List<CommentDefinition> Comments { get; set; } #
Gets or sets the CommentDefinition instances contained in the process scheme.
public List<ActivityDefinition> Activities { get; set; } #
Gets or sets the ActivityDefinition instances contained in the process scheme.
public List<TransitionDefinition> Transitions { get; set; } #
Gets or sets the TransitionDefinition instances contained in the process scheme.
public Localization Localization { get; set; } #
Gets or sets the Translation entries for the process scheme.
public Localizer Localizer { get; } #
Gets a new ProcessDefinition.Localizer that resolves values from ProcessDefinition.Localization.
public List<CodeActionDefinition> CodeActions { get; set; } #
Gets or sets the CodeActionDefinition instances contained in the process scheme.
public string CodeActionsCommonUsings { get; set; } #
Gets or sets the semicolon-delimited namespace imports shared when CodeActionDefinition instances are compiled.
public Dictionary<string, object> AdditionalParams { get; set; } #
Gets or sets data supplied to Workflow Designer in addition to the process scheme model.
public bool CanBeInlined { get; set; } #
Gets or sets a value indicating whether this process scheme can be inlined into another process scheme.
public bool LogEnabled { get; set; } #
Gets or sets a value indicating whether logging is enabled by default through ProcessInstance.LogEnabled for process instances created from this scheme.
public List<string> InlinedSchemes { get; } #
public string StartingTransition { get; set; } #
Gets or sets the name of the TransitionDefinition that started this subprocess scheme.
public List<string> Tags { get; } #
Gets the tags associated with the process scheme.
[JsonIgnore] [JsonIgnore] public bool ContainsSubprocesses { get; } #
Gets a value indicating whether any transition has TransitionDefinition.IsFork set to true.
[JsonIgnore] [JsonIgnore] public ActivityDefinition InitialActivity { get; } #
public ParameterDefinition[] ParametersForSerialize { get; } #
Gets the ParameterDefinition instances whose parameter names are not used by any definition in DefaultDefinitions.DefaultParameters, or null when ProcessDefinition.Parameters is null.
public IEnumerable<ParameterDefinition> PersistenceParameters { get; } #
Gets the parameter definitions whose ParameterDefinition.Purpose is ParameterPurpose.Persistence.
public ActorDefinition[] ActorsForSerialize { get; } #
Gets the actor definitions whose ActorDefinition.IsPredefined value is false, or null when ProcessDefinition.Actors is null.
public string RootSchemeCode { get; set; } #
Gets or sets the code of the root process scheme for this subprocess scheme.
public Guid? RootSchemeId { get; set; } #
Gets or sets the identifier of the root process scheme for this subprocess scheme.
public bool IsObsolete { get; set; } #
Gets or sets a value indicating whether this process scheme is obsolete.
public Guid Id { get; set; } #
Gets or sets the identifier of this process scheme.
public string TenantId { get; set; } #
Gets or sets the tenant identifier associated with this process scheme.
public bool IsSubprocessScheme { get; } #
Gets a value indicating whether ProcessDefinition.RootSchemeId has a value different from ProcessDefinition.Id.
public List<string> AllowedActivities { get; set; } #
Gets or sets the names of parent-process ActivityDefinition instances during which this subprocess may remain active.
public string CalendarName { get; set; } #
Gets or sets the scheme-level work calendar name used by ProcessInstance.GetCalendar() when ProcessInstance.CalendarName is null.

Methods

public ActivityDefinition FindActivity(string activityName) #
Finds the activity named activityName using StringComparison.Ordinal.

Parameters

Name
Type
Description
activityName
String
The activity name to find.

Returns

Type
Description
ActivityDefinition
The matching ActivityDefinition.

Exceptions

Type
Description
ActivityNotFoundException
No activity is named activityName.
InvalidOperationException
More than one activity is named activityName.
public ActivityDefinition FindSetStateActivity(string stateName) #
Finds the first activity that can be selected by business state name through ActivityDefinition.IsForSetState.

Parameters

Name
Type
Description
stateName
String
The value to match against ActivityDefinition.State using StringComparison.Ordinal.

Returns

Type
Description
ActivityDefinition
The matching ActivityDefinition.

Exceptions

Type
Description
ActivityNotFoundException
No activity has a nonempty ActivityDefinition.State equal to stateName and ActivityDefinition.IsForSetState set to true.
public CommandDefinition FindCommand(string name) #
Finds the command named name using StringComparison.Ordinal.

Parameters

Name
Type
Description
name
String
The command name to find.

Returns

Type
Description
CommandDefinition
The matching CommandDefinition.

Exceptions

Type
Description
CommandNotFoundException
No command is named name.
InvalidOperationException
More than one command is named name.
public ActorDefinition FindActor(string name) #
Finds the actor named name using StringComparison.Ordinal.

Parameters

Name
Type
Description
name
String
The actor name to find.

Returns

Type
Description
ActorDefinition
The matching ActorDefinition.

Exceptions

Type
Description
ActorNotFoundException
No actor is named name.
InvalidOperationException
More than one actor is named name.
public ParameterDefinition FindParameterDefinition(string name) #
Finds the parameter named name using StringComparison.Ordinal.

Parameters

Name
Type
Description
name
String
The parameter name to find.

Returns

Type
Description
ParameterDefinition
The matching ParameterDefinition, or null if no match exists.

Exceptions

Type
Description
InvalidOperationException
More than one parameter is named name.
public TransitionDefinition FindTransition(string name) #
Finds the transition named name using StringComparison.Ordinal.

Parameters

Name
Type
Description
name
String
The transition name to find.

Returns

Type
Description
TransitionDefinition
The matching TransitionDefinition.

Exceptions

Type
Description
TransitionNotFoundException
No transition is named name.
InvalidOperationException
More than one transition is named name.
public List<TransitionDefinition> FindTransitions(ActivityDefinition from, ActivityDefinition to) #
Finds transitions whose TransitionDefinition.From and TransitionDefinition.To activity names match from and to, respectively, using StringComparison.Ordinal.

Parameters

Name
Type
Description
from
ActivityDefinition
The source ActivityDefinition whose name must match.
to
ActivityDefinition
The destination ActivityDefinition whose name must match.

Returns

Type
Description
List<TransitionDefinition>
A list of matching TransitionDefinition instances.
public IEnumerable<TransitionDefinition> GetPossibleTransitionsForActivity(ActivityDefinition activity, ForkTransitionSearchType forkTransitionSearch = ForkTransitionSearchType.NotFork) #
Gets transitions whose TransitionDefinition.From references activity and whose TransitionDefinition.IsFork value matches forkTransitionSearch.

Parameters

Name
Type
Description
activity
ActivityDefinition
The source ActivityDefinition.
forkTransitionSearch
ForkTransitionSearchType
The ForkTransitionSearchType filter to apply.

Returns

Type
Description
IEnumerable<TransitionDefinition>
The matching TransitionDefinition instances.

Exceptions

Type
Description
ArgumentOutOfRangeException
Thrown while enumerating the result if a candidate transition is evaluated and forkTransitionSearch is not a defined ForkTransitionSearchType value.
public IEnumerable<TransitionDefinition> GetCommandTransitions(ActivityDefinition activity, ForkTransitionSearchType forkTransitionSearch = ForkTransitionSearchType.NotFork) #
Gets transitions whose TransitionDefinition.From references activity, whose TriggerDefinition.Type is TriggerType.Command, and whose TransitionDefinition.IsFork value matches forkTransitionSearch.

Parameters

Name
Type
Description
activity
ActivityDefinition
The source ActivityDefinition.
forkTransitionSearch
ForkTransitionSearchType
The ForkTransitionSearchType filter to apply.

Returns

Type
Description
IEnumerable<TransitionDefinition>
The matching command-triggered TransitionDefinition instances.

Exceptions

Type
Description
ArgumentOutOfRangeException
Thrown while enumerating the result if a candidate transition is evaluated and forkTransitionSearch is not a defined ForkTransitionSearchType value.
public IEnumerable<TransitionDefinition> GetAutoTransitionForActivity(ActivityDefinition activity, ForkTransitionSearchType forkTransitionSearch = ForkTransitionSearchType.NotFork) #
Gets transitions whose TransitionDefinition.From references activity, whose TriggerDefinition.Type is TriggerType.Auto, and whose TransitionDefinition.IsFork value matches forkTransitionSearch.

Parameters

Name
Type
Description
activity
ActivityDefinition
The source ActivityDefinition.
forkTransitionSearch
ForkTransitionSearchType
The ForkTransitionSearchType filter to apply.

Returns

Type
Description
IEnumerable<TransitionDefinition>
The matching automatically triggered TransitionDefinition instances.

Exceptions

Type
Description
ArgumentOutOfRangeException
Thrown while enumerating the result if a candidate transition is evaluated and forkTransitionSearch is not a defined ForkTransitionSearchType value.
public IEnumerable<TransitionDefinition> GetCommandTransitionForActivity(ActivityDefinition activity, string commandName, ForkTransitionSearchType forkTransitionSearch = ForkTransitionSearchType.NotFork) #
Gets transitions whose TransitionDefinition.From references activity, whose TriggerDefinition.Type is TriggerType.Command, whose TriggerDefinition.Command name matches commandName using StringComparison.Ordinal, and whose TransitionDefinition.IsFork value matches forkTransitionSearch.

Parameters

Name
Type
Description
activity
ActivityDefinition
The source ActivityDefinition.
commandName
String
The command name to match.
forkTransitionSearch
ForkTransitionSearchType
The ForkTransitionSearchType filter to apply.

Returns

Type
Description
IEnumerable<TransitionDefinition>
The matching command-triggered TransitionDefinition instances.

Exceptions

Type
Description
ArgumentOutOfRangeException
Thrown while enumerating the result if a candidate transition is evaluated and forkTransitionSearch is not a defined ForkTransitionSearchType value.
public IEnumerable<TransitionDefinition> GetTimerTransitionForActivity(ActivityDefinition activity, ForkTransitionSearchType forkTransitionSearch = ForkTransitionSearchType.NotFork) #
Gets transitions whose TransitionDefinition.From references activity, whose TriggerDefinition.Type is TriggerType.Timer, and whose TransitionDefinition.IsFork value matches forkTransitionSearch.

Parameters

Name
Type
Description
activity
ActivityDefinition
The source ActivityDefinition.
forkTransitionSearch
ForkTransitionSearchType
The ForkTransitionSearchType filter to apply.

Returns

Type
Description
IEnumerable<TransitionDefinition>
The matching timer-triggered TransitionDefinition instances.

Exceptions

Type
Description
ArgumentOutOfRangeException
Thrown while enumerating the result if a candidate transition is evaluated and forkTransitionSearch is not a defined ForkTransitionSearchType value.
public string GetLocalizedStateName(string name, CultureInfo culture = null) #
Gets the localized business state name for name by using LocalizeType.State entries in ProcessDefinition.Localization.

Parameters

Name
Type
Description
name
String
The business state name matched against Translation.ObjectName.
culture
CultureInfo
The culture to use, or null to use CultureInfo.CurrentCulture.

Returns

Type
Description
String
The localized business state name, or name when no matching Translation.Value is available.
public string GetLocalizedCommandName(string name, CultureInfo culture = null) #
Gets the localized command name for name by using LocalizeType.Command entries in ProcessDefinition.Localization.

Parameters

Name
Type
Description
name
String
The command name matched against Translation.ObjectName.
culture
CultureInfo
The culture to use, or null to use CultureInfo.CurrentCulture.

Returns

Type
Description
String
The localized command name, or name when no matching Translation.Value is available.
public string GetLocalizedParameterName(string name, CultureInfo culture = null) #
Gets the localized parameter name for name by using LocalizeType.Parameter entries in ProcessDefinition.Localization.

Parameters

Name
Type
Description
name
String
The parameter name matched against Translation.ObjectName.
culture
CultureInfo
The culture to use, or null to use CultureInfo.CurrentCulture.

Returns

Type
Description
String
The localized parameter name, or name when no matching Translation.Value is available.
public string GetLocalizedActionName(string name, CultureInfo culture = null) #
Gets the localized action name for name by using LocalizeType.Action entries in ProcessDefinition.Localization.

Parameters

Name
Type
Description
name
String
The action name matched against Translation.ObjectName.
culture
CultureInfo
The culture to use, or null to use CultureInfo.CurrentCulture.

Returns

Type
Description
String
The localized action name, or name when no matching Translation.Value is available.
public string GetLocalizedConditionName(string name, CultureInfo culture = null) #
Gets the localized condition name for name by using LocalizeType.Condition entries in ProcessDefinition.Localization.

Parameters

Name
Type
Description
name
String
The condition name matched against Translation.ObjectName.
culture
CultureInfo
The culture to use, or null to use CultureInfo.CurrentCulture.

Returns

Type
Description
String
The localized condition name, or name when no matching Translation.Value is available.
public string GetLocalizedSchemeName(CultureInfo culture = null) #
Gets the localized name of this process scheme by using LocalizeType.Scheme entries in ProcessDefinition.Localization.

Parameters

Name
Type
Description
culture
CultureInfo
The culture to use, or null to use CultureInfo.CurrentCulture.

Returns

Type
Description
String
The localized process scheme name, or the original process scheme name when no matching Translation.Value is available.
public string GetLocalizedComment(string key, CultureInfo culture = null) #
Gets the localized comment for key by using LocalizeType.Comment entries in ProcessDefinition.Localization.

Parameters

Name
Type
Description
key
String
The comment key matched against Translation.ObjectName.
culture
CultureInfo
The culture to use, or null to use CultureInfo.CurrentCulture.

Returns

Type
Description
String
The localized comment, or key when no matching Translation.Value is available.
public ProcessDefinition Clone() #
Creates a copy of this process definition by calling ProcessDefinition.Clone(bool, bool, bool) with all omission options set to false.

Returns

Type
Description
public ProcessDefinition Clone(bool doNotCloneActivities, bool doNotCloneTransitions, bool doNotCloneCodeActions) #
Creates a copy of this process definition and optionally omits selected definition collections.

Parameters

Name
Type
Description
doNotCloneActivities
Boolean
true to leave ProcessDefinition.Activities empty in the copy; otherwise, false.
doNotCloneTransitions
Boolean
true to leave ProcessDefinition.Transitions empty in the copy; otherwise, false.
doNotCloneCodeActions
Boolean
true to leave ProcessDefinition.CodeActions empty in the copy; otherwise, false.

Returns

Type
Description
ProcessDefinition
A new ProcessDefinition containing copies of the definition collections not omitted by doNotCloneActivities, doNotCloneTransitions, and doNotCloneCodeActions.

Exceptions

Type
Description
InvalidOperationException
A reference in CommandDefinition.InputParameters or a copied TransitionDefinition cannot be rebound to a matching definition in the copied collections.

Remarks

Members that this method does not explicitly recreate retain their original references, including BaseDefinition.DesignerSettings and ProcessDefinition.AllowedActivities. ProcessDefinition.AdditionalParams is a new dictionary whose values retain their original references.
public string GetSchemeCodeForActionCall() #
Gets the process scheme code used for scheme-scoped action, condition, rule, and external-parameter calls.

Returns

Type
Description
String
ProcessDefinition.RootSchemeCode when ProcessDefinition.IsSubprocessScheme is true and the root scheme code is not empty; otherwise, this process scheme's name.
public string Serialize() #
Serializes the process scheme to XML by using ProcessDefinition.SerializeToXElement().

Returns

Type
Description
String
The formatted XML representation of the process scheme.
public XElement SerializeToXElement() #
Serializes this definition to an XElement in Workflow Engine process-scheme format.

Returns

Type
Description
XElement
An XElement whose root element is Process.
public T GetActivityAnnotation<T>(string activityName, string name) #
Gets an annotation from the ActivityDefinition selected by activityName and deserializes its Annotation.JsonValue to T.

Parameters

Name
Type
Description
activityName
String
The activity name used to select an activity.
name
String
The value matched against Annotation.Name.

Returns

Type
Description
{T}
The matching Annotation.JsonValue deserialized as T.

Exceptions

Type
Description
ActivityNotFoundException
No activity is named activityName.
InvalidOperationException
More than one activity is named activityName.
public string GetActivityAnnotation(string activityName, string name) #
Gets the stored Annotation.JsonValue from the ActivityDefinition selected by activityName.

Parameters

Name
Type
Description
activityName
String
The activity name used to select an activity.
name
String
The value matched against Annotation.Name.

Returns

Type
Description
String
The matching Annotation.JsonValue, or null when the activity has no annotation named name.

Exceptions

Type
Description
ActivityNotFoundException
No activity is named activityName.
InvalidOperationException
More than one activity is named activityName.
public T GetTransitionAnnotation<T>(string transitionName, string name) #
Gets an annotation from the TransitionDefinition selected by transitionName and deserializes its Annotation.JsonValue to T.

Parameters

Name
Type
Description
transitionName
String
The transition name used to select a transition.
name
String
The value matched against Annotation.Name.

Returns

Type
Description
{T}
The matching Annotation.JsonValue deserialized as T.

Exceptions

Type
Description
TransitionNotFoundException
No transition is named transitionName.
InvalidOperationException
More than one transition is named transitionName.
public string GetTransitionAnnotation(string transitionName, string name) #
Gets the stored Annotation.JsonValue from the TransitionDefinition selected by transitionName.

Parameters

Name
Type
Description
transitionName
String
The transition name used to select a transition.
name
String
The value matched against Annotation.Name.

Returns

Type
Description
String
The matching Annotation.JsonValue, or null when the transition has no annotation named name.

Exceptions

Type
Description
TransitionNotFoundException
No transition is named transitionName.
InvalidOperationException
More than one transition is named transitionName.