Workflow Engine .NET

Assembly: OptimaJet.Workflow.Core

Class WorkflowBuilder<TSchemeMedium>

OptimaJet.Workflow.Core.Builder.WorkflowBuilder<TSchemeMedium>

Base workflow builder, which convert not parsed process scheme SchemeDefinition<T> to the object model of a scheme of a process ProcessDefinition

public sealed class WorkflowBuilder<TSchemeMedium> : IWorkflowBuilder where TSchemeMedium : class

Inheritance

  • System.Object

Implemented Interfaces

Constructors

public WorkflowBuilder(IWorkflowGenerator<TSchemeMedium> generator, IWorkflowParser<TSchemeMedium> parser, ISchemePersistenceProvider<TSchemeMedium> schemePersistenceProvider) #
Create WorkflowBuilder object

Parameters

Name
Type
Description
generator
IWorkflowGenerator<TSchemeMedium>
Not parsed scheme generator IWorkflowGenerator<TSchemeMedium>
parser
IWorkflowParser<TSchemeMedium>
Parser from not parsed process scheme SchemeDefinition<T> to the object model of a scheme of a process ProcessDefinition
schemePersistenceProvider
ISchemePersistenceProvider<TSchemeMedium>
Scheme persistence provider ISchemePersistenceProvider<TSchemeMedium>

Properties

Name
Type
Runtime #
WorkflowRuntime
Workflow runtime instance WorkflowRuntime

Methods

public Task<ProcessDefinition> GetProcessSchemeAsync(Guid schemeId) #
Returns process scheme by specific id, if scheme not exists creates it

Parameters

Name
Type
Description
schemeId
Guid
Id of the scheme

Returns

Type
Description
Task<ProcessDefinition>
ProcessDefinition object
public Task<ProcessDefinition> GetProcessSchemeAsync(string schemeCode, string? tenantId = null) #
Returns process scheme by specific name, if scheme not exists creates it

Parameters

Name
Type
Description
schemeCode
String
Name of the scheme
tenantId
String
Tenant id of the scheme

Returns

Type
Description
Task<ProcessDefinition>
ProcessDefinition object
public Task<ProcessInstance> CreateNewProcessAsync(Guid processId, string schemeCode, string? tenantId) #
Create a new instance of the process.

Parameters

Name
Type
Description
processId
Guid
Process id
schemeCode
String
Code of the scheme
tenantId
String
Tenant id of the scheme

Returns

Type
Description
Task<ProcessInstance>
ProcessInstance object
public Task<ProcessInstance> CreateNewSubprocessAsync(Guid processId, ProcessInstance parentProcessInstance, TransitionDefinition startingTransition) #

Parameters

Name
Type
Description
processId
Guid
parentProcessInstance
ProcessInstance
startingTransition
TransitionDefinition

Returns

Type
Description
Task<ProcessInstance>
public Task<ProcessInstance> GetProcessInstanceAsync(Guid processId) #
Returns existing process instance

Parameters

Name
Type
Description
processId
Guid
Process id

Returns

Type
Description
Task<ProcessInstance>
ProcessInstance object
public Task<ProcessDefinition> CreateNewProcessSchemeAsync(string schemeCode, string? tenantId = null) #
Create a new scheme for an existing process

Parameters

Name
Type
Description
schemeCode
String
Code of the scheme
tenantId
String
Tenant id of the scheme

Returns

Type
Description
Task<ProcessDefinition>
ProcessDefinition object
public Task<ProcessDefinition> CreateNewSubprocessSchemeAsync(ProcessDefinition parentProcessScheme, TransitionDefinition startingTransition) #

Parameters

Name
Type
Description
parentProcessScheme
ProcessDefinition
startingTransition
TransitionDefinition

Returns

Type
Description
Task<ProcessDefinition>
public void SetCache(IParsedProcessCache cache) #
Sets the cache to store parsed ProcessDefinition objects ProcessDefinition

Parameters

Name
Type
Description
cache
IParsedProcessCache
Instance of cache object
public void RemoveCache() #
Removes the cache to store parsed ProcessDefinition objects ProcessDefinition
public Task SetSchemeIsObsoleteAsync(string schemeCode, string? tenantId = null) #
Set IsObsolete sign to the scheme with specific name

Parameters

Name
Type
Description
schemeCode
String
Name 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
public Task<ProcessDefinition> GetProcessSchemeForDesignerAsync(string code, string? tenantId = null) #
Returns existing process scheme directly from scheme persistence store

Parameters

Name
Type
Description
code
String
Name of the scheme
tenantId
String
Tenant id of the scheme

Returns

Type
Description
Task<ProcessDefinition>
ProcessDefinition object
public Task<(bool success, List<string>? errors, string? failedStep)> SaveProcessSchemeAsync(string schemeCode, ProcessDefinition pd) #
Saves process scheme to scheme persistence store

Parameters

Name
Type
Description
schemeCode
String
Code of the scheme
pd
ProcessDefinition
Object representation of the scheme

Returns

Type
Description
Task<String>
success - true if scheme validation was success, errors - validation errors, failedStep - the name of failed build step
public Task<(List<string>? codes, List<string>? errors, string? failedStep)> GetInlineSchemesAsync(ProcessDefinition pd) #
Get the list of inlined schemes for a given scheme

Parameters

Name
Type
Description
pd
ProcessDefinition
Object representation of the scheme

Returns

Type
Description
Task<String>
codes - list of inlined scheme codes, errors - validation errors, failedStep - the name of failed build step
[Obsolete("Do not use this API. It was used only by the deprecated Assignment plugin and will be removed soon.")] public Task UpsertProcessInstanceScheme(ProcessDefinition pd) #
Saves scheme directly in WorkflowProcessScheme

Parameters

Name
Type
Description
pd
ProcessDefinition

Returns

Type
Description
Task
[Obsolete("Do not use this API. It was used only by the deprecated Assignment plugin and will be removed soon.")] public void RemoveSchemeFromCache(Guid schemeId) #
Remove scheme from scheme cache if the cache is exists

Parameters

Name
Type
Description
schemeId
Guid
public ProcessDefinition Parse(string scheme, SchemeParsingType schemeParsingType = SchemeParsingType.Strict) #
Parses process scheme from the string

Parameters

Name
Type
Description
scheme
String
String representation of not parsed scheme
schemeParsingType
SchemeParsingType
Type of parsing strict or soft. Uses only for upload operations where we need softer scheme check

Returns

Type
Description
ProcessDefinition
ProcessDefinition object
public string Serialize(ProcessDefinition processDefinition) #
Serialize process scheme to the string

Parameters

Name
Type
Description
processDefinition
ProcessDefinition
SProcessDefinition object

Returns

Type
Description
String
String representation of not parsed scheme
public void AddSystemBuildStepAtTheEnd(BuildStep step, int startOrder = 0, int endOrder = 1000) #
Adds a build step into workflow builder

Parameters

Name
Type
Description
step
BuildStep
Build step
startOrder
Int32
The order from which the ordering begins
endOrder
Int32
The order on which the ordering ends
public void AddBuildStepAtTheEnd(BuildStep step) #
Adds a build step after all build steps into workflow builder

Parameters

Name
Type
Description
step
BuildStep
Build step
public void AddBuildStep(int order, BuildStepPosition buildStepPosition, BuildStep step) #
Adds a build step into workflow builder

Parameters

Name
Type
Description
order
Int32
Order in position
buildStepPosition
BuildStepPosition
Indicates whether the build step is added after the system steps or before the system steps.
step
BuildStep
Build step
public bool ContainsBuildStep(string name) #
Returns true if the builder contains a build step with the name

Parameters

Name
Type
Description
name
String
Name of build step

Returns

Type
Description
Boolean
public Task<List<string>> GetInlinedSchemeCodesAsync(string? tenantId = null) #
Returns the list of scheme codes that can be inlined into other schemes. If tenantId is null, returns only shared schemes. If tenantId is specified, returns shared and tenant-specific schemes with distinct codes.

Parameters

Name
Type
Description
tenantId
String
Tenant id of the scheme

Returns

Type
Description
Task<String>
The list of scheme codes
public Task<Dictionary<string, ParameterDefinition[]>> GetInlinedSchemeParametersAsync(string? tenantId = null) #
Returns the dictionary of inlined scheme parameters. If tenantId is null, returns parameters only for shared schemes. If tenantId is specified, resolves parameters for shared and tenant-specific schemes with distinct codes.

Parameters

Name
Type
Description
tenantId
String
Tenant id of the scheme

Returns

Type
Description
Task<ParameterDefinition[]>
The dictionary of inlined scheme parameters
public Task<List<string>> GetRelatedByInliningSchemeCodesAsync(string schemeCode, string? tenantId = null) #
Returns the list of scheme codes into which the scheme with the given code has been inlined

Parameters

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

Returns

Type
Description
Task<String>
The list of scheme codes into which the scheme with the given code has been inlined
public Task<ProcessDefinition> GenerateProcessDefinitionAsync(string schemeCode, string? tenantId = null) #
Generates new Process Definition, doesn't save it in a database, doesn't use cache, doesn't execute build steps

Parameters

Name
Type
Description
schemeCode
String
Name of the scheme
tenantId
String
Tenant id of the scheme

Returns

Type
Description
Task<ProcessDefinition>
Generated process definition
public Task AddSchemeTagsAsync(string schemeCode, IEnumerable<string> tags) #
Adds tags to the shared scheme with the given schemeCode.

Parameters

Name
Type
Description
schemeCode
String
tags
IEnumerable<String>

Returns

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

Parameters

Name
Type
Description
schemeCode
String
tenantId
String
tags
IEnumerable<String>

Returns

Type
Description
Task
public Task RemoveSchemeTagsAsync(string schemeCode, IEnumerable<string> tags) #
Removes tags from the shared scheme with the given schemeCode.

Parameters

Name
Type
Description
schemeCode
String
tags
IEnumerable<String>

Returns

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

Parameters

Name
Type
Description
schemeCode
String
tenantId
String
tags
IEnumerable<String>

Returns

Type
Description
Task
public Task SetSchemeTagsAsync(string schemeCode, IEnumerable<string> tags) #
Sets tags on the shared scheme with the given schemeCode.

Parameters

Name
Type
Description
schemeCode
String
tags
IEnumerable<String>

Returns

Type
Description
Task
public Task SetSchemeTagsAsync(string schemeCode, string? tenantId, IEnumerable<string> tags) #
Sets tags on the scheme with the given schemeCode in the exact tenant scope. If tenantId is null, updates only the shared scheme.

Parameters

Name
Type
Description
schemeCode
String
tenantId
String
tags
IEnumerable<String>

Returns

Type
Description
Task
public Task<List<string>> SearchSchemesByTagsAsync(IEnumerable<string>? tags) #
Returns the list of shared scheme codes with the given tags. If tags are null, returns all shared scheme codes.

Parameters

Name
Type
Description
tags
IEnumerable<String>

Returns

Type
Description
Task<String>
public Task<List<string>> SearchSchemesByTagsAsync(string? tenantId, IEnumerable<string>? tags) #
Returns the list of scheme codes with the given tags in the exact tenant scope. If tags are null, returns all scheme codes in the specified tenant scope. If tenantId is null, searches only in shared schemes.

Parameters

Name
Type
Description
tenantId
String
tags
IEnumerable<String>

Returns

Type
Description
Task<String>