Assembly: OptimaJet.Workflow.Core

Interface IWorkflowBuilder

OptimaJet.Workflow.Core.Builder.IWorkflowBuilder

Converts raw process scheme media into ProcessDefinition instances and coordinates scheme loading, parsing, generation, and build-step execution.

public interface IWorkflowBuilder

Type Hierarchy

Properties

WorkflowRuntime Runtime { get; set; } #
Gets or sets the runtime used by this builder.

Methods

Task<ProcessInstance> CreateNewProcessAsync(Guid processId, string schemeCode, string? tenantId) #
Creates a new process instance object for the specified scheme code. If the scheme does not exist, the builder generates and stores it before creating the instance.

Parameters

Name
Type
Description
processId
Guid
Identifier for the new process instance.
schemeCode
String
Code of the scheme to instantiate.
tenantId
String
Optional tenant identifier that selects the exact tenant scheme. If not specified, a shared scheme is used.

Returns

Type
Description
Task<ProcessInstance>
Task<ProcessInstance> CreateNewSubprocessAsync(Guid processId, ProcessInstance parentProcessInstance, TransitionDefinition startingTransition) #
Creates a subprocess process instance for the transition from a parent process.

Parameters

Name
Type
Description
processId
Guid
Identifier for the new subprocess instance.
parentProcessInstance
ProcessInstance
The parent ProcessInstance that starts the subprocess.
startingTransition
TransitionDefinition
The TransitionDefinition that starts the subprocess.

Returns

Type
Description
Task<ProcessInstance>
A new subprocess ProcessInstance.
Task<ProcessDefinition> CreateNewProcessSchemeAsync(string schemeCode, string? tenantId = null) #
Generates a new process scheme, runs the registered build steps, and stores the resulting scheme.

Parameters

Name
Type
Description
schemeCode
String
Code of the scheme to create.
tenantId
String
Optional tenant identifier. If not specified, a shared scheme is used.

Returns

Type
Description
Task<ProcessDefinition>
The generated ProcessDefinition.
Task<ProcessDefinition> CreateNewSubprocessSchemeAsync(ProcessDefinition parentProcessScheme, TransitionDefinition startingTransition) #
Creates and stores a parsed subprocess scheme for the given parent scheme and transition.

Parameters

Name
Type
Description
parentProcessScheme
ProcessDefinition
The parent ProcessDefinition from which the subprocess is derived.
startingTransition
TransitionDefinition
The TransitionDefinition that starts the subprocess.

Returns

Type
Description
Task<ProcessDefinition>
The parsed subprocess ProcessDefinition.
Task<ProcessInstance> GetProcessInstanceAsync(Guid processId) #
Gets an existing process instance by process identifier.

Parameters

Name
Type
Description
processId
Guid
Identifier of the process instance to load.

Returns

Type
Description
Task<ProcessInstance>
The loaded ProcessInstance.
Task<ProcessDefinition> GetProcessSchemeAsync(Guid schemeId) #
Gets a parsed process scheme by scheme identifier.

Parameters

Name
Type
Description
schemeId
Guid
Identifier of the scheme to load.

Returns

Type
Description
Task<ProcessDefinition>
The loaded ProcessDefinition.
void SetCache(IParsedProcessCache cache) #
Configures a cache for parsed ProcessDefinition instances.

Parameters

Name
Type
Description
cache
IParsedProcessCache
The IParsedProcessCache used for parsed process definitions.
void RemoveCache() #
Clears and disables the parsed process definition cache.
Task<ProcessDefinition> GetProcessSchemeAsync(string schemeCode, string? tenantId = null) #
Gets a process scheme by code and tenant, creating it if it does not exist.

Parameters

Name
Type
Description
schemeCode
String
Code of the scheme.
tenantId
String
Optional tenant identifier. If not specified, a shared scheme is used.

Returns

Type
Description
Task<ProcessDefinition>
The requested ProcessDefinition. If missing, a new scheme is generated, stored, and returned.
Task SetSchemeIsObsoleteAsync(string schemeCode, string? tenantId = null) #
Marks schemes with the specified code as obsolete.

Parameters

Name
Type
Description
schemeCode
String
Code of the scheme.
tenantId
String
Tenant id of the scheme. If null, marks schemes with the specified code obsolete in all tenants.

Returns

Type
Description
Task
Task<ProcessDefinition> GetProcessSchemeForDesignerAsync(string code, string? tenantId = null) #
Gets a parsed process scheme from the persistence store by code for designer operations.

Parameters

Name
Type
Description
code
String
Code of the scheme.
tenantId
String
Optional tenant identifier.

Returns

Type
Description
Task<ProcessDefinition>
The loaded ProcessDefinition.
Task<(bool success, List<string>? errors, string? failedStep)> SaveProcessSchemeAsync(string schemeCode, ProcessDefinition pd) #
Runs the registered build steps on a clone of the process definition to validate it and determine its inline scheme dependencies, then saves the supplied definition when validation succeeds.

Parameters

Name
Type
Description
schemeCode
String
Code of the scheme.
pd
ProcessDefinition
The parsed ProcessDefinition to save.

Returns

Type
Description
Task<Boolean, String, String>
A tuple containing: success is true when validation succeeds; errors contains validation messages when validation fails; failedStep contains the name of the build step that failed, if any.
ProcessDefinition Parse(string scheme, SchemeParsingType schemeParsingType = SchemeParsingType.Strict) #
Parses a raw scheme string into a ProcessDefinition.

Parameters

Name
Type
Description
scheme
String
Raw scheme content to parse.
schemeParsingType
SchemeParsingType
Parse mode. Use SchemeParsingType.Soft only for relaxed validation.

Returns

Type
Description
ProcessDefinition
The parsed ProcessDefinition.
string Serialize(ProcessDefinition processDefinition) #
Serializes a process definition into raw scheme text.

Parameters

Name
Type
Description
processDefinition
ProcessDefinition
The ProcessDefinition to serialize.

Returns

Type
Description
String
String representation of the unparsed scheme.
void AddBuildStep(int order, BuildStepPosition buildStepPosition, BuildStep step) #
Adds a build step at the specified position and order.

Parameters

Name
Type
Description
order
Int32
Order value used to sort build-step execution.
buildStepPosition
BuildStepPosition
The BuildStepPosition relative to system steps.
step
BuildStep
The BuildStep to add.
void AddSystemBuildStepAtTheEnd(BuildStep step, int startOrder = 0, int endOrder = 1000) #
Adds a system build step after the highest existing system step in the specified search range.

Parameters

Name
Type
Description
step
BuildStep
The BuildStep to add.
startOrder
Int32
The order used when the search range contains no existing system steps.
endOrder
Int32
The exclusive upper bound of the range searched for existing system steps.
void AddBuildStepAtTheEnd(BuildStep step) #
Adds a build step after all existing build steps.

Parameters

Name
Type
Description
step
BuildStep
The BuildStep to add.
Task<ProcessDefinition> GenerateProcessDefinitionAsync(string schemeCode, string? tenantId = null) #
Generates and parses a process definition without reading or writing persistence, using the cache, or executing build steps.

Parameters

Name
Type
Description
schemeCode
String
Code of the scheme to generate.
tenantId
String
Optional tenant identifier.

Returns

Type
Description
Task<ProcessDefinition>
The generated ProcessDefinition.
bool ContainsBuildStep(string name) #
Determines whether a build step with the specified name is already registered.

Parameters

Name
Type
Description
name
String
Name of the build step to check.

Returns

Type
Description
Boolean
true when a build step with this name exists.
Task<List<string>> GetInlinedSchemeCodesAsync(string? tenantId = null) #
Gets codes of schemes that may be inlined by other schemes.

Parameters

Name
Type
Description
tenantId
String
Optional tenant identifier. If specified, both shared and tenant-specific schemes are returned. If omitted, only shared schemes are returned.

Returns

Type
Description
Task<String>
The list of scheme codes.
Task<Dictionary<string, ParameterDefinition[]>> GetInlinedSchemeParametersAsync(string? tenantId = null) #
Gets inlined scheme parameters by scheme code.

Parameters

Name
Type
Description
tenantId
String
Optional tenant identifier. If specified, both shared and tenant-specific schemes are resolved. If omitted, only shared schemes are included.

Returns

Type
Description
Task<String, ParameterDefinition[]>
A dictionary keyed by scheme code containing non-system parameters for each inlined scheme.
Task<List<string>> GetRelatedByInliningSchemeCodesAsync(string schemeCode, string? tenantId = null) #
Gets scheme codes that currently inline the specified scheme.

Parameters

Name
Type
Description
schemeCode
String
Code of the inlined scheme.
tenantId
String
Tenant id of the parent scheme. If null, searches in all tenants and shared schemes.

Returns

Type
Description
Task<String>
Scheme codes that inline the specified scheme.
Task RemoveSchemeTagsAsync(string schemeCode, IEnumerable<string> tags) #
Removes tags from the shared scheme with the specified code.

Parameters

Name
Type
Description
schemeCode
String
Code of the shared scheme.
tags
IEnumerable<String>
Tags to remove.

Returns

Type
Description
Task
Task RemoveSchemeTagsAsync(string schemeCode, string? tenantId, IEnumerable<string> tags) #
Removes tags from a scheme in the exact tenant scope. If tenantId is null, updates only the shared scheme.

Parameters

Name
Type
Description
schemeCode
String
Code of the scheme.
tenantId
String
Tenant identifier or null for shared scope.
tags
IEnumerable<String>
Tags to remove.

Returns

Type
Description
Task
Task SetSchemeTagsAsync(string schemeCode, IEnumerable<string> tags) #
Replaces tags for the shared scheme with the specified code.

Parameters

Name
Type
Description
schemeCode
String
Code of the shared scheme.
tags
IEnumerable<String>
Tags to set.

Returns

Type
Description
Task
Task SetSchemeTagsAsync(string schemeCode, string? tenantId, IEnumerable<string> tags) #
Replaces tags for a scheme in the exact tenant scope. If tenantId is null, updates only the shared scheme.

Parameters

Name
Type
Description
schemeCode
String
Code of the scheme.
tenantId
String
Tenant identifier or null for shared scope.
tags
IEnumerable<String>
Tags to set.

Returns

Type
Description
Task
Task<List<string>> SearchSchemesByTagsAsync(IEnumerable<string>? tags) #
Gets shared scheme codes matching a tag list.

Parameters

Name
Type
Description
tags
IEnumerable<String>
Optional tags to filter schemes. If null, returns all shared scheme codes.

Returns

Type
Description
Task<String>
Codes of matching shared schemes.
Task<List<string>> SearchSchemesByTagsAsync(string? tenantId, IEnumerable<string>? tags) #
Gets scheme codes in a tenant scope matching a tag list.

Parameters

Name
Type
Description
tenantId
String
Tenant identifier. If null, only shared schemes are searched.
tags
IEnumerable<String>
Optional tags to filter schemes. If null, all codes in scope are returned.

Returns

Type
Description
Task<String>
Codes of matching schemes in the specified scope.
Task AddSchemeTagsAsync(string schemeCode, IEnumerable<string> tags) #
Adds tags to the shared scheme with the specified code.

Parameters

Name
Type
Description
schemeCode
String
Code of the shared scheme.
tags
IEnumerable<String>
Tags to add.

Returns

Type
Description
Task
Task AddSchemeTagsAsync(string schemeCode, string? tenantId, IEnumerable<string> tags) #
Adds tags to a scheme in the exact tenant scope. If tenantId is null, updates only the shared scheme.

Parameters

Name
Type
Description
schemeCode
String
Code of the scheme.
tenantId
String
Tenant identifier or null for shared scope.
tags
IEnumerable<String>
Tags to add.

Returns

Type
Description
Task
Task<(List<string>? codes, List<string>? errors, string? failedStep)> GetInlineSchemesAsync(ProcessDefinition pd) #
Runs the registered build steps on a clone of the process definition and gets the codes represented by the resulting inlined activities.

Parameters

Name
Type
Description
pd
ProcessDefinition
The ProcessDefinition to inspect.

Returns

Type
Description
Task<String, String, String>
A tuple containing: codes list of inlined scheme codes, errors validation errors when build steps fail, and failedStep the failing build step name.
[Obsolete("Do not use this API. It was used only by the deprecated Assignment plugin and will be removed soon.")] Task UpsertProcessInstanceScheme(ProcessDefinition processDefinition) Obsolete #
Executes build steps and upserts the parsed scheme into the persistence store.

Parameters

Name
Type
Description
processDefinition
ProcessDefinition
The ProcessDefinition to save.

Returns

Type
Description
Task
[Obsolete("Do not use this API. It was used only by the deprecated Assignment plugin and will be removed soon.")] void RemoveSchemeFromCache(Guid schemeId) Obsolete #
Removes a parsed process definition from the cache by scheme identifier.

Parameters

Name
Type
Description
schemeId
Guid
Identifier of the scheme cache entry to remove.