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.
Namespace: OptimaJet.Workflow.Core.Model
public sealed class ProcessDefinition : BaseDefinitionType Hierarchy
- BaseDefinition
- ProcessDefinition Current type
Constructors
public ProcessDefinition() #Initializes a new instance of the ProcessDefinition class with empty definition collections.
Remarks
Initializes ProcessDefinition.Actors, ProcessDefinition.Parameters, ProcessDefinition.Commands, ProcessDefinition.Timers, ProcessDefinition.Comments, ProcessDefinition.Activities, ProcessDefinition.Transitions, ProcessDefinition.Localization, ProcessDefinition.AdditionalParams, ProcessDefinition.CodeActions, and ProcessDefinition.Tags.
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; } #Gets the distinct ActivityDefinition.SchemeCode values for activities whose ActivityDefinition.ActivityType is ActivityType.Inline.
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; } #Gets the first ActivityDefinition in ProcessDefinition.Activities whose ActivityDefinition.IsInitial value is true; otherwise, null.
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
activityNameStringThe activity name to find.
Returns
Type
Description
ActivityDefinitionThe matching ActivityDefinition.
Exceptions
Type
Description
ActivityNotFoundExceptionNo activity is named
activityName.InvalidOperationExceptionMore 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
Returns
Type
Description
ActivityDefinitionThe matching ActivityDefinition.
Exceptions
Type
Description
ActivityNotFoundExceptionNo 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
nameStringThe command name to find.
Returns
Type
Description
CommandDefinitionThe matching CommandDefinition.
Exceptions
Type
Description
CommandNotFoundExceptionNo command is named
name.InvalidOperationExceptionMore than one command is named
name.public ActorDefinition FindActor(string name) #Finds the actor named
name using StringComparison.Ordinal.Parameters
Name
Type
Description
nameStringThe actor name to find.
Returns
Type
Description
ActorDefinitionThe matching ActorDefinition.
Exceptions
Type
Description
ActorNotFoundExceptionNo actor is named
name.InvalidOperationExceptionMore than one actor is named
name.public ParameterDefinition FindParameterDefinition(string name) #Finds the parameter named
name using StringComparison.Ordinal.Parameters
Name
Type
Description
nameStringThe parameter name to find.
Returns
Type
Description
ParameterDefinitionThe matching ParameterDefinition, or null if no match exists.
Exceptions
Type
Description
InvalidOperationExceptionMore than one parameter is named
name.public TransitionDefinition FindTransition(string name) #Finds the transition named
name using StringComparison.Ordinal.Parameters
Name
Type
Description
nameStringThe transition name to find.
Returns
Type
Description
TransitionDefinitionThe matching TransitionDefinition.
Exceptions
Type
Description
TransitionNotFoundExceptionNo transition is named
name.InvalidOperationExceptionMore 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
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
Returns
Type
Description
IEnumerable<TransitionDefinition>The matching TransitionDefinition instances.
Exceptions
Type
Description
ArgumentOutOfRangeExceptionThrown 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
Returns
Type
Description
IEnumerable<TransitionDefinition>The matching command-triggered TransitionDefinition instances.
Exceptions
Type
Description
ArgumentOutOfRangeExceptionThrown 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
Returns
Type
Description
IEnumerable<TransitionDefinition>The matching automatically triggered TransitionDefinition instances.
Exceptions
Type
Description
ArgumentOutOfRangeExceptionThrown 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
commandNameStringThe command name to match.
Returns
Type
Description
IEnumerable<TransitionDefinition>The matching command-triggered TransitionDefinition instances.
Exceptions
Type
Description
ArgumentOutOfRangeExceptionThrown 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
Returns
Type
Description
IEnumerable<TransitionDefinition>The matching timer-triggered TransitionDefinition instances.
Exceptions
Type
Description
ArgumentOutOfRangeExceptionThrown 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
Returns
Type
Description
StringThe 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
Returns
Type
Description
StringThe 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
Returns
Type
Description
StringThe 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
Returns
Type
Description
StringThe 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
Returns
Type
Description
StringThe 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
Returns
Type
Description
StringThe 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
Returns
Type
Description
StringThe 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
ProcessDefinitionA new ProcessDefinition that includes the ProcessDefinition.Activities, ProcessDefinition.Transitions, and ProcessDefinition.CodeActions collections.
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
doNotCloneActivitiesBooleandoNotCloneTransitionsBooleandoNotCloneCodeActionsBooleanReturns
Type
Description
ProcessDefinitionA new ProcessDefinition containing copies of the definition collections not omitted by
doNotCloneActivities, doNotCloneTransitions, and doNotCloneCodeActions.Exceptions
Type
Description
InvalidOperationExceptionA 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
StringProcessDefinition.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
StringThe 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
XElementAn 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
activityNameStringThe activity name used to select an activity.
Returns
Type
Description
{T}The matching Annotation.JsonValue deserialized as
T.Exceptions
Type
Description
ActivityNotFoundExceptionNo activity is named
activityName.InvalidOperationExceptionMore than one activity is named
activityName.public string GetActivityAnnotation(string activityName, string name) #Parameters
Name
Type
Description
activityNameStringThe activity name used to select an activity.
Returns
Type
Description
StringExceptions
Type
Description
ActivityNotFoundExceptionNo activity is named
activityName.InvalidOperationExceptionMore 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
transitionNameStringThe transition name used to select a transition.
Returns
Type
Description
{T}The matching Annotation.JsonValue deserialized as
T.Exceptions
Type
Description
TransitionNotFoundExceptionNo transition is named
transitionName.InvalidOperationExceptionMore than one transition is named
transitionName.public string GetTransitionAnnotation(string transitionName, string name) #Parameters
Name
Type
Description
transitionNameStringThe transition name used to select a transition.
Returns
Type
Description
StringExceptions
Type
Description
TransitionNotFoundExceptionNo transition is named
transitionName.InvalidOperationExceptionMore than one transition is named
transitionName.