diff --git a/e-suite.Modules.WorkflowTemplatesManager/WorkflowTemplateManager.cs b/e-suite.Modules.WorkflowTemplatesManager/WorkflowTemplateManager.cs index 819f2dd..f66f88e 100644 --- a/e-suite.Modules.WorkflowTemplatesManager/WorkflowTemplateManager.cs +++ b/e-suite.Modules.WorkflowTemplatesManager/WorkflowTemplateManager.cs @@ -6,10 +6,11 @@ using e_suite.Database.Core.Extensions; using e_suite.Modules.WorkflowTemplatesManager.Repository; using e_suite.Utilities.Pagination; using e_suite.Workflow.Core.Attributes; -using eSuite.Core.Miscellaneous; -using System.Linq.Expressions; using e_suite.Workflow.Core.Extensions; using e_suite.Workflow.Core.Interfaces; +using eSuite.Core.Miscellaneous; +using System.Linq.Expressions; +using System.Reflection; //using WorkflowVersion = e_suite.Workflow.Core.WorkflowVersion; @@ -180,10 +181,7 @@ public class WorkflowTemplateManager : IWorkflowTemplateManager { var interfaces = t.GetInterfaces(); var capabilities = interfaces - .Where(i => - i != typeof(ITask) && - i.Namespace?.StartsWith("e_suite.Workflow") == true // avoid system interfaces - ) + .Where(i => i.GetCustomAttribute() != null) .Select(FormatInterfaceName) .ToList(); diff --git a/e-suite.Workflow.Core/Attributes/TaskCapabilityAttribute.cs b/e-suite.Workflow.Core/Attributes/TaskCapabilityAttribute.cs new file mode 100644 index 0000000..38b353a --- /dev/null +++ b/e-suite.Workflow.Core/Attributes/TaskCapabilityAttribute.cs @@ -0,0 +1,6 @@ +namespace e_suite.Workflow.Core.Attributes; + +[AttributeUsage(AttributeTargets.Interface)] +public sealed class TaskCapabilityAttribute : Attribute +{ +} \ No newline at end of file diff --git a/e-suite.Workflow.Core/Interfaces/IApprovalTaskAssignee.cs b/e-suite.Workflow.Core/Interfaces/IApprovalTaskAssignee.cs index 92f5785..3cf45b3 100644 --- a/e-suite.Workflow.Core/Interfaces/IApprovalTaskAssignee.cs +++ b/e-suite.Workflow.Core/Interfaces/IApprovalTaskAssignee.cs @@ -1,5 +1,8 @@ -namespace e_suite.Workflow.Core.Interfaces; +using e_suite.Workflow.Core.Attributes; +namespace e_suite.Workflow.Core.Interfaces; + +[TaskCapability] public interface IApprovalTaskAssignee : ITaskAssignee, IBypassable { public bool AllowNoVerdict { get; set; } diff --git a/e-suite.Workflow.Core/Interfaces/IAssignees.cs b/e-suite.Workflow.Core/Interfaces/IAssignees.cs index 413469b..591a6f2 100644 --- a/e-suite.Workflow.Core/Interfaces/IAssignees.cs +++ b/e-suite.Workflow.Core/Interfaces/IAssignees.cs @@ -1,7 +1,9 @@ -using System.ComponentModel.DataAnnotations; +using e_suite.Workflow.Core.Attributes; +using System.ComponentModel.DataAnnotations; namespace e_suite.Workflow.Core.Interfaces; +[TaskCapability] public interface IAssignees where T : ITaskAssignee { [Required] diff --git a/e-suite.Workflow.Core/Interfaces/IBudget.cs b/e-suite.Workflow.Core/Interfaces/IBudget.cs index effd483..340d778 100644 --- a/e-suite.Workflow.Core/Interfaces/IBudget.cs +++ b/e-suite.Workflow.Core/Interfaces/IBudget.cs @@ -1,7 +1,9 @@ -using e_suite.Workflow.Core.Enums; +using e_suite.Workflow.Core.Attributes; +using e_suite.Workflow.Core.Enums; namespace e_suite.Workflow.Core.Interfaces; +[TaskCapability] public interface IBudget { /// diff --git a/e-suite.Workflow.Core/Interfaces/IBypassable.cs b/e-suite.Workflow.Core/Interfaces/IBypassable.cs index 14df8d1..e251b4f 100644 --- a/e-suite.Workflow.Core/Interfaces/IBypassable.cs +++ b/e-suite.Workflow.Core/Interfaces/IBypassable.cs @@ -1,5 +1,8 @@ -namespace e_suite.Workflow.Core.Interfaces; +using e_suite.Workflow.Core.Attributes; +namespace e_suite.Workflow.Core.Interfaces; + +[TaskCapability] public interface IBypassable { public bool Bypassable { get; set; } diff --git a/e-suite.Workflow.Core/Interfaces/IFailedLoopback.cs b/e-suite.Workflow.Core/Interfaces/IFailedLoopback.cs index a9d32da..dc38b50 100644 --- a/e-suite.Workflow.Core/Interfaces/IFailedLoopback.cs +++ b/e-suite.Workflow.Core/Interfaces/IFailedLoopback.cs @@ -1,7 +1,9 @@ -using System.ComponentModel.DataAnnotations; +using e_suite.Workflow.Core.Attributes; +using System.ComponentModel.DataAnnotations; namespace e_suite.Workflow.Core.Interfaces; +[TaskCapability] public interface IFailedLoopback { /// diff --git a/e-suite.Workflow.Core/Interfaces/IStage.cs b/e-suite.Workflow.Core/Interfaces/IStage.cs index b204409..587b606 100644 --- a/e-suite.Workflow.Core/Interfaces/IStage.cs +++ b/e-suite.Workflow.Core/Interfaces/IStage.cs @@ -3,6 +3,7 @@ using e_suite.Workflow.Core.Attributes; namespace e_suite.Workflow.Core.Interfaces; +[TaskCapability] public interface IStage where T : TaskTypeAttribute { /// diff --git a/e-suite.Workflow.Core/Interfaces/ITags.cs b/e-suite.Workflow.Core/Interfaces/ITags.cs index 5e0bba5..5125821 100644 --- a/e-suite.Workflow.Core/Interfaces/ITags.cs +++ b/e-suite.Workflow.Core/Interfaces/ITags.cs @@ -1,5 +1,8 @@ -namespace e_suite.Workflow.Core.Interfaces; +using e_suite.Workflow.Core.Attributes; +namespace e_suite.Workflow.Core.Interfaces; + +[TaskCapability] public interface ITags { public IList Tags { get; set; } diff --git a/e-suite.Workflow.Core/Interfaces/ITaskAssignee.cs b/e-suite.Workflow.Core/Interfaces/ITaskAssignee.cs index 87bd146..a0cd7c1 100644 --- a/e-suite.Workflow.Core/Interfaces/ITaskAssignee.cs +++ b/e-suite.Workflow.Core/Interfaces/ITaskAssignee.cs @@ -1,9 +1,11 @@ using e_suite.Database.Core.Tables.Contacts; using e_suite.Database.Core.Tables.Domain; +using e_suite.Workflow.Core.Attributes; using e_suite.Workflow.Core.Enums; namespace e_suite.Workflow.Core.Interfaces; +[TaskCapability] public interface ITaskAssignee { public Role? Role { get; set; }