# Class ProcessDefinitionBuilder OptimaJet.Workflow.Core.Model.Builder.ProcessDefinitionBuilder Provides the fluent API for constructing or modifying the [ProcessDefinitionBuilder.ProcessDefinition](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model.Builder/ProcessDefinitionBuilder/) that represents a workflow scheme. Namespace: [OptimaJet.Workflow.Core.Model.Builder](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model.Builder/) ```csharp public sealed class ProcessDefinitionBuilder : IProcessDefinitionBuilder ``` ## Type Hierarchy - ProcessDefinitionBuilder Current type - Implemented interfaces - [IProcessDefinitionBuilder](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model.Builder/IProcessDefinitionBuilder/) ## Properties `public ProcessDefinition ProcessDefinition { get; }` Gets the [IProcessDefinitionBuilder.ProcessDefinition](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model.Builder/IProcessDefinitionBuilder/) that represents the workflow scheme being built. ## Methods `public static IProcessDefinitionBuilder Create(string name)` Creates an [IProcessDefinitionBuilder](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model.Builder/IProcessDefinitionBuilder/) backed by a new [ProcessDefinitionBuilder.ProcessDefinition](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model.Builder/ProcessDefinitionBuilder/). ### Parameters | Name | Type | Description | | --- | --- | --- | | `name` | `String` | The workflow scheme name. | ### Returns | Type | Description | | --- | --- | | `IProcessDefinitionBuilder` | An [IProcessDefinitionBuilder](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model.Builder/IProcessDefinitionBuilder/) for the new [ProcessDefinitionBuilder.ProcessDefinition](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model.Builder/ProcessDefinitionBuilder/). | `public static IProcessDefinitionBuilder WithProcessDefinition(ProcessDefinition processDefinition)` Creates an [IProcessDefinitionBuilder](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model.Builder/IProcessDefinitionBuilder/) backed by a clone of `processDefinition`. ### Parameters | Name | Type | Description | | --- | --- | --- | | `processDefinition` | `ProcessDefinition` | The [ProcessDefinitionBuilder.ProcessDefinition](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model.Builder/ProcessDefinitionBuilder/) to clone. | ### Returns | Type | Description | | --- | --- | | `IProcessDefinitionBuilder` | An [IProcessDefinitionBuilder](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model.Builder/IProcessDefinitionBuilder/) backed by a clone of `processDefinition`. | `public static IProcessDefinitionBuilder WithMutableProcessDefinition(ProcessDefinition processDefinition)` Creates an [IProcessDefinitionBuilder](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model.Builder/IProcessDefinitionBuilder/) backed directly by `processDefinition`. ### Parameters | Name | Type | Description | | --- | --- | --- | | `processDefinition` | `ProcessDefinition` | The [ProcessDefinitionBuilder.ProcessDefinition](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model.Builder/ProcessDefinitionBuilder/) to modify. | ### Returns | Type | Description | | --- | --- | | `IProcessDefinitionBuilder` | An [IProcessDefinitionBuilder](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model.Builder/IProcessDefinitionBuilder/) backed by `processDefinition`. | `public IActorBuilder CreateActor(string name, string rule)` Creates an [ActorDefinition](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/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](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model.Builder/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](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ActorDefinition/) or updates the [ActorDefinition.Rule](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ActorDefinition/) 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](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model.Builder/IActorBuilder/) positioned at the created or existing actor. | `public IActorBuilder UpdateActor(string name)` Selects the existing [ActorDefinition](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ActorDefinition/) named `name` for modification. ### Parameters | Name | Type | Description | | --- | --- | --- | | `name` | `String` | The actor name. | ### Returns | Type | Description | | --- | --- | | `IActorBuilder` | An [IActorBuilder](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model.Builder/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` | This [IProcessDefinitionBuilder](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model.Builder/IProcessDefinitionBuilder/). | ### Remarks When the actor exists, the method also removes every [TransitionDefinition.Restrictions](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/TransitionDefinition/) 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](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ParameterDefinition/). ### Parameters | Name | Type | Description | | --- | --- | --- | | `name` | `String` | The parameter name. | | `type` | `Type` | The .NET [Type](https://learn.microsoft.com/dotnet/api/system.type) of the parameter value. | | `purpose` | `ParameterPurpose` | The [ParameterPurpose](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ParameterPurpose/) that controls how the parameter is managed. | ### Returns | Type | Description | | --- | --- | | `IParameterBuilder` | An [IParameterBuilder](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model.Builder/IParameterBuilder/) positioned at the created parameter. | ### Exceptions | Type | Description | | --- | --- | | `ParameterAlreadyExistsException` | The process definition already contains a parameter named `name`. | | `InvalidOperationException` | `purpose` is [ParameterPurpose.System](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ParameterPurpose/). | `public IParameterBuilder CreateOrUpdateParameter(string name, Type type, ParameterPurpose purpose)` Creates a user-defined [ParameterDefinition](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/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](https://learn.microsoft.com/dotnet/api/system.type) of the parameter value. | | `purpose` | `ParameterPurpose` | The [ParameterPurpose](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ParameterPurpose/) that controls how the parameter is managed. | ### Returns | Type | Description | | --- | --- | | `IParameterBuilder` | An [IParameterBuilder](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model.Builder/IParameterBuilder/) positioned at the created or existing parameter. | ### Exceptions | Type | Description | | --- | --- | | `InvalidOperationException` | `purpose` is [ParameterPurpose.System](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ParameterPurpose/); or `purpose` is [ParameterPurpose.Persistence](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ParameterPurpose/) and an existing parameter with an initial value would change its `type`. | ### Remarks Setting `purpose` to [ParameterPurpose.Temporary](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ParameterPurpose/) clears [ParameterDefinition.InitialValue](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ParameterDefinition/). `public IParameterBuilder UpdateParameter(string name)` Selects the existing [ParameterDefinition](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ParameterDefinition/) named `name` for modification. ### Parameters | Name | Type | Description | | --- | --- | --- | | `name` | `String` | The parameter name. | ### Returns | Type | Description | | --- | --- | | `IParameterBuilder` | An [IParameterBuilder](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model.Builder/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` | This [IProcessDefinitionBuilder](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model.Builder/IProcessDefinitionBuilder/). | ### Remarks When the parameter exists, the method also removes references to it from [CommandDefinition.InputParameters](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/CommandDefinition/). If no parameter has the requested name, the process definition is unchanged. `public ICommandBuilder CreateCommand(string name)` Creates a [CommandDefinition](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/CommandDefinition/) for a named command trigger. ### Parameters | Name | Type | Description | | --- | --- | --- | | `name` | `String` | The command name. | ### Returns | Type | Description | | --- | --- | | `ICommandBuilder` | An [ICommandBuilder](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model.Builder/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](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/CommandDefinition/) or selects the existing command named `name`. ### Parameters | Name | Type | Description | | --- | --- | --- | | `name` | `String` | The command name. | ### Returns | Type | Description | | --- | --- | | `ICommandBuilder` | An [ICommandBuilder](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model.Builder/ICommandBuilder/) positioned at the created or existing command. | `public ICommandBuilder UpdateCommand(string name)` Selects the existing [CommandDefinition](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/CommandDefinition/) named `name` for modification. ### Parameters | Name | Type | Description | | --- | --- | --- | | `name` | `String` | The command name. | ### Returns | Type | Description | | --- | --- | | `ICommandBuilder` | An [ICommandBuilder](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model.Builder/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` | This [IProcessDefinitionBuilder](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model.Builder/IProcessDefinitionBuilder/). | ### Remarks When the command exists, transitions whose [TransitionDefinition.Trigger](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/TransitionDefinition/) references it are changed to use [TriggerDefinition.Auto](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/TriggerDefinition/), and their [TransitionDefinition.Restrictions](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/TransitionDefinition/) are cleared. If no command has the requested name, the process definition is unchanged. `public ITimerBuilder CreateTimer(string name)` Creates a [TimerDefinition](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/TimerDefinition/) whose [TimerDefinition.Type](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/TimerDefinition/) is [TimerType.Interval](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/TimerType/) and whose [TimerDefinition.Value](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/TimerDefinition/) is `0`. ### Parameters | Name | Type | Description | | --- | --- | --- | | `name` | `String` | The timer name. | ### Returns | Type | Description | | --- | --- | | `ITimerBuilder` | An [ITimerBuilder](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model.Builder/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](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/TimerDefinition/) whose [TimerDefinition.Type](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/TimerDefinition/) is [TimerType.Interval](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/TimerType/) and whose [TimerDefinition.Value](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/TimerDefinition/) is `0`, or selects the existing timer named `name`. ### Parameters | Name | Type | Description | | --- | --- | --- | | `name` | `String` | The timer name. | ### Returns | Type | Description | | --- | --- | | `ITimerBuilder` | An [ITimerBuilder](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model.Builder/ITimerBuilder/) positioned at the created or existing timer. | `public ITimerBuilder UpdateTimer(string name)` Selects the existing [TimerDefinition](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/TimerDefinition/) named `name` for modification. ### Parameters | Name | Type | Description | | --- | --- | --- | | `name` | `String` | The timer name. | ### Returns | Type | Description | | --- | --- | | `ITimerBuilder` | An [ITimerBuilder](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model.Builder/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` | This [IProcessDefinitionBuilder](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model.Builder/IProcessDefinitionBuilder/). | ### Remarks When the timer exists, transitions whose [TransitionDefinition.Trigger](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/TransitionDefinition/) references it are changed to use [TriggerDefinition.Auto](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/TriggerDefinition/). If no timer has the requested name, the process definition is unchanged. `public IActivityBuilder CreateActivity(string name)` Creates an [ActivityDefinition](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ActivityDefinition/) whose [ActivityDefinition.ActivityType](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ActivityDefinition/) is [ActivityType.Ordinary](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ActivityType/). ### Parameters | Name | Type | Description | | --- | --- | --- | | `name` | `String` | The activity name. | ### Returns | Type | Description | | --- | --- | | `IActivityBuilder` | An [IActivityBuilder](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model.Builder/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](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ActivityDefinition/) to the process definition if needed and selects it for modification. ### Parameters | Name | Type | Description | | --- | --- | --- | | `activity` | `ActivityDefinition` | The [ActivityDefinition](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ActivityDefinition/) to add or select. | ### Returns | Type | Description | | --- | --- | | `IActivityBuilder` | An [IActivityBuilder](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model.Builder/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](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/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](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ActivityDefinition/). | ### Returns | Type | Description | | --- | --- | | `IInlineActivityBuilder` | An [IInlineActivityBuilder](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model.Builder/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](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ActivityDefinition/) or selects the existing ordinary activity named `name`. ### Parameters | Name | Type | Description | | --- | --- | --- | | `name` | `String` | The activity name. | ### Returns | Type | Description | | --- | --- | | `IActivityBuilder` | An [IActivityBuilder](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model.Builder/IActivityBuilder/) positioned at the created or existing activity. | ### Exceptions | Type | Description | | --- | --- | | `WrongActivityTypeException` | The process definition contains an activity named `name` whose [ActivityDefinition.ActivityType](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ActivityDefinition/) is not [ActivityType.Ordinary](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ActivityType/). | `public IInlineActivityBuilder CreateOrUpdateInlineActivity(string name, string schemeCode)` Creates an inline [ActivityDefinition](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/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](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ActivityDefinition/). | ### Returns | Type | Description | | --- | --- | | `IInlineActivityBuilder` | An [IInlineActivityBuilder](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model.Builder/IInlineActivityBuilder/) positioned at the created or existing inline activity. | ### Exceptions | Type | Description | | --- | --- | | `WrongActivityTypeException` | The process definition contains an activity named `name` whose [ActivityDefinition.ActivityType](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ActivityDefinition/) is not [ActivityType.Inline](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ActivityType/). | `public IActivityBuilder UpdateActivity(string name)` Selects the existing ordinary [ActivityDefinition](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ActivityDefinition/) named `name` for modification. ### Parameters | Name | Type | Description | | --- | --- | --- | | `name` | `String` | The activity name. | ### Returns | Type | Description | | --- | --- | | `IActivityBuilder` | An [IActivityBuilder](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model.Builder/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](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ActivityDefinition/) other than [ActivityType.Ordinary](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ActivityType/). | `public IInlineActivityBuilder UpdateInlineActivity(string name)` Selects the existing inline [ActivityDefinition](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ActivityDefinition/) named `name` for modification. ### Parameters | Name | Type | Description | | --- | --- | --- | | `name` | `String` | The inline activity name. | ### Returns | Type | Description | | --- | --- | | `IInlineActivityBuilder` | An [IInlineActivityBuilder](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model.Builder/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](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ActivityDefinition/) other than [ActivityType.Inline](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ActivityType/). | `public IActivityBuilder UpdateActivity(ActivityDefinition activity)` Selects an existing ordinary [ActivityDefinition](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ActivityDefinition/) for modification. ### Parameters | Name | Type | Description | | --- | --- | --- | | `activity` | `ActivityDefinition` | The [ActivityDefinition](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ActivityDefinition/) to select. | ### Returns | Type | Description | | --- | --- | | `IActivityBuilder` | An [IActivityBuilder](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model.Builder/IActivityBuilder/) positioned at `activity`. | ### Exceptions | Type | Description | | --- | --- | | `ActivityNotFoundException` | `activity` is not part of the process definition. | | `WrongActivityTypeException` | `activity` has an [ActivityDefinition.ActivityType](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ActivityDefinition/) other than [ActivityType.Ordinary](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ActivityType/). | `public IInlineActivityBuilder UpdateInlineActivity(ActivityDefinition activity)` Selects an existing inline [ActivityDefinition](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ActivityDefinition/) for modification. ### Parameters | Name | Type | Description | | --- | --- | --- | | `activity` | `ActivityDefinition` | The inline [ActivityDefinition](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ActivityDefinition/) to select. | ### Returns | Type | Description | | --- | --- | | `IInlineActivityBuilder` | An [IInlineActivityBuilder](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model.Builder/IInlineActivityBuilder/) positioned at `activity`. | ### Exceptions | Type | Description | | --- | --- | | `ActivityNotFoundException` | `activity` is not part of the process definition. | | `WrongActivityTypeException` | `activity` has an [ActivityDefinition.ActivityType](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ActivityDefinition/) other than [ActivityType.Inline](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ActivityType/). | `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` | This [IProcessDefinitionBuilder](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model.Builder/IProcessDefinitionBuilder/). | ### Remarks When the activity exists, the method also deletes every [TransitionDefinition](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/TransitionDefinition/) whose [TransitionDefinition.From](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/TransitionDefinition/) or [TransitionDefinition.To](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/TransitionDefinition/) references that activity. If no activity has the requested name, the process definition is unchanged. `public IProcessDefinitionBuilder DeleteActivity(ActivityDefinition activity)` Deletes an [ActivityDefinition](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ActivityDefinition/) and every transition connected to it. ### Parameters | Name | Type | Description | | --- | --- | --- | | `activity` | `ActivityDefinition` | The [ActivityDefinition](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ActivityDefinition/) to delete. | ### Returns | Type | Description | | --- | --- | | `IProcessDefinitionBuilder` | This [IProcessDefinitionBuilder](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model.Builder/IProcessDefinitionBuilder/). | `public ITransitionBuilder CreateTransition(string name, ActivityDefinition from, ActivityDefinition to)` Creates a [TransitionDefinition](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/TransitionDefinition/) that connects two activities in the process definition. ### Parameters | Name | Type | Description | | --- | --- | --- | | `name` | `String` | The transition name. | | `from` | `ActivityDefinition` | The source [ActivityDefinition](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ActivityDefinition/). | | `to` | `ActivityDefinition` | The target [ActivityDefinition](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ActivityDefinition/). | ### Returns | Type | Description | | --- | --- | | `ITransitionBuilder` | An [ITransitionBuilder](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model.Builder/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](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/TransitionDefinition/) or changes [TransitionDefinition.From](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/TransitionDefinition/) and [TransitionDefinition.To](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/TransitionDefinition/) on the existing transition named `name`. ### Parameters | Name | Type | Description | | --- | --- | --- | | `name` | `String` | The transition name. | | `from` | `ActivityDefinition` | The source [ActivityDefinition](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ActivityDefinition/). | | `to` | `ActivityDefinition` | The target [ActivityDefinition](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ActivityDefinition/). | ### Returns | Type | Description | | --- | --- | | `ITransitionBuilder` | An [ITransitionBuilder](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model.Builder/ITransitionBuilder/) positioned at the created or existing transition. | `public ITransitionBuilder UpdateTransition(string name)` Selects the existing [TransitionDefinition](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/TransitionDefinition/) named `name` for modification. ### Parameters | Name | Type | Description | | --- | --- | --- | | `name` | `String` | The transition name. | ### Returns | Type | Description | | --- | --- | | `ITransitionBuilder` | An [ITransitionBuilder](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model.Builder/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](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/TransitionDefinition/) for modification. ### Parameters | Name | Type | Description | | --- | --- | --- | | `transition` | `TransitionDefinition` | The [TransitionDefinition](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/TransitionDefinition/) to select. | ### Returns | Type | Description | | --- | --- | | `ITransitionBuilder` | An [ITransitionBuilder](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model.Builder/ITransitionBuilder/) positioned at `transition`. | ### Exceptions | Type | Description | | --- | --- | | `TransitionNotFoundException` | `transition` is not part of the process definition. | `public IProcessDefinitionBuilder DeleteTransition(TransitionDefinition transition)` Deletes a [TransitionDefinition](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/TransitionDefinition/) from the process definition. ### Parameters | Name | Type | Description | | --- | --- | --- | | `transition` | `TransitionDefinition` | The [TransitionDefinition](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/TransitionDefinition/) to delete. | ### Returns | Type | Description | | --- | --- | | `IProcessDefinitionBuilder` | This [IProcessDefinitionBuilder](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model.Builder/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` | This [IProcessDefinitionBuilder](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model.Builder/IProcessDefinitionBuilder/). | ### Remarks If no transition has the requested name, the process definition is unchanged. `public ICodeActionBuilder CreateCodeAction(string name)` Creates a [CodeActionDefinition](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/CodeActionDefinition/) that implements an action and has the [CodeActionType.Action](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/CodeActionType/) runtime contract. ### Parameters | Name | Type | Description | | --- | --- | --- | | `name` | `String` | The code action name. | ### Returns | Type | Description | | --- | --- | | `ICodeActionBuilder` | An [ICodeActionBuilder](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model.Builder/ICodeActionBuilder/) positioned at the created code action. | ### Exceptions | Type | Description | | --- | --- | | `CodeActionAlreadyExistsException` | The process definition already contains a [CodeActionType.Action](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/CodeActionType/) code action named `name`. | `public ICodeActionBuilder CreateCodeCondition(string name)` Creates a [CodeActionDefinition](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/CodeActionDefinition/) that evaluates a transition condition and has the [CodeActionType.Condition](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/CodeActionType/) runtime contract. ### Parameters | Name | Type | Description | | --- | --- | --- | | `name` | `String` | The code condition name. | ### Returns | Type | Description | | --- | --- | | `ICodeActionBuilder` | An [ICodeActionBuilder](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model.Builder/ICodeActionBuilder/) positioned at the created code condition. | ### Exceptions | Type | Description | | --- | --- | | `CodeActionAlreadyExistsException` | The process definition already contains a [CodeActionType.Condition](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/CodeActionType/) code action named `name`. | `public ICodeActionBuilder CreateCodeRuleGet(string name)` Creates a [CodeActionDefinition](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/CodeActionDefinition/) that gets workflow participant identities for a rule and has the [CodeActionType.RuleGet](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/CodeActionType/) runtime contract. ### Parameters | Name | Type | Description | | --- | --- | --- | | `name` | `String` | The code rule name. | ### Returns | Type | Description | | --- | --- | | `ICodeActionBuilder` | An [ICodeActionBuilder](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model.Builder/ICodeActionBuilder/) positioned at the created code rule. | ### Exceptions | Type | Description | | --- | --- | | `CodeActionAlreadyExistsException` | The process definition already contains a [CodeActionType.RuleGet](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/CodeActionType/) code action named `name`. | `public ICodeActionBuilder CreateCodeRuleCheck(string name)` Creates a [CodeActionDefinition](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/CodeActionDefinition/) that determines whether a workflow participant identity satisfies a rule and has the [CodeActionType.RuleCheck](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/CodeActionType/) runtime contract. ### Parameters | Name | Type | Description | | --- | --- | --- | | `name` | `String` | The code rule name. | ### Returns | Type | Description | | --- | --- | | `ICodeActionBuilder` | An [ICodeActionBuilder](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model.Builder/ICodeActionBuilder/) positioned at the created code rule. | ### Exceptions | Type | Description | | --- | --- | | `CodeActionAlreadyExistsException` | The process definition already contains a [CodeActionType.RuleCheck](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/CodeActionType/) code action named `name`. | `public IProcessDefinitionBuilder SetCommonUsings(params string[] usings)` Replaces the namespace imports in [ProcessDefinition.CodeActionsCommonUsings](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ProcessDefinition/) 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` | This [IProcessDefinitionBuilder](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model.Builder/IProcessDefinitionBuilder/). | ### Exceptions | Type | Description | | --- | --- | | `ArgumentException` | An entry in `usings` contains a semicolon. | `public IProcessDefinitionBuilder AddCommonUsings(params string[] usings)` Adds namespace imports to [ProcessDefinition.CodeActionsCommonUsings](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ProcessDefinition/) 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` | This [IProcessDefinitionBuilder](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model.Builder/IProcessDefinitionBuilder/). | ### Exceptions | Type | Description | | --- | --- | | `ArgumentException` | An entry in `usings` contains a semicolon. | `public IProcessDefinitionBuilder RemoveCommonUsings(params string[] usings)` Removes namespace imports from [ProcessDefinition.CodeActionsCommonUsings](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ProcessDefinition/) for compiled code actions. ### Parameters | Name | Type | Description | | --- | --- | --- | | `usings` | `String[]` | The namespace imports to remove. | ### Returns | Type | Description | | --- | --- | | `IProcessDefinitionBuilder` | This [IProcessDefinitionBuilder](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model.Builder/IProcessDefinitionBuilder/). | `public IProcessDefinitionBuilder ClearCommonUsings()` Clears [ProcessDefinition.CodeActionsCommonUsings](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ProcessDefinition/), which contains namespace imports shared by compiled code actions. ### Returns | Type | Description | | --- | --- | | `IProcessDefinitionBuilder` | This [IProcessDefinitionBuilder](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model.Builder/IProcessDefinitionBuilder/). | `public IProcessDefinitionBuilder ForEachActivity(Action action)` Invokes `action` for each activity in the process definition. ### Parameters | Name | Type | Description | | --- | --- | --- | | `action` | `Action` | The callback to invoke with an [IActivityBuilder](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model.Builder/IActivityBuilder/) positioned at each activity. | ### Returns | Type | Description | | --- | --- | | `IProcessDefinitionBuilder` | This [IProcessDefinitionBuilder](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model.Builder/IProcessDefinitionBuilder/). | `public IProcessDefinitionBuilder ForEachTransition(Action action)` Invokes `action` for each transition in the process definition. ### Parameters | Name | Type | Description | | --- | --- | --- | | `action` | `Action` | The callback to invoke with an [ITransitionBuilder](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model.Builder/ITransitionBuilder/) positioned at each transition. | ### Returns | Type | Description | | --- | --- | | `IProcessDefinitionBuilder` | This [IProcessDefinitionBuilder](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model.Builder/IProcessDefinitionBuilder/). | `public IProcessDefinitionBuilder Inlined()` Sets [ProcessDefinition.CanBeInlined](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ProcessDefinition/) so that this process scheme can be inlined into another process scheme. ### Returns | Type | Description | | --- | --- | | `IProcessDefinitionBuilder` | This [IProcessDefinitionBuilder](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model.Builder/IProcessDefinitionBuilder/). | `public IProcessDefinitionBuilder NotInlined()` Clears [ProcessDefinition.CanBeInlined](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ProcessDefinition/) so that this process scheme cannot be inlined into another process scheme. ### Returns | Type | Description | | --- | --- | | `IProcessDefinitionBuilder` | This [IProcessDefinitionBuilder](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model.Builder/IProcessDefinitionBuilder/). | `public IProcessDefinitionBuilder SetTenantId(string? tenantId)` Sets [ProcessDefinition.TenantId](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ProcessDefinition/) for the process scheme. ### Parameters | Name | Type | Description | | --- | --- | --- | | `tenantId` | `String` | The tenant identifier, or [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) for a shared process scheme. | ### Returns | Type | Description | | --- | --- | | `IProcessDefinitionBuilder` | This [IProcessDefinitionBuilder](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model.Builder/IProcessDefinitionBuilder/). | `public IProcessDefinitionBuilder GetActivity(string name, out ActivityDefinition activity)` Finds the [ActivityDefinition](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/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](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ActivityDefinition/). | ### Returns | Type | Description | | --- | --- | | `IProcessDefinitionBuilder` | This [IProcessDefinitionBuilder](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model.Builder/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](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/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](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/TransitionDefinition/). | ### Returns | Type | Description | | --- | --- | | `IProcessDefinitionBuilder` | This [IProcessDefinitionBuilder](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model.Builder/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](https://learn.microsoft.com/dotnet/api/system.globalization.cultureinfo) for the translation. | | `value` | `String` | The translated business state name. | | `isDefault` | `Boolean` | [true](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool) to use the translation as a fallback when the requested culture has no translation; otherwise, [false](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool). | ### Returns | Type | Description | | --- | --- | | `IProcessDefinitionBuilder` | This [IProcessDefinitionBuilder](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model.Builder/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](https://learn.microsoft.com/dotnet/api/system.globalization.cultureinfo) whose translation is deleted. | ### Returns | Type | Description | | --- | --- | | `IProcessDefinitionBuilder` | This [IProcessDefinitionBuilder](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model.Builder/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` | This [IProcessDefinitionBuilder](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model.Builder/IProcessDefinitionBuilder/). | [Previous ITransitionParallelStartBuilder](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model.Builder/ITransitionParallelStartBuilder/) [Next IWorkflowParser](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Parser/IWorkflowParser-TSchemeMedium/)