make isReadonly editable on workflow model (#4130)

This commit is contained in:
herblinernexxbizz 2023-06-13 10:25:42 +02:00 committed by GitHub
parent e3303aa07f
commit 2a9793768a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 26 additions and 6 deletions

View file

@ -38,6 +38,9 @@ public class WorkflowBuilder : IWorkflowBuilder
/// <inheritdoc />
public string? Description { get; set; }
/// <inheritdoc />
public bool IsReadonly { get; set; }
/// <inheritdoc />
public IActivity? Root { get; set; }
@ -135,7 +138,7 @@ public class WorkflowBuilder : IWorkflowBuilder
var identity = new WorkflowIdentity(definitionId, Version, id);
var publication = WorkflowPublication.LatestAndPublished;
var workflowMetadata = new WorkflowMetadata(Name, Description);
var workflow = new Workflow(identity, publication, workflowMetadata, WorkflowOptions, root, Variables, Inputs, Outputs, Outcomes, CustomProperties);
var workflow = new Workflow(identity, publication, workflowMetadata, WorkflowOptions, root, Variables, Inputs, Outputs, Outcomes, CustomProperties, IsReadonly);
// If a Result variable is defined, install it into the workflow so we can capture the output into it.
if (Result != null)

View file

@ -31,7 +31,13 @@ public interface IWorkflowBuilder
/// A description of the workflow.
/// </summary>
string? Description { get; set; }
/// <summary>
/// WorkflowDefinition is readonly.
/// </summary>
bool IsReadonly { get; set; }
/// <summary>
/// Options for the workflow being built.
/// </summary>

View file

@ -28,7 +28,8 @@ public class Workflow : Composite<object>, ICloneable
ICollection<InputDefinition> inputs,
ICollection<OutputDefinition> outputs,
ICollection<string> outcomes,
IDictionary<string, object> customProperties)
IDictionary<string, object> customProperties,
bool isReadonly)
{
Identity = identity;
Publication = publication;
@ -40,6 +41,7 @@ public class Workflow : Composite<object>, ICloneable
Variables = variables;
CustomProperties = customProperties;
Root = root;
IsReadonly = isReadonly;
}
/// <summary>
@ -91,7 +93,14 @@ public class Workflow : Composite<object>, ICloneable
/// Gets or sets options for the workflow.
/// </summary>
public WorkflowOptions Options { get; set; } = new();
/// <summary>
/// Make workflow definition readonly.
/// </summary>
public bool IsReadonly { get; set; }
/// <summary>
/// Constructs a new <see cref="Workflow"/> from the specified <see cref="IActivity"/>.
/// </summary>

View file

@ -44,7 +44,8 @@ public class WorkflowDefinitionMapper
source.Inputs,
source.Outputs,
source.Outcomes,
source.CustomProperties);
source.CustomProperties,
source.IsReadonly);
}
/// <summary>
@ -71,7 +72,8 @@ public class WorkflowDefinitionMapper
source.Inputs ?? new List<InputDefinition>(),
source.Outputs ?? new List<OutputDefinition>(),
source.Outcomes ?? new List<string>(),
source.CustomProperties ?? new Dictionary<string, object>());
source.CustomProperties ?? new Dictionary<string, object>(),
source.IsReadonly);
}
/// <summary>