Assembly: OptimaJet.Workflow.Core

Class ProcessDefinitionBuilder

OptimaJet.Workflow.Core.Model.Builder.ProcessDefinitionBuilder

Provides the fluent API for constructing or modifying the ProcessDefinitionBuilder.ProcessDefinition that represents a workflow scheme.

public sealed class ProcessDefinitionBuilder : IProcessDefinitionBuilder

Type Hierarchy

Properties

public ProcessDefinition ProcessDefinition { get; } #
Gets the IProcessDefinitionBuilder.ProcessDefinition that represents the workflow scheme being built.

Methods

public static IProcessDefinitionBuilder Create(string name) #

Parameters

Name
Type
Description
name
String
The workflow scheme name.

Returns

Type
Description
public static IProcessDefinitionBuilder WithProcessDefinition(ProcessDefinition processDefinition) #
Creates an IProcessDefinitionBuilder backed by a clone of processDefinition.

Parameters

Name
Type
Description
processDefinition
ProcessDefinition

Returns

Type
Description
IProcessDefinitionBuilder
An IProcessDefinitionBuilder backed by a clone of processDefinition.
public static IProcessDefinitionBuilder WithMutableProcessDefinition(ProcessDefinition processDefinition) #
Creates an IProcessDefinitionBuilder backed directly by processDefinition.

Parameters

Name
Type
Description
processDefinition
ProcessDefinition

Returns

Type
Description
IProcessDefinitionBuilder
An IProcessDefinitionBuilder backed by processDefinition.
public IActorBuilder CreateActor(string name, string rule) #
Creates an ActorDefinition that references a workflow rule.

Parameters

Name
Type
Description
name
String
The actor name.
rule
String
The name of the workflow rule referenced by the actor.

Returns

Type
Description
IActorBuilder
An IActorBuilder positioned at the created actor.

Exceptions

Type
Description
ActorAlreadyExistsException
The process definition already contains an actor named name.
public IActorBuilder CreateOrUpdateActor(string name, string rule) #
Creates an ActorDefinition or updates the ActorDefinition.Rule of the existing actor named name.

Parameters

Name
Type
Description
name
String
The actor name.
rule
String
The name of the workflow rule referenced by the actor.

Returns

Type
Description
IActorBuilder
An IActorBuilder positioned at the created or existing actor.
public IActorBuilder UpdateActor(string name) #
Selects the existing ActorDefinition named name for modification.

Parameters

Name
Type
Description
name
String
The actor name.

Returns

Type
Description
IActorBuilder
An IActorBuilder positioned at the selected actor.

Exceptions

Type
Description
ActorNotFoundException
The process definition does not contain an actor named name.
public IProcessDefinitionBuilder DeleteActor(string name) #
Deletes the actor named name from the process definition.

Parameters

Name
Type
Description
name
String
The actor name.

Returns

Type
Description
IProcessDefinitionBuilder

Remarks

When the actor exists, the method also removes every TransitionDefinition.Restrictions entry that references it. If no actor has the requested name, the process definition is unchanged.
public IParameterBuilder CreateParameter(string name, Type type, ParameterPurpose purpose = ParameterPurpose.Temporary) #
Creates a user-defined ParameterDefinition.

Parameters

Name
Type
Description
name
String
The parameter name.
type
Type
The .NET Type of the parameter value.
purpose
ParameterPurpose
The ParameterPurpose that controls how the parameter is managed.

Returns

Type
Description
IParameterBuilder
An IParameterBuilder positioned at the created parameter.

Exceptions

Type
Description
ParameterAlreadyExistsException
The process definition already contains a parameter named name.
InvalidOperationException
public IParameterBuilder CreateOrUpdateParameter(string name, Type type, ParameterPurpose purpose) #
Creates a user-defined ParameterDefinition or updates the type and purpose of the existing parameter named name.

Parameters

Name
Type
Description
name
String
The parameter name.
type
Type
The .NET Type of the parameter value.
purpose
ParameterPurpose
The ParameterPurpose that controls how the parameter is managed.

Returns

Type
Description
IParameterBuilder
An IParameterBuilder positioned at the created or existing parameter.

Exceptions

Type
Description
InvalidOperationException
purpose is ParameterPurpose.System; or purpose is ParameterPurpose.Persistence and an existing parameter with an initial value would change its type.
public IParameterBuilder UpdateParameter(string name) #
Selects the existing ParameterDefinition named name for modification.

Parameters

Name
Type
Description
name
String
The parameter name.

Returns

Type
Description
IParameterBuilder
An IParameterBuilder positioned at the selected parameter.

Exceptions

Type
Description
ParameterNotFoundException
The process definition does not contain a parameter named name.
public IProcessDefinitionBuilder DeleteParameter(string name) #
Deletes the parameter named name from the process definition.

Parameters

Name
Type
Description
name
String
The parameter name.

Returns

Type
Description
IProcessDefinitionBuilder

Remarks

When the parameter exists, the method also removes references to it from CommandDefinition.InputParameters. If no parameter has the requested name, the process definition is unchanged.
public ICommandBuilder CreateCommand(string name) #
Creates a CommandDefinition for a named command trigger.

Parameters

Name
Type
Description
name
String
The command name.

Returns

Type
Description
ICommandBuilder
An ICommandBuilder positioned at the created command.

Exceptions

Type
Description
CommandAlreadyExistsException
The process definition already contains a command named name.
public ICommandBuilder CreateOrUpdateCommand(string name) #
Creates a CommandDefinition or selects the existing command named name.

Parameters

Name
Type
Description
name
String
The command name.

Returns

Type
Description
ICommandBuilder
An ICommandBuilder positioned at the created or existing command.
public ICommandBuilder UpdateCommand(string name) #
Selects the existing CommandDefinition named name for modification.

Parameters

Name
Type
Description
name
String
The command name.

Returns

Type
Description
ICommandBuilder
An ICommandBuilder positioned at the selected command.

Exceptions

Type
Description
CommandNotFoundException
The process definition does not contain a command named name.
public IProcessDefinitionBuilder DeleteCommand(string name) #
Deletes the command named name from the process definition.

Parameters

Name
Type
Description
name
String
The command name.

Returns

Type
Description
IProcessDefinitionBuilder

Remarks

When the command exists, transitions whose TransitionDefinition.Trigger references it are changed to use TriggerDefinition.Auto, and their TransitionDefinition.Restrictions are cleared. If no command has the requested name, the process definition is unchanged.
public ITimerBuilder CreateTimer(string name) #

Parameters

Name
Type
Description
name
String
The timer name.

Returns

Type
Description
ITimerBuilder
An ITimerBuilder positioned at the created timer.

Exceptions

Type
Description
TimerAlreadyExistsException
The process definition already contains a timer named name.
public ITimerBuilder CreateOrUpdateTimer(string name) #
Creates a TimerDefinition whose TimerDefinition.Type is TimerType.Interval and whose TimerDefinition.Value is 0, or selects the existing timer named name.

Parameters

Name
Type
Description
name
String
The timer name.

Returns

Type
Description
ITimerBuilder
An ITimerBuilder positioned at the created or existing timer.
public ITimerBuilder UpdateTimer(string name) #
Selects the existing TimerDefinition named name for modification.

Parameters

Name
Type
Description
name
String
The timer name.

Returns

Type
Description
ITimerBuilder
An ITimerBuilder positioned at the selected timer.

Exceptions

Type
Description
TimerNotFoundException
The process definition does not contain a timer named name.
public IProcessDefinitionBuilder DeleteTimer(string name) #
Deletes the timer named name from the process definition.

Parameters

Name
Type
Description
name
String
The timer name.

Returns

Type
Description
IProcessDefinitionBuilder

Remarks

When the timer exists, transitions whose TransitionDefinition.Trigger references it are changed to use TriggerDefinition.Auto. If no timer has the requested name, the process definition is unchanged.
public IActivityBuilder CreateActivity(string name) #

Parameters

Name
Type
Description
name
String
The activity name.

Returns

Type
Description
IActivityBuilder
An IActivityBuilder positioned at the created activity.

Exceptions

Type
Description
ActivityAlreadyExistsException
The process definition already contains an activity named name.
public IActivityBuilder AddActivity(ActivityDefinition activity) #
Adds an existing ActivityDefinition to the process definition if needed and selects it for modification.

Parameters

Name
Type
Description
activity
ActivityDefinition
The ActivityDefinition to add or select.

Returns

Type
Description
IActivityBuilder
An IActivityBuilder positioned at activity.

Exceptions

Type
Description
ActivityAlreadyExistsException
The process definition contains another activity with the same name as activity.
public IInlineActivityBuilder CreateInlineActivity(string name, string schemeCode) #
Creates an inline ActivityDefinition that references another process scheme.

Parameters

Name
Type
Description
name
String
The inline activity name.
schemeCode
String
The process scheme code assigned to ActivityDefinition.SchemeCode.

Returns

Type
Description
IInlineActivityBuilder
An IInlineActivityBuilder positioned at the created inline activity.

Exceptions

Type
Description
ActivityAlreadyExistsException
The process definition already contains an activity named name.
public IActivityBuilder CreateOrUpdateActivity(string name) #
Creates an ordinary ActivityDefinition or selects the existing ordinary activity named name.

Parameters

Name
Type
Description
name
String
The activity name.

Returns

Type
Description
IActivityBuilder
An IActivityBuilder positioned at the created or existing activity.

Exceptions

Type
Description
WrongActivityTypeException
The process definition contains an activity named name whose ActivityDefinition.ActivityType is not ActivityType.Ordinary.
public IInlineActivityBuilder CreateOrUpdateInlineActivity(string name, string schemeCode) #
Creates an inline ActivityDefinition or updates the referenced process scheme of the existing inline activity named name.

Parameters

Name
Type
Description
name
String
The inline activity name.
schemeCode
String
The process scheme code assigned to ActivityDefinition.SchemeCode.

Returns

Type
Description
IInlineActivityBuilder
An IInlineActivityBuilder positioned at the created or existing inline activity.

Exceptions

Type
Description
WrongActivityTypeException
The process definition contains an activity named name whose ActivityDefinition.ActivityType is not ActivityType.Inline.
public IActivityBuilder UpdateActivity(string name) #
Selects the existing ordinary ActivityDefinition named name for modification.

Parameters

Name
Type
Description
name
String
The activity name.

Returns

Type
Description
IActivityBuilder
An IActivityBuilder positioned at the selected activity.

Exceptions

Type
Description
ActivityNotFoundException
The process definition does not contain an activity named name.
WrongActivityTypeException
The activity named name has an ActivityDefinition.ActivityType other than ActivityType.Ordinary.
public IInlineActivityBuilder UpdateInlineActivity(string name) #
Selects the existing inline ActivityDefinition named name for modification.

Parameters

Name
Type
Description
name
String
The inline activity name.

Returns

Type
Description
IInlineActivityBuilder
An IInlineActivityBuilder positioned at the selected inline activity.

Exceptions

Type
Description
ActivityNotFoundException
The process definition does not contain an activity named name.
WrongActivityTypeException
The activity named name has an ActivityDefinition.ActivityType other than ActivityType.Inline.
public IActivityBuilder UpdateActivity(ActivityDefinition activity) #
Selects an existing ordinary ActivityDefinition for modification.

Parameters

Name
Type
Description
activity
ActivityDefinition
The ActivityDefinition to select.

Returns

Type
Description
IActivityBuilder
An IActivityBuilder positioned at activity.

Exceptions

Type
Description
ActivityNotFoundException
activity is not part of the process definition.
WrongActivityTypeException
public IInlineActivityBuilder UpdateInlineActivity(ActivityDefinition activity) #
Selects an existing inline ActivityDefinition for modification.

Parameters

Name
Type
Description
activity
ActivityDefinition
The inline ActivityDefinition to select.

Returns

Type
Description
IInlineActivityBuilder
An IInlineActivityBuilder positioned at activity.

Exceptions

Type
Description
ActivityNotFoundException
activity is not part of the process definition.
WrongActivityTypeException
public IProcessDefinitionBuilder DeleteActivity(string name) #
Deletes the activity named name from the process definition.

Parameters

Name
Type
Description
name
String
The activity name.

Returns

Type
Description
IProcessDefinitionBuilder

Remarks

When the activity exists, the method also deletes every TransitionDefinition whose TransitionDefinition.From or TransitionDefinition.To references that activity. If no activity has the requested name, the process definition is unchanged.
public IProcessDefinitionBuilder DeleteActivity(ActivityDefinition activity) #
Deletes an ActivityDefinition and every transition connected to it.

Parameters

Name
Type
Description
activity
ActivityDefinition
The ActivityDefinition to delete.

Returns

Type
Description
IProcessDefinitionBuilder
public ITransitionBuilder CreateTransition(string name, ActivityDefinition from, ActivityDefinition to) #
Creates a TransitionDefinition that connects two activities in the process definition.

Parameters

Name
Type
Description
name
String
The transition name.
from
ActivityDefinition
The source ActivityDefinition.
to
ActivityDefinition
The target ActivityDefinition.

Returns

Type
Description
ITransitionBuilder
An ITransitionBuilder positioned at the created transition.

Exceptions

Type
Description
TransitionAlreadyExistsException
The process definition already contains a transition named name.
ActivityNotFoundException
from or to is not part of the process definition.
public ITransitionBuilder CreateOrUpdateTransition(string name, ActivityDefinition from, ActivityDefinition to) #
Creates a TransitionDefinition or changes TransitionDefinition.From and TransitionDefinition.To on the existing transition named name.

Parameters

Name
Type
Description
name
String
The transition name.
from
ActivityDefinition
The source ActivityDefinition.
to
ActivityDefinition
The target ActivityDefinition.

Returns

Type
Description
ITransitionBuilder
An ITransitionBuilder positioned at the created or existing transition.
public ITransitionBuilder UpdateTransition(string name) #
Selects the existing TransitionDefinition named name for modification.

Parameters

Name
Type
Description
name
String
The transition name.

Returns

Type
Description
ITransitionBuilder
An ITransitionBuilder positioned at the selected transition.

Exceptions

Type
Description
TransitionNotFoundException
The process definition does not contain a transition named name.
public ITransitionBuilder UpdateTransition(TransitionDefinition transition) #
Selects an existing TransitionDefinition for modification.

Parameters

Name
Type
Description
transition
TransitionDefinition
The TransitionDefinition to select.

Returns

Type
Description
ITransitionBuilder
An ITransitionBuilder positioned at transition.

Exceptions

Type
Description
TransitionNotFoundException
transition is not part of the process definition.
public IProcessDefinitionBuilder DeleteTransition(TransitionDefinition transition) #
Deletes a TransitionDefinition from the process definition.

Parameters

Name
Type
Description
transition
TransitionDefinition
The TransitionDefinition to delete.

Returns

Type
Description
IProcessDefinitionBuilder
public IProcessDefinitionBuilder DeleteTransition(string name) #
Deletes the transition named name from the process definition.

Parameters

Name
Type
Description
name
String
The transition name.

Returns

Type
Description
IProcessDefinitionBuilder

Remarks

If no transition has the requested name, the process definition is unchanged.
public ICodeActionBuilder CreateCodeAction(string name) #
Creates a CodeActionDefinition that implements an action and has the CodeActionType.Action runtime contract.

Parameters

Name
Type
Description
name
String
The code action name.

Returns

Type
Description
ICodeActionBuilder
An ICodeActionBuilder positioned at the created code action.

Exceptions

Type
Description
CodeActionAlreadyExistsException
The process definition already contains a CodeActionType.Action code action named name.
public ICodeActionBuilder CreateCodeCondition(string name) #
Creates a CodeActionDefinition that evaluates a transition condition and has the CodeActionType.Condition runtime contract.

Parameters

Name
Type
Description
name
String
The code condition name.

Returns

Type
Description
ICodeActionBuilder
An ICodeActionBuilder positioned at the created code condition.

Exceptions

Type
Description
CodeActionAlreadyExistsException
The process definition already contains a CodeActionType.Condition code action named name.
public ICodeActionBuilder CreateCodeRuleGet(string name) #
Creates a CodeActionDefinition that gets workflow participant identities for a rule and has the CodeActionType.RuleGet runtime contract.

Parameters

Name
Type
Description
name
String
The code rule name.

Returns

Type
Description
ICodeActionBuilder
An ICodeActionBuilder positioned at the created code rule.

Exceptions

Type
Description
CodeActionAlreadyExistsException
The process definition already contains a CodeActionType.RuleGet code action named name.
public ICodeActionBuilder CreateCodeRuleCheck(string name) #
Creates a CodeActionDefinition that determines whether a workflow participant identity satisfies a rule and has the CodeActionType.RuleCheck runtime contract.

Parameters

Name
Type
Description
name
String
The code rule name.

Returns

Type
Description
ICodeActionBuilder
An ICodeActionBuilder positioned at the created code rule.

Exceptions

Type
Description
CodeActionAlreadyExistsException
The process definition already contains a CodeActionType.RuleCheck code action named name.
public IProcessDefinitionBuilder SetCommonUsings(params string[] usings) #
Replaces the namespace imports in ProcessDefinition.CodeActionsCommonUsings that are shared by compiled code actions.

Parameters

Name
Type
Description
usings
String[]
The namespace imports to store. Empty and white-space entries are ignored, and duplicates are removed.

Returns

Type
Description
IProcessDefinitionBuilder

Exceptions

Type
Description
ArgumentException
An entry in usings contains a semicolon.
public IProcessDefinitionBuilder AddCommonUsings(params string[] usings) #
Adds namespace imports to ProcessDefinition.CodeActionsCommonUsings for compiled code actions.

Parameters

Name
Type
Description
usings
String[]
The namespace imports to add. Empty and white-space entries are ignored, and duplicates are removed.

Returns

Type
Description
IProcessDefinitionBuilder

Exceptions

Type
Description
ArgumentException
An entry in usings contains a semicolon.
public IProcessDefinitionBuilder RemoveCommonUsings(params string[] usings) #
Removes namespace imports from ProcessDefinition.CodeActionsCommonUsings for compiled code actions.

Parameters

Name
Type
Description
usings
String[]
The namespace imports to remove.

Returns

Type
Description
IProcessDefinitionBuilder
public IProcessDefinitionBuilder ClearCommonUsings() #
Clears ProcessDefinition.CodeActionsCommonUsings, which contains namespace imports shared by compiled code actions.

Returns

Type
Description
IProcessDefinitionBuilder
public IProcessDefinitionBuilder ForEachActivity(Action<IActivityBuilder> action) #
Invokes action for each activity in the process definition.

Parameters

Name
Type
Description
action
Action<IActivityBuilder>
The callback to invoke with an IActivityBuilder positioned at each activity.

Returns

Type
Description
IProcessDefinitionBuilder
public IProcessDefinitionBuilder ForEachTransition(Action<ITransitionBuilder> action) #
Invokes action for each transition in the process definition.

Parameters

Name
Type
Description
action
Action<ITransitionBuilder>
The callback to invoke with an ITransitionBuilder positioned at each transition.

Returns

Type
Description
IProcessDefinitionBuilder
public IProcessDefinitionBuilder Inlined() #
Sets ProcessDefinition.CanBeInlined so that this process scheme can be inlined into another process scheme.

Returns

Type
Description
IProcessDefinitionBuilder
public IProcessDefinitionBuilder NotInlined() #
Clears ProcessDefinition.CanBeInlined so that this process scheme cannot be inlined into another process scheme.

Returns

Type
Description
IProcessDefinitionBuilder
public IProcessDefinitionBuilder SetTenantId(string? tenantId) #
Sets ProcessDefinition.TenantId for the process scheme.

Parameters

Name
Type
Description
tenantId
String
The tenant identifier, or null for a shared process scheme.

Returns

Type
Description
IProcessDefinitionBuilder
public IProcessDefinitionBuilder GetActivity(string name, out ActivityDefinition activity) #
Finds the ActivityDefinition named name in the process definition.

Parameters

Name
Type
Description
name
String
The activity name.
activity
ActivityDefinition
When the method returns, the matching ActivityDefinition.

Returns

Type
Description
IProcessDefinitionBuilder

Exceptions

Type
Description
ActivityNotFoundException
The process definition does not contain an activity named name.
public IProcessDefinitionBuilder GetTransition(string name, out TransitionDefinition transition) #
Finds the TransitionDefinition named name in the process definition.

Parameters

Name
Type
Description
name
String
The transition name.
transition
TransitionDefinition
When the method returns, the matching TransitionDefinition.

Returns

Type
Description
IProcessDefinitionBuilder

Exceptions

Type
Description
TransitionNotFoundException
The process definition does not contain a transition named name.
public IProcessDefinitionBuilder CreateOrUpdateLocalizationForState(string stateName, CultureInfo culture, string value, bool isDefault = false) #
Creates or updates a business state name translation for a culture.

Parameters

Name
Type
Description
stateName
String
The internal business state name.
culture
CultureInfo
The CultureInfo for the translation.
value
String
The translated business state name.
isDefault
Boolean
true to use the translation as a fallback when the requested culture has no translation; otherwise, false.

Returns

Type
Description
IProcessDefinitionBuilder
public IProcessDefinitionBuilder DeleteLocalizationForState(string stateName, CultureInfo culture) #
Deletes the business state name translation for a culture.

Parameters

Name
Type
Description
stateName
String
The internal business state name.
culture
CultureInfo
The CultureInfo whose translation is deleted.

Returns

Type
Description
IProcessDefinitionBuilder
public IProcessDefinitionBuilder DeleteAllLocalizationsForState(string stateName) #
Deletes all translations for a business state name.

Parameters

Name
Type
Description
stateName
String
The internal business state name.

Returns

Type
Description
IProcessDefinitionBuilder