diff --git a/e-suite.Service.WorkflowProcessor/WorkflowProcessor.cs b/e-suite.Service.WorkflowProcessor/WorkflowProcessor.cs index 1dbdb13..d722575 100644 --- a/e-suite.Service.WorkflowProcessor/WorkflowProcessor.cs +++ b/e-suite.Service.WorkflowProcessor/WorkflowProcessor.cs @@ -191,7 +191,7 @@ public class WorkflowProcessor : IWorkflowProcessor .GetInterfaces() .FirstOrDefault(i => i.IsGenericType && - i.GetGenericTypeDefinition() == typeof(IAssignees<>)); + i.GetGenericTypeDefinition() == typeof(IAssignees<,>)); if (typedInterface == null) throw new InvalidOperationException("Task does not implement IAssignees."); diff --git a/e-suite.Workflow.Core/Enums/ApprovalVerdict.cs b/e-suite.Workflow.Core/Enums/ApprovalVerdict.cs index 9d417e5..1e6da12 100644 --- a/e-suite.Workflow.Core/Enums/ApprovalVerdict.cs +++ b/e-suite.Workflow.Core/Enums/ApprovalVerdict.cs @@ -5,7 +5,6 @@ namespace e_suite.Workflow.Core.Enums; [Description("Verdict")] public enum ApprovalVerdict { - None, Approved, Rejected } diff --git a/e-suite.Workflow.Core/Enums/RuleOperator.cs b/e-suite.Workflow.Core/Enums/RuleOperator.cs new file mode 100644 index 0000000..eff93c3 --- /dev/null +++ b/e-suite.Workflow.Core/Enums/RuleOperator.cs @@ -0,0 +1,13 @@ +namespace e_suite.Workflow.Core.Enums; + +public enum RuleOperator +{ + All, + Any, + CountAtLeast, + CountExactly, + FilterByRaci, + FilterByOutcome, + And, + Or +} \ No newline at end of file diff --git a/e-suite.Workflow.Core/Interfaces/CompletionRule.cs b/e-suite.Workflow.Core/Interfaces/CompletionRule.cs new file mode 100644 index 0000000..ea93605 --- /dev/null +++ b/e-suite.Workflow.Core/Interfaces/CompletionRule.cs @@ -0,0 +1,14 @@ +using e_suite.Workflow.Core.Enums; +using eSuite.Core.Workflow; + +namespace e_suite.Workflow.Core.Interfaces; + +public class CompletionRule +{ + public RuleOperator Operator { get; set; } + public List>? Children { get; set; } + + public Raci? RaciFilter { get; set; } + public TOutcome RequiredOutcome { get; set; } = default!; + public int? Threshold { get; set; } +} \ No newline at end of file diff --git a/e-suite.Workflow.Core/Interfaces/IAssignees.cs b/e-suite.Workflow.Core/Interfaces/IAssignees.cs index 97f0fca..dd8c668 100644 --- a/e-suite.Workflow.Core/Interfaces/IAssignees.cs +++ b/e-suite.Workflow.Core/Interfaces/IAssignees.cs @@ -1,4 +1,5 @@ using e_suite.Workflow.Core.Attributes; +using e_suite.Workflow.Core.Enums; using System.ComponentModel.DataAnnotations; namespace e_suite.Workflow.Core.Interfaces; @@ -9,9 +10,10 @@ public interface IAssignees } [TaskCapability] -public interface IAssignees : IAssignees where T : ITaskAssignee +public interface IAssignees : IAssignees, IOutcome where TTaskAssignee : ITaskAssignee { [Required] - List Assignees { get; set; } + List Assignees { get; set; } + CompletionRule AssigneesCompletionRule { get; set; } } \ No newline at end of file diff --git a/e-suite.Workflow.Core/Tasks/AdhocApprovalTask.cs b/e-suite.Workflow.Core/Tasks/AdhocApprovalTask.cs index 6510896..d8c3f82 100644 --- a/e-suite.Workflow.Core/Tasks/AdhocApprovalTask.cs +++ b/e-suite.Workflow.Core/Tasks/AdhocApprovalTask.cs @@ -5,9 +5,10 @@ using e_suite.Workflow.Core.Interfaces; namespace e_suite.Workflow.Core.Tasks; [GeneralTask(taskIcon: "faEyeSlash")] -public class AdhocApprovalTask : TaskBase, IAssignees, IOutcome +public class AdhocApprovalTask : TaskBase, IAssignees { public List Assignees { get; set; } = []; + public CompletionRule AssigneesCompletionRule { get; set; } public ApprovalVerdict TaskOutcome { get; set; } - public List> OutcomeActions { get; set; } = []; + public List> OutcomeActions { get; set; } } \ No newline at end of file diff --git a/e-suite.Workflow.Core/Tasks/ApprovalStep.cs b/e-suite.Workflow.Core/Tasks/ApprovalStep.cs index af1d627..f409287 100644 --- a/e-suite.Workflow.Core/Tasks/ApprovalStep.cs +++ b/e-suite.Workflow.Core/Tasks/ApprovalStep.cs @@ -5,10 +5,10 @@ using e_suite.Workflow.Core.Interfaces; namespace e_suite.Workflow.Core.Tasks; [ApprovalTask] -public class ApprovalStep : TaskBase, IAssignees, IOutcome +public class ApprovalStep : TaskBase, IAssignees { public List Assignees { get; set; } = []; + public CompletionRule AssigneesCompletionRule { get; set; } - - public List> OutcomeActions { get; set; } = []; + public List> OutcomeActions { get; set; } } \ No newline at end of file diff --git a/e-suite.Workflow.Core/Tasks/BasicTask.cs b/e-suite.Workflow.Core/Tasks/BasicTask.cs index f24a068..278d5ff 100644 --- a/e-suite.Workflow.Core/Tasks/BasicTask.cs +++ b/e-suite.Workflow.Core/Tasks/BasicTask.cs @@ -1,5 +1,4 @@ -using System.ComponentModel; -using e_suite.Workflow.Core.Attributes; +using e_suite.Workflow.Core.Attributes; using e_suite.Workflow.Core.Enums; using e_suite.Workflow.Core.Interfaces; @@ -9,9 +8,10 @@ namespace e_suite.Workflow.Core.Tasks; /// A user has to open this task, manually set it to ready to complete /// [GeneralTask(taskIcon: "faSquareCheck")] -public class BasicTask : TaskBase, IAssignees, IOutcome +public class BasicTask : TaskBase, IAssignees { public List Assignees { get; set; } = []; + public CompletionRule AssigneesCompletionRule { get; set; } public List> OutcomeActions { get; set; } = []; } \ No newline at end of file diff --git a/e-suite.Workflow.Core/Tasks/ContentCollationTask.cs b/e-suite.Workflow.Core/Tasks/ContentCollationTask.cs index d25c38c..3f0754d 100644 --- a/e-suite.Workflow.Core/Tasks/ContentCollationTask.cs +++ b/e-suite.Workflow.Core/Tasks/ContentCollationTask.cs @@ -8,9 +8,10 @@ namespace e_suite.Workflow.Core.Tasks; /// Create a table of field data for output to PDF or AdobeIllustrator /// [GeneralTask] -public class ContentCollationTask : TaskBase, IAssignees, IOutcome +public class ContentCollationTask : TaskBase, IAssignees { public List Assignees { get; set; } = []; + public CompletionRule AssigneesCompletionRule { get; set; } public List> OutcomeActions { get; set; } = []; } \ No newline at end of file diff --git a/e-suite.Workflow.Core/Tasks/FormDataInputTask.cs b/e-suite.Workflow.Core/Tasks/FormDataInputTask.cs index cdaab1a..824c1fa 100644 --- a/e-suite.Workflow.Core/Tasks/FormDataInputTask.cs +++ b/e-suite.Workflow.Core/Tasks/FormDataInputTask.cs @@ -6,9 +6,10 @@ using eSuite.Core.Miscellaneous; namespace e_suite.Workflow.Core.Tasks; [GeneralTask(taskIcon: "faFileLines")] -public class FormDataInputTask : TaskBase, IAssignees, IFormTemplate, IOutcome +public class FormDataInputTask : TaskBase, IAssignees, IFormTemplate { public List Assignees { get; set; } = []; + public CompletionRule AssigneesCompletionRule { get; set; } public bool IsMultiple { get; set; } public required IGeneralIdRef FormIdRef { get; set; }