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
Type | Name | Description |
---|
IWorkflowGenerator<<TSchemeMedium>> | generator | Not parsed scheme generator <xref href="OptimaJet.Workflow.Core.Generator.IWorkflowGenerator%601" data-throw-if-not-resolved="false"></xref> |
IWorkflowParser<<TSchemeMedium>> | parser | Parser 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>> | schemePersistenceProvider | Scheme 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
Type | Description |
---|
WorkflowRuntime | |
Methods
GetProcessSchemeAsync(Guid)
Returns process scheme by specific id, if scheme not exists creates it
Declaration
public Task<ProcessDefinition> GetProcessSchemeAsync(Guid schemeId)
Parameters
Type | Name | Description |
---|
Guid | schemeId | Id of the scheme |
Returns
Type | Description |
---|
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
Type | Name | Description |
---|
string | schemeCode | Name of the scheme |
Returns
Type | Description |
---|
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
Type | Name | Description |
---|
string | schemeCode | Name of the scheme |
IDictionary<string, object> | parameters | The parameters for creating the scheme of the process |
Returns
Type | Description |
---|
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
Type | Name | Description |
---|
Guid | processId | Process id |
string | schemeCode | Code of the scheme |
IDictionary<string, object> | parameters | The parameters for creating the scheme of the process |
string | tenantId | Tenant id |
Returns
Type | Description |
---|
Task<ProcessInstance> | ProcessInstance object |
CreateNewSubprocessAsync(Guid, ProcessInstance, TransitionDefinition)
Declaration
public Task<ProcessInstance> CreateNewSubprocessAsync(Guid processId, ProcessInstance parentProcessInstance, TransitionDefinition startingTransition)
Parameters
Type | Name | Description |
---|
Guid | processId | |
ProcessInstance | parentProcessInstance | |
TransitionDefinition | startingTransition | |
Returns
Type | Description |
---|
Task<ProcessInstance> | |
GetProcessInstanceAsync(Guid)
Returns existing process instance
Declaration
public Task<ProcessInstance> GetProcessInstanceAsync(Guid processId)
Parameters
Type | Name | Description |
---|
Guid | processId | Process id |
Returns
Type | Description |
---|
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
Type | Name | Description |
---|
string | schemeCode | Code of the scheme |
IDictionary<string, object> | parameters | The parameters for creating scheme of process |
Returns
Type | Description |
---|
Task<ProcessDefinition> | ProcessDefinition object |
CreateNewSubprocessSchemeAsync(ProcessDefinition, TransitionDefinition)
Declaration
public Task<ProcessDefinition> CreateNewSubprocessSchemeAsync(ProcessDefinition parentProcessScheme, TransitionDefinition startingTransition)
Parameters
Type | Name | Description |
---|
ProcessDefinition | parentProcessScheme | |
TransitionDefinition | startingTransition | |
Returns
Type | Description |
---|
Task<ProcessDefinition> | |
SetCache(IParsedProcessCache)
Sets the cache to store parsed ProcessDefinition objects ProcessDefinition
Declaration
public void SetCache(IParsedProcessCache cache)
Parameters
Type | Name | Description |
---|
IParsedProcessCache | cache | Instance 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
Type | Name | Description |
---|
string | schemeCode | Name of the scheme |
Dictionary<string, object> | parameters | The parameters for creating the scheme of the process |
Returns
SetSchemeIsObsoleteAsync(string)
Set IsObsolete sign to the scheme with specific name
Declaration
public Task SetSchemeIsObsoleteAsync(string schemeCode)
Parameters
Type | Name | Description |
---|
string | schemeCode | Name of the scheme |
Returns
GetProcessSchemeForDesignerAsync(string)
Returns existing process scheme directly from scheme persistence store
Declaration
public Task<ProcessDefinition> GetProcessSchemeForDesignerAsync(string code)
Parameters
Type | Name | Description |
---|
string | code | Name of the scheme |
Returns
Type | Description |
---|
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
Type | Name | Description |
---|
string | schemeCode | Code of the scheme |
ProcessDefinition | pd | Object representation of the scheme |
Returns
Type | Description |
---|
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
Type | Name | Description |
---|
ProcessDefinition | pd | Object representation of the scheme |
Returns
Type | Description |
---|
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
Type | Name | Description |
---|
ProcessDefinition | pd | |
Returns
RemoveSchemeFromCache(Guid)
Remove scheme from scheme cache if the cache is exists
Declaration
public void RemoveSchemeFromCache(Guid schemeId)
Parameters
Type | Name | Description |
---|
Guid | schemeId | |
Parse(string, SchemeParsingType)
Parses process scheme from the string
Declaration
public ProcessDefinition Parse(string scheme, SchemeParsingType schemeParsingType = SchemeParsingType.Strict)
Parameters
Type | Name | Description |
---|
string | scheme | 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 |
Serialize(ProcessDefinition)
Serialize process scheme to the string
Declaration
public string Serialize(ProcessDefinition processDefinition)
Parameters
Type | Name | Description |
---|
ProcessDefinition | processDefinition | SProcessDefinition object |
Returns
Type | Description |
---|
string | String representation of not parsed scheme |
AddSystemBuildStepAtTheEnd(BuildStep, int, int)
Declaration
public void AddSystemBuildStepAtTheEnd(BuildStep step, int startOrder = 0, int endOrder = 1000)
Parameters
Type | Name | Description |
---|
BuildStep | step | |
int | startOrder | |
int | endOrder | |
AddBuildStepAtTheEnd(BuildStep)
Declaration
public void AddBuildStepAtTheEnd(BuildStep step)
Parameters
Type | Name | Description |
---|
BuildStep | step | |
AddBuildStep(int, BuildStepPosition, BuildStep)
Adds a build step into workflow builder
Declaration
public void AddBuildStep(int order, BuildStepPosition buildStepPosition, BuildStep step)
Parameters
Type | Name | Description |
---|
int | order | Order in position |
BuildStepPosition | buildStepPosition | Indicates whether the build step is added after the system steps or before the system steps. |
BuildStep | step | Build step |
ContainsBuildStep(string)
Declaration
public bool ContainsBuildStep(string name)
Parameters
Type | Name | Description |
---|
string | name | |
Returns
GetInlinedSchemeCodesAsync()
Declaration
public Task<List<string>> GetInlinedSchemeCodesAsync()
Returns
Type | Description |
---|
Task<List<string>> | |
GetInlinedSchemeParametersAsync()
Declaration
public Task<Dictionary<string, ParameterDefinition[]>> GetInlinedSchemeParametersAsync()
Returns
Type | Description |
---|
Task<Dictionary<string, ParameterDefinition[]>> | |
Declaration
public Task<List<string>> GetRelatedByInliningSchemeCodesAsync(string schemeCode)
Parameters
Type | Name | Description |
---|
string | schemeCode | |
Returns
Type | Description |
---|
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
Type | Name | Description |
---|
string | schemeCode | Name of the scheme |
IDictionary<string, object> | parameters | The parameters for creating the scheme of the process |
Returns
Type | Description |
---|
Task<ProcessDefinition> | Generated process definition |
Add tags to scheme with the given schemeCode
Declaration
public Task AddSchemeTagsAsync(string schemeCode, IEnumerable<string> tags)
Parameters
Type | Name | Description |
---|
string | schemeCode | |
IEnumerable<string> | tags | |
Returns
Remove tags from scheme with the given schemeCode
Declaration
public Task RemoveSchemeTagsAsync(string schemeCode, IEnumerable<string> tags)
Parameters
Type | Name | Description |
---|
string | schemeCode | |
IEnumerable<string> | tags | |
Returns
Set tags to scheme with the given schemeCode
Declaration
public Task SetSchemeTagsAsync(string schemeCode, IEnumerable<string> tags)
Parameters
Type | Name | Description |
---|
string | schemeCode | |
IEnumerable<string> | tags | |
Returns
Returns the list of scheme codes into which the scheme with the given tags
Declaration
public Task<List<string>> SearchSchemesByTagsAsync(IEnumerable<string> tags)
Parameters
Type | Name | Description |
---|
IEnumerable<string> | tags | |
Returns
Type | Description |
---|
Task<List<string>> | |
Extension Methods