Skip to main content

Class WorkflowBuilder<TSchemeMedium>

Base workflow builder, which convert not parsed process scheme OptimaJet.Workflow.Core.Model.SchemeDefinition%601 to the object model of a scheme of a process ProcessDefinition

Inheritance

↳ object

    WorkflowBuilder<TSchemeMedium>

Implements

IWorkflowBuilder

Inherited Members

Equals(object)

Equals(object, object)

GetHashCode()

GetType()

ReferenceEquals(object, object)

ToString()

Namespace: OptimaJet.Workflow.Core.Builder

Assembly: OptimaJet.Workflow.Core.dll

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

Constructors

WorkflowBuilder(IWorkflowGenerator<TSchemeMedium>, IWorkflowParser<TSchemeMedium>, ISchemePersistenceProvider<TSchemeMedium>)

Create WorkflowBuilder object

Declaration
public WorkflowBuilder(IWorkflowGenerator<TSchemeMedium> generator, IWorkflowParser<TSchemeMedium> parser, ISchemePersistenceProvider<TSchemeMedium> schemePersistenceProvider)
Parameters
TypeNameDescription
IWorkflowGenerator<<TSchemeMedium>>generatorNot parsed scheme generator <xref href="OptimaJet.Workflow.Core.Generator.IWorkflowGenerator%601" data-throw-if-not-resolved="false"></xref>
IWorkflowParser<<TSchemeMedium>>parserParser from not parsed process scheme <xref href="OptimaJet.Workflow.Core.Model.SchemeDefinition%601" data-throw-if-not-resolved="false"></xref> to the object model of a scheme of a process <xref href="OptimaJet.Workflow.Core.Model.ProcessDefinition" data-throw-if-not-resolved="false"></xref>
ISchemePersistenceProvider<<TSchemeMedium>>schemePersistenceProviderScheme persistence provider <xref href="OptimaJet.Workflow.Core.Persistence.ISchemePersistenceProvider%601" data-throw-if-not-resolved="false"></xref>

Properties

Runtime

Declaration
public WorkflowRuntime Runtime { get; set; }
Property value
TypeDescription
WorkflowRuntime

Methods

GetProcessSchemeAsync(Guid)

Returns process scheme by specific id, if scheme not exists creates it

Declaration
public Task<ProcessDefinition> GetProcessSchemeAsync(Guid schemeId)
Parameters
TypeNameDescription
GuidschemeIdId of the scheme
Returns
TypeDescription
Task<ProcessDefinition>ProcessDefinition object

GetProcessSchemeAsync(string)

Returns process scheme by specific name, if scheme not exists creates it

Declaration
public Task<ProcessDefinition> GetProcessSchemeAsync(string schemeCode)
Parameters
TypeNameDescription
stringschemeCodeName of the scheme
Returns
TypeDescription
Task<ProcessDefinition>ProcessDefinition object

GetProcessSchemeAsync(string, IDictionary<string, object>)

Returns process scheme by specific name and parameters for creating the scheme of the process, if scheme not exists creates it

Declaration
public Task<ProcessDefinition> GetProcessSchemeAsync(string schemeCode, IDictionary<string, object> parameters)
Parameters
TypeNameDescription
stringschemeCodeName of the scheme
IDictionary<string, object>parametersThe parameters for creating the scheme of the process
Returns
TypeDescription
Task<ProcessDefinition>ProcessDefinition object

CreateNewProcessAsync(Guid, string, IDictionary<string, object>, string)

Create new instance of the process.

Declaration
public Task<ProcessInstance> CreateNewProcessAsync(Guid processId, string schemeCode, IDictionary<string, object> parameters, string tenantId)
Parameters
TypeNameDescription
GuidprocessIdProcess id
stringschemeCodeCode of the scheme
IDictionary<string, object>parametersThe parameters for creating the scheme of the process
stringtenantIdTenant id
Returns
TypeDescription
Task<ProcessInstance>ProcessInstance object

CreateNewSubprocessAsync(Guid, ProcessInstance, TransitionDefinition)

Declaration
public Task<ProcessInstance> CreateNewSubprocessAsync(Guid processId, ProcessInstance parentProcessInstance, TransitionDefinition startingTransition)
Parameters
TypeNameDescription
GuidprocessId
ProcessInstanceparentProcessInstance
TransitionDefinitionstartingTransition
Returns
TypeDescription
Task<ProcessInstance>

GetProcessInstanceAsync(Guid)

Returns existing process instance

Declaration
public Task<ProcessInstance> GetProcessInstanceAsync(Guid processId)
Parameters
TypeNameDescription
GuidprocessIdProcess id
Returns
TypeDescription
Task<ProcessInstance>ProcessInstance object

CreateNewProcessSchemeAsync(string, IDictionary<string, object>)

Create new scheme for existing process

Declaration
public Task<ProcessDefinition> CreateNewProcessSchemeAsync(string schemeCode, IDictionary<string, object> parameters)
Parameters
TypeNameDescription
stringschemeCodeCode of the scheme
IDictionary<string, object>parametersThe parameters for creating scheme of process
Returns
TypeDescription
Task<ProcessDefinition>ProcessDefinition object

CreateNewSubprocessSchemeAsync(ProcessDefinition, TransitionDefinition)

Declaration
public Task<ProcessDefinition> CreateNewSubprocessSchemeAsync(ProcessDefinition parentProcessScheme, TransitionDefinition startingTransition)
Parameters
TypeNameDescription
ProcessDefinitionparentProcessScheme
TransitionDefinitionstartingTransition
Returns
TypeDescription
Task<ProcessDefinition>

SetCache(IParsedProcessCache)

Sets the cache to store parsed ProcessDefinition objects ProcessDefinition

Declaration
public void SetCache(IParsedProcessCache cache)
Parameters
TypeNameDescription
IParsedProcessCachecacheInstance of cache object

RemoveCache()

Removes the cache to store parsed ProcessDefinition objects ProcessDefinition

Declaration
public void RemoveCache()

SetSchemeIsObsoleteAsync(string, Dictionary<string, object>)

Set IsObsolete sign to the scheme with specific name and parameters for creating the scheme of the process

Declaration
public Task SetSchemeIsObsoleteAsync(string schemeCode, Dictionary<string, object> parameters)
Parameters
TypeNameDescription
stringschemeCodeName of the scheme
Dictionary<string, object>parametersThe parameters for creating the scheme of the process
Returns
TypeDescription
Task

SetSchemeIsObsoleteAsync(string)

Set IsObsolete sign to the scheme with specific name

Declaration
public Task SetSchemeIsObsoleteAsync(string schemeCode)
Parameters
TypeNameDescription
stringschemeCodeName of the scheme
Returns
TypeDescription
Task

GetProcessSchemeForDesignerAsync(string)

Returns existing process scheme directly from scheme persistence store

Declaration
public Task<ProcessDefinition> GetProcessSchemeForDesignerAsync(string code)
Parameters
TypeNameDescription
stringcodeName of the scheme
Returns
TypeDescription
Task<ProcessDefinition>ProcessDefinition object

SaveProcessSchemeAsync(string, ProcessDefinition)

Saves process scheme to scheme persistence store

Declaration
public Task<(bool success, List<string> errors, string failedStep)> SaveProcessSchemeAsync(string schemeCode, ProcessDefinition pd)
Parameters
TypeNameDescription
stringschemeCodeCode of the scheme
ProcessDefinitionpdObject representation of the scheme
Returns
TypeDescription
Task<(bool success, List<string> errors, string failedStep)>success - true if scheme validation was success,
errors - validation errors,
failedStep - the name of failed build step

GetInlineSchemesAsync(ProcessDefinition)

Get the list of inlined schemes for a given scheme

Declaration
public Task<(List<string> codes, List<string> errors, string failedStep)> GetInlineSchemesAsync(ProcessDefinition pd)
Parameters
TypeNameDescription
ProcessDefinitionpdObject representation of the scheme
Returns
TypeDescription
Task<(List<string> codes, List<string> errors, string failedStep)>codes - list of inlined scheme codes,
errors - validation errors,
failedStep - the name of failed build step

UpsertProcessInstanceScheme(ProcessDefinition)

Saves scheme directly in WorkflowProcessScheme

Declaration
public Task UpsertProcessInstanceScheme(ProcessDefinition pd)
Parameters
TypeNameDescription
ProcessDefinitionpd
Returns
TypeDescription
Task

RemoveSchemeFromCache(Guid)

Remove scheme from scheme cache if the cache is exists

Declaration
public void RemoveSchemeFromCache(Guid schemeId)
Parameters
TypeNameDescription
GuidschemeId

Parse(string, SchemeParsingType)

Parses process scheme from the string

Declaration
public ProcessDefinition Parse(string scheme, SchemeParsingType schemeParsingType = SchemeParsingType.Strict)
Parameters
TypeNameDescription
stringschemeString representation of not parsed scheme
SchemeParsingTypeschemeParsingTypeType of parsing strict or soft. Uses only for upload operations where we need softer scheme check
Returns
TypeDescription
ProcessDefinitionProcessDefinition object

Serialize(ProcessDefinition)

Serialize process scheme to the string

Declaration
public string Serialize(ProcessDefinition processDefinition)
Parameters
TypeNameDescription
ProcessDefinitionprocessDefinitionSProcessDefinition object
Returns
TypeDescription
stringString representation of not parsed scheme

AddSystemBuildStepAtTheEnd(BuildStep, int, int)

Declaration
public void AddSystemBuildStepAtTheEnd(BuildStep step, int startOrder = 0, int endOrder = 1000)
Parameters
TypeNameDescription
BuildStepstep
intstartOrder
intendOrder

AddBuildStepAtTheEnd(BuildStep)

Declaration
public void AddBuildStepAtTheEnd(BuildStep step)
Parameters
TypeNameDescription
BuildStepstep

AddBuildStep(int, BuildStepPosition, BuildStep)

Adds a build step into workflow builder

Declaration
public void AddBuildStep(int order, BuildStepPosition buildStepPosition, BuildStep step)
Parameters
TypeNameDescription
intorderOrder in position
BuildStepPositionbuildStepPositionIndicates whether the build step is added after the system steps or before the system steps.
BuildStepstepBuild step

ContainsBuildStep(string)

Declaration
public bool ContainsBuildStep(string name)
Parameters
TypeNameDescription
stringname
Returns
TypeDescription
bool

GetInlinedSchemeCodesAsync()

Declaration
public Task<List<string>> GetInlinedSchemeCodesAsync()
Returns
TypeDescription
Task<List<string>>

GetRelatedByInliningSchemeCodesAsync(string)

Declaration
public Task<List<string>> GetRelatedByInliningSchemeCodesAsync(string schemeCode)
Parameters
TypeNameDescription
stringschemeCode
Returns
TypeDescription
Task<List<string>>

GenerateProcessDefinitionAsync(string, IDictionary<string, object>)

Generates new Process Definition, doesn't save it in a database, doesn't use cache, doesn't execute build steps

Declaration
public Task<ProcessDefinition> GenerateProcessDefinitionAsync(string schemeCode, IDictionary<string, object> parameters)
Parameters
TypeNameDescription
stringschemeCodeName of the scheme
IDictionary<string, object>parametersThe parameters for creating the scheme of the process
Returns
TypeDescription
Task<ProcessDefinition>Generated process definition

AddSchemeTagsAsync(string, IEnumerable<string>)

Add tags to scheme with the given schemeCode

Declaration
public Task AddSchemeTagsAsync(string schemeCode, IEnumerable<string> tags)
Parameters
TypeNameDescription
stringschemeCode
IEnumerable<string>tags
Returns
TypeDescription
Task

RemoveSchemeTagsAsync(string, IEnumerable<string>)

Remove tags from scheme with the given schemeCode

Declaration
public Task RemoveSchemeTagsAsync(string schemeCode, IEnumerable<string> tags)
Parameters
TypeNameDescription
stringschemeCode
IEnumerable<string>tags
Returns
TypeDescription
Task

SetSchemeTagsAsync(string, IEnumerable<string>)

Set tags to scheme with the given schemeCode

Declaration
public Task SetSchemeTagsAsync(string schemeCode, IEnumerable<string> tags)
Parameters
TypeNameDescription
stringschemeCode
IEnumerable<string>tags
Returns
TypeDescription
Task

SearchSchemesByTagsAsync(IEnumerable<string>)

Returns the list of scheme codes into which the scheme with the given tags

Declaration
public Task<List<string>> SearchSchemesByTagsAsync(IEnumerable<string> tags)
Parameters
TypeNameDescription
IEnumerable<string>tags
Returns
TypeDescription
Task<List<string>>

Extension Methods