From c3b3ccc864c0ce0a1046699b85ef8c4afefc4ac4 Mon Sep 17 00:00:00 2001 From: m c <458905+goatrocks@users.noreply.github.com> Date: Wed, 18 May 2022 17:28:00 -0400 Subject: [PATCH] testing --- .../DesignerMetadata.cs | 28 +++-- .../Designers/ListWithTimeoutDesigner.xaml | 25 ++++ .../Designers/ListWithTimeoutDesigner.xaml.cs | 13 ++ ...ico.RPAActivities.Activities.Design.csproj | 4 + .../Activities/Common/IndicoActivityBase.cs | 31 ++++- .../Activities/DocumentExtraction.cs | 68 +++++------ .../Activities/GenerateSubmissionResult.cs | 64 +++++----- .../Activities/IndicoScope.cs | 2 +- .../Activities/ListDatasets.cs | 54 ++++----- .../Activities/ListSubmissions.cs | 55 +++++++-- .../Activities/ListWithTimeout.cs | 80 +++++++++++++ .../Activities/ListWorkflows.cs | 62 +++++----- .../Activities/SubmissionResult.cs | 70 +++++------ .../Activities/SubmitReview.cs | 94 +++++++-------- .../Activities/WorkflowSubmission.cs | 112 +++++++++--------- .../Properties/Resources.Designer.cs | 56 ++++++++- .../Properties/Resources.resx | 24 ++++ .../Helpers/TaskActivityExtensions.cs | 26 ++-- .../Indico.RPAActivities/Application.cs | 1 + 19 files changed, 568 insertions(+), 301 deletions(-) create mode 100644 Indico.RPAActivities/Indico.RPAActivities.Activities.Design/Designers/ListWithTimeoutDesigner.xaml create mode 100644 Indico.RPAActivities/Indico.RPAActivities.Activities.Design/Designers/ListWithTimeoutDesigner.xaml.cs create mode 100644 Indico.RPAActivities/Indico.RPAActivities.Activities/Activities/ListWithTimeout.cs diff --git a/Indico.RPAActivities/Indico.RPAActivities.Activities.Design/DesignerMetadata.cs b/Indico.RPAActivities/Indico.RPAActivities.Activities.Design/DesignerMetadata.cs index f7b14f4..c09b9b2 100644 --- a/Indico.RPAActivities/Indico.RPAActivities.Activities.Design/DesignerMetadata.cs +++ b/Indico.RPAActivities/Indico.RPAActivities.Activities.Design/DesignerMetadata.cs @@ -16,26 +16,30 @@ public void Register() builder.AddCustomAttributes(typeof(IndicoScope), new DesignerAttribute(typeof(IndicoScopeDesigner))); builder.AddCustomAttributes(typeof(IndicoScope), new HelpKeywordAttribute("")); - builder.AddCustomAttributes(typeof(ListDatasets), new DesignerAttribute(typeof(ListDatasetsDesigner))); - builder.AddCustomAttributes(typeof(ListDatasets), new HelpKeywordAttribute("")); + //builder.AddCustomAttributes(typeof(ListDatasets), new DesignerAttribute(typeof(ListDatasetsDesigner))); + //builder.AddCustomAttributes(typeof(ListDatasets), new HelpKeywordAttribute("")); - builder.AddCustomAttributes(typeof(DocumentExtraction), new DesignerAttribute(typeof(DocumentExtractionDesigner))); - builder.AddCustomAttributes(typeof(DocumentExtraction), new HelpKeywordAttribute("")); + //builder.AddCustomAttributes(typeof(DocumentExtraction), new DesignerAttribute(typeof(DocumentExtractionDesigner))); + //builder.AddCustomAttributes(typeof(DocumentExtraction), new HelpKeywordAttribute("")); - builder.AddCustomAttributes(typeof(ListWorkflows), new DesignerAttribute(typeof(ListWorkflowsDesigner))); - builder.AddCustomAttributes(typeof(ListWorkflows), new HelpKeywordAttribute("")); + //builder.AddCustomAttributes(typeof(ListWorkflows), new DesignerAttribute(typeof(ListWorkflowsDesigner))); + //builder.AddCustomAttributes(typeof(ListWorkflows), new HelpKeywordAttribute("")); - builder.AddCustomAttributes(typeof(WorkflowSubmission), new DesignerAttribute(typeof(WorkflowSubmissionDesigner))); - builder.AddCustomAttributes(typeof(WorkflowSubmission), new HelpKeywordAttribute("")); + //builder.AddCustomAttributes(typeof(WorkflowSubmission), new DesignerAttribute(typeof(WorkflowSubmissionDesigner))); + //builder.AddCustomAttributes(typeof(WorkflowSubmission), new HelpKeywordAttribute("")); - builder.AddCustomAttributes(typeof(SubmissionResult), new DesignerAttribute(typeof(SubmissionResultDesigner))); - builder.AddCustomAttributes(typeof(SubmissionResult), new HelpKeywordAttribute("")); + //builder.AddCustomAttributes(typeof(SubmissionResult), new DesignerAttribute(typeof(SubmissionResultDesigner))); + //builder.AddCustomAttributes(typeof(SubmissionResult), new HelpKeywordAttribute("")); builder.AddCustomAttributes(typeof(ListSubmissions), new DesignerAttribute(typeof(ListSubmissionsDesigner))); builder.AddCustomAttributes(typeof(ListSubmissions), new HelpKeywordAttribute("")); - builder.AddCustomAttributes(typeof(SubmitReview), new DesignerAttribute(typeof(SubmitReviewDesigner))); - builder.AddCustomAttributes(typeof(SubmitReview), new HelpKeywordAttribute("")); + //builder.AddCustomAttributes(typeof(SubmitReview), new DesignerAttribute(typeof(SubmitReviewDesigner))); + //builder.AddCustomAttributes(typeof(SubmitReview), new HelpKeywordAttribute("")); + //builder.AddCustomAttributes(typeof(ListWithTimeout), categoryAttribute); + //builder.AddCustomAttributes(typeof(ListWithTimeout), new DesignerAttribute(typeof(ListWithTimeoutDesigner))); + //builder.AddCustomAttributes(typeof(ListWithTimeout), new HelpKeywordAttribute("")); + MetadataStore.AddAttributeTable(builder.CreateTable()); } diff --git a/Indico.RPAActivities/Indico.RPAActivities.Activities.Design/Designers/ListWithTimeoutDesigner.xaml b/Indico.RPAActivities/Indico.RPAActivities.Activities.Design/Designers/ListWithTimeoutDesigner.xaml new file mode 100644 index 0000000..5901ae6 --- /dev/null +++ b/Indico.RPAActivities/Indico.RPAActivities.Activities.Design/Designers/ListWithTimeoutDesigner.xaml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + diff --git a/Indico.RPAActivities/Indico.RPAActivities.Activities.Design/Designers/ListWithTimeoutDesigner.xaml.cs b/Indico.RPAActivities/Indico.RPAActivities.Activities.Design/Designers/ListWithTimeoutDesigner.xaml.cs new file mode 100644 index 0000000..acb973f --- /dev/null +++ b/Indico.RPAActivities/Indico.RPAActivities.Activities.Design/Designers/ListWithTimeoutDesigner.xaml.cs @@ -0,0 +1,13 @@ +namespace Indico.RPAActivities.Activities.Design.Designers +{ + /// + /// Interaction logic for ListWithTimeoutDesigner.xaml + /// + public partial class ListWithTimeoutDesigner + { + public ListWithTimeoutDesigner() + { + InitializeComponent(); + } + } +} diff --git a/Indico.RPAActivities/Indico.RPAActivities.Activities.Design/Indico.RPAActivities.Activities.Design.csproj b/Indico.RPAActivities/Indico.RPAActivities.Activities.Design/Indico.RPAActivities.Activities.Design.csproj index 14b67ba..3041798 100644 --- a/Indico.RPAActivities/Indico.RPAActivities.Activities.Design/Indico.RPAActivities.Activities.Design.csproj +++ b/Indico.RPAActivities/Indico.RPAActivities.Activities.Design/Indico.RPAActivities.Activities.Design.csproj @@ -37,6 +37,7 @@ + @@ -106,6 +107,9 @@ MSBuild:UpdateDesignTimeXaml Never + + MSBuild:UpdateDesignTimeXaml + MSBuild:UpdateDesignTimeXaml diff --git a/Indico.RPAActivities/Indico.RPAActivities.Activities/Activities/Common/IndicoActivityBase.cs b/Indico.RPAActivities/Indico.RPAActivities.Activities/Activities/Common/IndicoActivityBase.cs index b1e3020..882d759 100644 --- a/Indico.RPAActivities/Indico.RPAActivities.Activities/Activities/Common/IndicoActivityBase.cs +++ b/Indico.RPAActivities/Indico.RPAActivities.Activities/Activities/Common/IndicoActivityBase.cs @@ -1,25 +1,48 @@ -using System.Activities; +using System; +using System.Activities; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; using Indico.RPAActivities.Activities.Properties; +using IndicoV2.Submissions.Models; using UiPath.Shared.Activities; +using UiPath.Shared.Activities.Localization; using UiPath.Shared.Activities.Utilities; namespace Indico.RPAActivities.Activities.Activities { - public abstract class IndicoActivityBase : ContinuableAsyncCodeActivity + public abstract class IndicoActivityBase : ContinuableAsyncCodeActivity { protected Application Application { get; private set; } + + [LocalizedCategory(nameof(Resources.Common_Category))] + [LocalizedDisplayName(nameof(Resources.Timeout_DisplayName))] + [LocalizedDescription(nameof(Resources.Timeout_Description))] + public InArgument TimeoutMS { get; set; } = 60000; + + [LocalizedCategory(nameof(Resources.Common_Category))] + [LocalizedDisplayName(nameof(Resources.ContinueOnError_DisplayName))] + [LocalizedDescription(nameof(Resources.ContinueOnError_Description))] + public override InArgument ContinueOnError { get; set; } + protected IndicoActivityBase() { Constraints.Add(ActivityConstraints.HasParentType, IndicoScope>(string.Format(Resources.ValidationScope_Error, Resources.IndicoScope_DisplayName))); - + } - protected override void Init(AsyncCodeActivityContext context) + protected override IAsyncResult BeginExecute(AsyncCodeActivityContext context, AsyncCallback callback, object state) { var objectContainer = context.GetFromContext(IndicoScope.ParentContainerPropertyTag); Application = objectContainer.Get(); + return base.BeginExecute(context, callback, state); + } + + protected abstract void Results(AsyncCodeActivityContext context, IEnumerable result); + + protected abstract Task ExecuteWithTimeout(AsyncCodeActivityContext context, CancellationToken cancellationToken = default); } } diff --git a/Indico.RPAActivities/Indico.RPAActivities.Activities/Activities/DocumentExtraction.cs b/Indico.RPAActivities/Indico.RPAActivities.Activities/Activities/DocumentExtraction.cs index 5ad5360..de3592f 100644 --- a/Indico.RPAActivities/Indico.RPAActivities.Activities/Activities/DocumentExtraction.cs +++ b/Indico.RPAActivities/Indico.RPAActivities.Activities/Activities/DocumentExtraction.cs @@ -1,41 +1,41 @@ -using System.Activities; -using System.Threading; -using System.Threading.Tasks; -using Indico.RPAActivities.Activities.Activities; -using Indico.RPAActivities.Activities.Properties; -using UiPath.Shared.Activities.Localization; -using IndicoV2.Ocr.Models; +//using System.Activities; +//using System.Threading; +//using System.Threading.Tasks; +//using Indico.RPAActivities.Activities.Activities; +//using Indico.RPAActivities.Activities.Properties; +//using UiPath.Shared.Activities.Localization; +//using IndicoV2.Ocr.Models; -namespace Indico.RPAActivities.Activities -{ - [LocalizedCategory(nameof(Resources.OCRCategory))] - [LocalizedDisplayName(nameof(Resources.DocumentExtraction_DisplayName))] - [LocalizedDescription(nameof(Resources.DocumentExtraction_Description))] - public class DocumentExtraction : IndicoActivityBase<(DocumentExtractionPreset Preset, string Document), string> - { - [LocalizedDisplayName(nameof(Resources.DocumentExtraction_ConfigType_DisplayName))] - [LocalizedDescription(nameof(Resources.DocumentExtraction_ConfigType_Description))] - [LocalizedCategory(nameof(Resources.Input_Category))] - public InArgument Preset { get; set; } = DocumentExtractionPreset.Standard; +//namespace Indico.RPAActivities.Activities +//{ +// [LocalizedCategory(nameof(Resources.OCRCategory))] +// [LocalizedDisplayName(nameof(Resources.DocumentExtraction_DisplayName))] +// [LocalizedDescription(nameof(Resources.DocumentExtraction_Description))] +// public class DocumentExtraction : IndicoActivityBase<(DocumentExtractionPreset Preset, string Document), string> +// { +// [LocalizedDisplayName(nameof(Resources.DocumentExtraction_ConfigType_DisplayName))] +// [LocalizedDescription(nameof(Resources.DocumentExtraction_ConfigType_Description))] +// [LocalizedCategory(nameof(Resources.Input_Category))] +// public InArgument Preset { get; set; } = DocumentExtractionPreset.Standard; - [LocalizedDisplayName(nameof(Resources.DocumentExtraction_Document_DisplayName))] - [LocalizedDescription(nameof(Resources.DocumentExtraction_Document_Description))] - [LocalizedCategory(nameof(Resources.Input_Category))] - [RequiredArgument] - public InArgument Document { get; set; } +// [LocalizedDisplayName(nameof(Resources.DocumentExtraction_Document_DisplayName))] +// [LocalizedDescription(nameof(Resources.DocumentExtraction_Document_Description))] +// [LocalizedCategory(nameof(Resources.Input_Category))] +// [RequiredArgument] +// public InArgument Document { get; set; } - [LocalizedDisplayName(nameof(Resources.DocumentExtraction_Results_DisplayName))] - [LocalizedDescription(nameof(Resources.DocumentExtraction_Results_Description))] - [LocalizedCategory(nameof(Resources.Output_Category))] - public OutArgument Results { get; set; } +// [LocalizedDisplayName(nameof(Resources.DocumentExtraction_Results_DisplayName))] +// [LocalizedDescription(nameof(Resources.DocumentExtraction_Results_Description))] +// [LocalizedCategory(nameof(Resources.Output_Category))] +// public OutArgument Results { get; set; } - protected override (DocumentExtractionPreset Preset, string Document) GetInputs(AsyncCodeActivityContext ctx) => - (Preset.Get(ctx), Document.Get(ctx)); +// protected override (DocumentExtractionPreset Preset, string Document) GetInputs(AsyncCodeActivityContext ctx) => +// (Preset.Get(ctx), Document.Get(ctx)); - protected override async Task ExecuteAsync((DocumentExtractionPreset Preset, string Document) input, CancellationToken cancellationToken) - => await Application.ExtractDocument(input.Document, input.Preset, cancellationToken); +// protected override async Task ExecuteAsync((DocumentExtractionPreset Preset, string Document) input, CancellationToken cancellationToken) +// => await Application.ExtractDocument(input.Document, input.Preset, cancellationToken); - protected override void SetOutputs(AsyncCodeActivityContext ctx, string output) => Results.Set(ctx, output); - } -} +// protected override void SetOutputs(AsyncCodeActivityContext ctx, string output) => Results.Set(ctx, output); +// } +//} diff --git a/Indico.RPAActivities/Indico.RPAActivities.Activities/Activities/GenerateSubmissionResult.cs b/Indico.RPAActivities/Indico.RPAActivities.Activities/Activities/GenerateSubmissionResult.cs index 7e97633..ae3488b 100644 --- a/Indico.RPAActivities/Indico.RPAActivities.Activities/Activities/GenerateSubmissionResult.cs +++ b/Indico.RPAActivities/Indico.RPAActivities.Activities/Activities/GenerateSubmissionResult.cs @@ -1,38 +1,38 @@ -using System.Activities; -using System.Threading; -using System.Threading.Tasks; -using Indico.RPAActivities.Activities.Activities; -using Newtonsoft.Json.Linq; -using Indico.RPAActivities.Activities.Properties; -using UiPath.Shared.Activities.Localization; -using IndicoV2.Submissions.Models; -using System; +//using System.Activities; +//using System.Threading; +//using System.Threading.Tasks; +//using Indico.RPAActivities.Activities.Activities; +//using Newtonsoft.Json.Linq; +//using Indico.RPAActivities.Activities.Properties; +//using UiPath.Shared.Activities.Localization; +//using IndicoV2.Submissions.Models; +//using System; -namespace Indico.RPAActivities.Activities -{ - [LocalizedCategory(nameof(Resources.SubmissionCategory))] - [LocalizedDisplayName(nameof(Resources.GenerateSubmissionResult_DisplayName))] - [LocalizedDescription(nameof(Resources.GenerateSubmissionResult_Description))] - public class GenerateSubmissionResult : IndicoActivityBase - { - [LocalizedDisplayName(nameof(Resources.GenerateSubmissionResult_SubmissionID_DisplayName))] - [LocalizedDescription(nameof(Resources.GenerateSubmissionResult_SubmissionID_Description))] - [LocalizedCategory(nameof(Resources.Input_Category))] - [RequiredArgument] - public InArgument SubmissionID { get; set; } +//namespace Indico.RPAActivities.Activities +//{ +// [LocalizedCategory(nameof(Resources.SubmissionCategory))] +// [LocalizedDisplayName(nameof(Resources.GenerateSubmissionResult_DisplayName))] +// [LocalizedDescription(nameof(Resources.GenerateSubmissionResult_Description))] +// public class GenerateSubmissionResult : IndicoActivityBase +// { +// [LocalizedDisplayName(nameof(Resources.GenerateSubmissionResult_SubmissionID_DisplayName))] +// [LocalizedDescription(nameof(Resources.GenerateSubmissionResult_SubmissionID_Description))] +// [LocalizedCategory(nameof(Resources.Input_Category))] +// [RequiredArgument] +// public InArgument SubmissionID { get; set; } - [LocalizedDisplayName(nameof(Resources.GenerateSubmissionResult_Result_DisplayName))] - [LocalizedDescription(nameof(Resources.GenerateSubmissionResult_Result_Description))] - [LocalizedCategory(nameof(Resources.Output_Category))] - public OutArgument Result { get; set; } +// [LocalizedDisplayName(nameof(Resources.GenerateSubmissionResult_Result_DisplayName))] +// [LocalizedDescription(nameof(Resources.GenerateSubmissionResult_Result_Description))] +// [LocalizedCategory(nameof(Resources.Output_Category))] +// public OutArgument Result { get; set; } - protected override int GetInputs(AsyncCodeActivityContext ctx) => - SubmissionID.Get(ctx); +// protected override int GetInputs(AsyncCodeActivityContext ctx) => +// SubmissionID.Get(ctx); - protected override Task ExecuteAsync(int input, CancellationToken cancellationToken) => - Application.GenerateSubmissionResult(input, cancellationToken); +// protected override Task ExecuteAsync(int input, CancellationToken cancellationToken) => +// Application.GenerateSubmissionResult(input, cancellationToken); - protected override void SetOutputs(AsyncCodeActivityContext ctx, string output) => Result.Set(ctx, output); - } -} +// protected override void SetOutputs(AsyncCodeActivityContext ctx, string output) => Result.Set(ctx, output); +// } +//} diff --git a/Indico.RPAActivities/Indico.RPAActivities.Activities/Activities/IndicoScope.cs b/Indico.RPAActivities/Indico.RPAActivities.Activities/Activities/IndicoScope.cs index 1cca687..5b1a60c 100644 --- a/Indico.RPAActivities/Indico.RPAActivities.Activities/Activities/IndicoScope.cs +++ b/Indico.RPAActivities/Indico.RPAActivities.Activities/Activities/IndicoScope.cs @@ -8,7 +8,7 @@ namespace Indico.RPAActivities.Activities { - [LocalizedCategory(nameof(Resources.RootCategory))] + [LocalizedDisplayName(nameof(Resources.IndicoScope_DisplayName))] [LocalizedDescription(nameof(Resources.IndicoScope_Description))] public class IndicoScope : NativeActivity diff --git a/Indico.RPAActivities/Indico.RPAActivities.Activities/Activities/ListDatasets.cs b/Indico.RPAActivities/Indico.RPAActivities.Activities/Activities/ListDatasets.cs index 697f0db..2e8f81d 100644 --- a/Indico.RPAActivities/Indico.RPAActivities.Activities/Activities/ListDatasets.cs +++ b/Indico.RPAActivities/Indico.RPAActivities.Activities/Activities/ListDatasets.cs @@ -1,32 +1,32 @@ -using System.Activities; -using System.Threading; -using System.Threading.Tasks; -using System.Collections.Generic; -using System.Linq; -using Indico.RPAActivities.Activities.Activities; -using Indico.RPAActivities.Activities.Properties; -using UiPath.Shared.Activities.Localization; -using IndicoV2.DataSets.Models; +//using System.Activities; +//using System.Threading; +//using System.Threading.Tasks; +//using System.Collections.Generic; +//using System.Linq; +//using Indico.RPAActivities.Activities.Activities; +//using Indico.RPAActivities.Activities.Properties; +//using UiPath.Shared.Activities.Localization; +//using IndicoV2.DataSets.Models; -namespace Indico.RPAActivities.Activities -{ - [LocalizedCategory(nameof(Resources.PreparationCategory))] - [LocalizedDisplayName(nameof(Resources.ListDatasets_DisplayName))] - [LocalizedDescription(nameof(Resources.ListDatasets_Description))] - public class ListDatasets : IndicoActivityBase> - { - [LocalizedDisplayName(nameof(Resources.ListDatasets_Datasets_DisplayName))] - [LocalizedDescription(nameof(Resources.ListDatasets_Datasets_Description))] - [LocalizedCategory(nameof(Resources.Output_Category))] - public OutArgument> Datasets { get; set; } +//namespace Indico.RPAActivities.Activities +//{ +// [LocalizedCategory(nameof(Resources.PreparationCategory))] +// [LocalizedDisplayName(nameof(Resources.ListDatasets_DisplayName))] +// [LocalizedDescription(nameof(Resources.ListDatasets_Description))] +// public class ListDatasets : IndicoActivityBase> +// { +// [LocalizedDisplayName(nameof(Resources.ListDatasets_Datasets_DisplayName))] +// [LocalizedDescription(nameof(Resources.ListDatasets_Datasets_Description))] +// [LocalizedCategory(nameof(Resources.Output_Category))] +// public OutArgument> Datasets { get; set; } - protected override bool GetInputs(AsyncCodeActivityContext ctx) => true; // no input, using dummy bool +// protected override bool GetInputs(AsyncCodeActivityContext ctx) => true; // no input, using dummy bool - protected override async Task> ExecuteAsync(bool input, CancellationToken cancellationToken) => - (await Application.ListDatasets(cancellationToken)).ToList(); +// protected override async Task> ExecuteAsync(bool input, CancellationToken cancellationToken) => +// (await Application.ListDatasets(cancellationToken)).ToList(); - protected override void SetOutputs(AsyncCodeActivityContext ctx, List output) => - Datasets.Set(ctx, output); - } -} +// protected override void SetOutputs(AsyncCodeActivityContext ctx, List output) => +// Datasets.Set(ctx, output); +// } +//} diff --git a/Indico.RPAActivities/Indico.RPAActivities.Activities/Activities/ListSubmissions.cs b/Indico.RPAActivities/Indico.RPAActivities.Activities/Activities/ListSubmissions.cs index a2916af..a120da3 100644 --- a/Indico.RPAActivities/Indico.RPAActivities.Activities/Activities/ListSubmissions.cs +++ b/Indico.RPAActivities/Indico.RPAActivities.Activities/Activities/ListSubmissions.cs @@ -11,7 +11,6 @@ namespace Indico.RPAActivities.Activities { - [LocalizedCategory(nameof(Resources.SubmissionCategory))] [LocalizedDisplayName(nameof(Resources.ListSubmissions_DisplayName))] [LocalizedDescription(nameof(Resources.ListSubmissions_Description))] public class ListSubmissions : IndicoActivityBase<(List WorkflowIds, List SubmissionIds, string InputFilename, SubmissionStatus? Status, bool? Retrieved, int Limit), List> @@ -51,22 +50,62 @@ public class ListSubmissions : IndicoActivityBase<(List WorkflowIds, List> Submissions { get; set; } + protected override void CacheMetadata(CodeActivityMetadata metadata) + { - protected override (List WorkflowIds, List SubmissionIds, string InputFilename, SubmissionStatus? Status, bool? Retrieved, int Limit) GetInputs(AsyncCodeActivityContext ctx) => - (WorkflowIDs.Get(ctx), SubmissionIDs.Get(ctx), InputFilename.Get(ctx), Status.Get(ctx), Retrieved.Get(ctx), Limit.Get(ctx)); + base.CacheMetadata(metadata); + } - protected override async Task> ExecuteAsync((List WorkflowIds, List SubmissionIds, string InputFilename, SubmissionStatus? Status, bool? Retrieved, int Limit) p, CancellationToken cancellationToken) + protected override async Task> ExecuteAsync(AsyncCodeActivityContext context, CancellationToken cancellationToken) { - return Task.Factory. + // Inputs + var timeout = TimeoutMS.Get(context); + + var cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); + cts.CancelAfter(timeout); + + // Set a timeout on the execution + var task = ExecuteWithTimeout(context, cts.Token); + var timer = Task.Delay(timeout, cts.Token); + var completedTask = await Task.WhenAny(task, timer); + if (completedTask == task) + { + // Outputs + return (ctx) => + { + Results(ctx, task.Result); + }; + } + + else + { + throw new TimeoutException(Resources.Timeout_Error); + } + + } - protected async Task> Execute((List WorkflowIds, List SubmissionIds, string InputFilename, SubmissionStatus? Status, bool? Retrieved, int Limit) p, CancellationToken cancellationToken) + protected void Results(AsyncCodeActivityContext context, IEnumerable result) { - return (await Application.ListSubmissions(p.SubmissionIds, p.WorkflowIds, p.InputFilename, p.Status, p.Retrieved, p.Limit, cancellationToken)).ToList(); + Submissions.Set(context,result?.ToList()); } + protected async Task> ExecuteWithTimeout(AsyncCodeActivityContext context, CancellationToken cancellationToken = default) + { + /////////////////////////// + // Add execution logic HERE + /////////////////////////// + /// + var submissionIds = SubmissionIDs.Get(context); + var workflowIds = WorkflowIDs.Get(context); + var retrieved = Retrieved.Get(context); + var limit = Limit.Get(context); + var inputFilename = InputFilename.Get(context); + var submissionStatus = Status.Get(context); + + return await Application.ListSubmissions(submissionIds, workflowIds, inputFilename, submissionStatus, retrieved, limit, cancellationToken); + } - protected override void SetOutputs(AsyncCodeActivityContext ctx, List submissions) => Submissions.Set(ctx, submissions); } } diff --git a/Indico.RPAActivities/Indico.RPAActivities.Activities/Activities/ListWithTimeout.cs b/Indico.RPAActivities/Indico.RPAActivities.Activities/Activities/ListWithTimeout.cs new file mode 100644 index 0000000..70e52d4 --- /dev/null +++ b/Indico.RPAActivities/Indico.RPAActivities.Activities/Activities/ListWithTimeout.cs @@ -0,0 +1,80 @@ +//using System; +//using System.Activities; +//using System.Threading; +//using System.Threading.Tasks; +//using Indico.RPAActivities.Activities.Properties; +//using UiPath.Shared.Activities; +//using UiPath.Shared.Activities.Localization; + +//namespace Indico.RPAActivities.Activities +//{ +// [LocalizedDisplayName(nameof(Resources.ListWithTimeout_DisplayName))] +// [LocalizedDescription(nameof(Resources.ListWithTimeout_Description))] +// public class ListWithTimeout : ContinuableAsyncCodeActivity +// { +// #region Properties + +// /// +// /// If set, continue executing the remaining activities even if the current activity has failed. +// /// +// [LocalizedCategory(nameof(Resources.Common_Category))] +// [LocalizedDisplayName(nameof(Resources.ContinueOnError_DisplayName))] +// [LocalizedDescription(nameof(Resources.ContinueOnError_Description))] +// public override InArgument ContinueOnError { get; set; } + +// [LocalizedCategory(nameof(Resources.Common_Category))] +// [LocalizedDisplayName(nameof(Resources.Timeout_DisplayName))] +// [LocalizedDescription(nameof(Resources.Timeout_Description))] +// public InArgument TimeoutMS { get; set; } = 60000; + +// [LocalizedDisplayName(nameof(Resources.ListWithTimeout_One_DisplayName))] +// [LocalizedDescription(nameof(Resources.ListWithTimeout_One_Description))] +// [LocalizedCategory(nameof(Resources.Input_Category))] +// public InArgument One { get; set; } + +// #endregion + + +// #region Constructors + +// public ListWithTimeout() +// { +// } + +// #endregion + + +// #region Protected Methods + +// //protected override void CacheMetadata(CodeActivityMetadata metadata) +// //{ + +// // base.CacheMetadata(metadata); +// //} + +// //protected override async Task> ExecuteAsync(AsyncCodeActivityContext context, CancellationToken cancellationToken) +// //{ +// // // Inputs +// // var timeout = TimeoutMS.Get(context); +// // var one = One.Get(context); + +// // // Set a timeout on the execution +// // var task = ExecuteWithTimeout(context, cancellationToken); +// // if (await Task.WhenAny(task, Task.Delay(timeout, cancellationToken)) != task) throw new TimeoutException(Resources.Timeout_Error); + +// // // Outputs +// // return (ctx) => { +// // }; +// //} + +// //private async Task ExecuteWithTimeout(AsyncCodeActivityContext context, CancellationToken cancellationToken = default) +// //{ +// // /////////////////////////// +// // // Add execution logic HERE +// // /////////////////////////// +// //} + +// #endregion +// } +//} + diff --git a/Indico.RPAActivities/Indico.RPAActivities.Activities/Activities/ListWorkflows.cs b/Indico.RPAActivities/Indico.RPAActivities.Activities/Activities/ListWorkflows.cs index c858b95..84a0edd 100644 --- a/Indico.RPAActivities/Indico.RPAActivities.Activities/Activities/ListWorkflows.cs +++ b/Indico.RPAActivities/Indico.RPAActivities.Activities/Activities/ListWorkflows.cs @@ -1,36 +1,36 @@ -using System.Activities; -using System.Collections.Generic; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; -using Indico.RPAActivities.Activities.Activities; -using Indico.RPAActivities.Activities.Properties; -using UiPath.Shared.Activities.Localization; -using IndicoV2.Workflows.Models; +//using System.Activities; +//using System.Collections.Generic; +//using System.Linq; +//using System.Threading; +//using System.Threading.Tasks; +//using Indico.RPAActivities.Activities.Activities; +//using Indico.RPAActivities.Activities.Properties; +//using UiPath.Shared.Activities.Localization; +//using IndicoV2.Workflows.Models; -namespace Indico.RPAActivities.Activities -{ - [LocalizedCategory(nameof(Resources.WorkflowCategory))] - [LocalizedDisplayName(nameof(Resources.ListWorkflows_DisplayName))] - [LocalizedDescription(nameof(Resources.ListWorkflows_Description))] - public class ListWorkflows : IndicoActivityBase> - { - [LocalizedDisplayName(nameof(Resources.ListWorkflows_DatasetID_DisplayName))] - [LocalizedDescription(nameof(Resources.ListWorkflows_DatasetID_Description))] - [LocalizedCategory(nameof(Resources.Input_Category))] - [RequiredArgument] - public InArgument DatasetID { get; set; } +//namespace Indico.RPAActivities.Activities +//{ +// [LocalizedCategory(nameof(Resources.WorkflowCategory))] +// [LocalizedDisplayName(nameof(Resources.ListWorkflows_DisplayName))] +// [LocalizedDescription(nameof(Resources.ListWorkflows_Description))] +// public class ListWorkflows : IndicoActivityBase> +// { +// [LocalizedDisplayName(nameof(Resources.ListWorkflows_DatasetID_DisplayName))] +// [LocalizedDescription(nameof(Resources.ListWorkflows_DatasetID_Description))] +// [LocalizedCategory(nameof(Resources.Input_Category))] +// [RequiredArgument] +// public InArgument DatasetID { get; set; } - [LocalizedDisplayName(nameof(Resources.ListWorkflows_Workflows_DisplayName))] - [LocalizedDescription(nameof(Resources.ListWorkflows_Workflows_Description))] - [LocalizedCategory(nameof(Resources.Output_Category))] - public OutArgument> Workflows { get; set; } +// [LocalizedDisplayName(nameof(Resources.ListWorkflows_Workflows_DisplayName))] +// [LocalizedDescription(nameof(Resources.ListWorkflows_Workflows_Description))] +// [LocalizedCategory(nameof(Resources.Output_Category))] +// public OutArgument> Workflows { get; set; } - protected override int GetInputs(AsyncCodeActivityContext ctx) => DatasetID.Get(ctx); +// protected override int GetInputs(AsyncCodeActivityContext ctx) => DatasetID.Get(ctx); - protected override async Task> ExecuteAsync(int dataSetId, CancellationToken cancellationToken) => - (await Application.ListWorkflows(dataSetId, cancellationToken)).ToList(); +// protected override async Task> ExecuteAsync(int dataSetId, CancellationToken cancellationToken) => +// (await Application.ListWorkflows(dataSetId, cancellationToken)).ToList(); - protected override void SetOutputs(AsyncCodeActivityContext ctx, List output) => Workflows.Set(ctx, output); - } -} +// protected override void SetOutputs(AsyncCodeActivityContext ctx, List output) => Workflows.Set(ctx, output); +// } +//} diff --git a/Indico.RPAActivities/Indico.RPAActivities.Activities/Activities/SubmissionResult.cs b/Indico.RPAActivities/Indico.RPAActivities.Activities/Activities/SubmissionResult.cs index 123398a..2684587 100644 --- a/Indico.RPAActivities/Indico.RPAActivities.Activities/Activities/SubmissionResult.cs +++ b/Indico.RPAActivities/Indico.RPAActivities.Activities/Activities/SubmissionResult.cs @@ -1,42 +1,42 @@ -using System.Activities; -using System.Threading; -using System.Threading.Tasks; -using Indico.RPAActivities.Activities.Activities; -using Newtonsoft.Json.Linq; -using Indico.RPAActivities.Activities.Properties; -using UiPath.Shared.Activities.Localization; -using IndicoV2.Submissions.Models; +//using System.Activities; +//using System.Threading; +//using System.Threading.Tasks; +//using Indico.RPAActivities.Activities.Activities; +//using Newtonsoft.Json.Linq; +//using Indico.RPAActivities.Activities.Properties; +//using UiPath.Shared.Activities.Localization; +//using IndicoV2.Submissions.Models; -namespace Indico.RPAActivities.Activities -{ - [LocalizedCategory(nameof(Resources.SubmissionCategory))] - [LocalizedDisplayName(nameof(Resources.SubmissionResult_DisplayName))] - [LocalizedDescription(nameof(Resources.SubmissionResult_Description))] - public class SubmissionResult : IndicoActivityBase<(int SubmissionId, SubmissionStatus? CheckStatus), JObject> - { - [LocalizedDisplayName(nameof(Resources.SubmissionResult_SubmissionID_DisplayName))] - [LocalizedDescription(nameof(Resources.SubmissionResult_SubmissionID_Description))] - [LocalizedCategory(nameof(Resources.Input_Category))] - [RequiredArgument] - public InArgument SubmissionID { get; set; } +//namespace Indico.RPAActivities.Activities +//{ +// [LocalizedCategory(nameof(Resources.SubmissionCategory))] +// [LocalizedDisplayName(nameof(Resources.SubmissionResult_DisplayName))] +// [LocalizedDescription(nameof(Resources.SubmissionResult_Description))] +// public class SubmissionResult : IndicoActivityBase<(int SubmissionId, SubmissionStatus? CheckStatus), JObject> +// { +// [LocalizedDisplayName(nameof(Resources.SubmissionResult_SubmissionID_DisplayName))] +// [LocalizedDescription(nameof(Resources.SubmissionResult_SubmissionID_Description))] +// [LocalizedCategory(nameof(Resources.Input_Category))] +// [RequiredArgument] +// public InArgument SubmissionID { get; set; } - [LocalizedDisplayName(nameof(Resources.SubmissionResult_CheckStatus_DisplayName))] - [LocalizedDescription(nameof(Resources.SubmissionResult_CheckStatus_Description))] - [LocalizedCategory(nameof(Resources.Input_Category))] - public InArgument CheckStatus { get; set; } +// [LocalizedDisplayName(nameof(Resources.SubmissionResult_CheckStatus_DisplayName))] +// [LocalizedDescription(nameof(Resources.SubmissionResult_CheckStatus_Description))] +// [LocalizedCategory(nameof(Resources.Input_Category))] +// public InArgument CheckStatus { get; set; } - [LocalizedDisplayName(nameof(Resources.SubmissionResult_Result_DisplayName))] - [LocalizedDescription(nameof(Resources.SubmissionResult_Result_Description))] - [LocalizedCategory(nameof(Resources.Output_Category))] - public OutArgument Result { get; set; } +// [LocalizedDisplayName(nameof(Resources.SubmissionResult_Result_DisplayName))] +// [LocalizedDescription(nameof(Resources.SubmissionResult_Result_Description))] +// [LocalizedCategory(nameof(Resources.Output_Category))] +// public OutArgument Result { get; set; } - protected override (int SubmissionId, SubmissionStatus? CheckStatus) GetInputs(AsyncCodeActivityContext ctx) => - (SubmissionID.Get(ctx), CheckStatus.Get(ctx)); +// protected override (int SubmissionId, SubmissionStatus? CheckStatus) GetInputs(AsyncCodeActivityContext ctx) => +// (SubmissionID.Get(ctx), CheckStatus.Get(ctx)); - protected override Task ExecuteAsync((int SubmissionId, SubmissionStatus? CheckStatus) input, CancellationToken cancellationToken) => - Application.SubmissionResult(input.SubmissionId, input.CheckStatus, cancellationToken); +// protected override Task ExecuteAsync((int SubmissionId, SubmissionStatus? CheckStatus) input, CancellationToken cancellationToken) => +// Application.SubmissionResult(input.SubmissionId, input.CheckStatus, cancellationToken); - protected override void SetOutputs(AsyncCodeActivityContext ctx, JObject output) => Result.Set(ctx, output); - } -} +// protected override void SetOutputs(AsyncCodeActivityContext ctx, JObject output) => Result.Set(ctx, output); +// } +//} diff --git a/Indico.RPAActivities/Indico.RPAActivities.Activities/Activities/SubmitReview.cs b/Indico.RPAActivities/Indico.RPAActivities.Activities/Activities/SubmitReview.cs index 7c599c6..ca48b34 100644 --- a/Indico.RPAActivities/Indico.RPAActivities.Activities/Activities/SubmitReview.cs +++ b/Indico.RPAActivities/Indico.RPAActivities.Activities/Activities/SubmitReview.cs @@ -1,51 +1,51 @@ -using System.Activities; -using System.Threading; -using System.Threading.Tasks; -using Indico.RPAActivities.Activities.Activities; -using Newtonsoft.Json.Linq; -using Indico.RPAActivities.Activities.Properties; -using UiPath.Shared.Activities.Localization; - -namespace Indico.RPAActivities.Activities -{ - [LocalizedCategory(nameof(Resources.SubmissionCategory))] - [LocalizedDisplayName(nameof(Resources.SubmitReview_DisplayName))] - [LocalizedDescription(nameof(Resources.SubmitReview_Description))] - public class SubmitReview : IndicoActivityBase<(int SubmissionId, JObject Changes, bool Rejected, bool? ForceComplete), JObject> - { - [LocalizedDisplayName(nameof(Resources.SubmitReview_SubmissionID_DisplayName))] - [LocalizedDescription(nameof(Resources.SubmitReview_SubmissionID_Description))] - [LocalizedCategory(nameof(Resources.Input_Category))] - [RequiredArgument] - public InArgument SubmissionID { get; set; } - - [LocalizedDisplayName(nameof(Resources.SubmitReview_Changes_DisplayName))] - [LocalizedDescription(nameof(Resources.SubmitReview_Changes_Description))] - [LocalizedCategory(nameof(Resources.Input_Category))] - public InArgument Changes { get; set; } - - [LocalizedDisplayName(nameof(Resources.SubmitReview_Rejected_DisplayName))] - [LocalizedDescription(nameof(Resources.SubmitReview_Rejected_Description))] - [LocalizedCategory(nameof(Resources.Input_Category))] - public InArgument Rejected { get; set; } = false; - - [LocalizedDisplayName(nameof(Resources.SubmitReview_ForceComplete_DisplayName))] - [LocalizedDescription(nameof(Resources.SubmitReview_ForceComplete_Description))] - [LocalizedCategory(nameof(Resources.Input_Category))] - public InArgument ForceComplete { get; set; } - - [LocalizedDisplayName(nameof(Resources.SubmitReview_Result_DisplayName))] - [LocalizedDescription(nameof(Resources.SubmitReview_Result_Description))] - [LocalizedCategory(nameof(Resources.Output_Category))] - public OutArgument Result { get; set; } +//using System.Activities; +//using System.Threading; +//using System.Threading.Tasks; +//using Indico.RPAActivities.Activities.Activities; +//using Newtonsoft.Json.Linq; +//using Indico.RPAActivities.Activities.Properties; +//using UiPath.Shared.Activities.Localization; + +//namespace Indico.RPAActivities.Activities +//{ +// [LocalizedCategory(nameof(Resources.SubmissionCategory))] +// [LocalizedDisplayName(nameof(Resources.SubmitReview_DisplayName))] +// [LocalizedDescription(nameof(Resources.SubmitReview_Description))] +// public class SubmitReview : IndicoActivityBase<(int SubmissionId, JObject Changes, bool Rejected, bool? ForceComplete), JObject> +// { +// [LocalizedDisplayName(nameof(Resources.SubmitReview_SubmissionID_DisplayName))] +// [LocalizedDescription(nameof(Resources.SubmitReview_SubmissionID_Description))] +// [LocalizedCategory(nameof(Resources.Input_Category))] +// [RequiredArgument] +// public InArgument SubmissionID { get; set; } + +// [LocalizedDisplayName(nameof(Resources.SubmitReview_Changes_DisplayName))] +// [LocalizedDescription(nameof(Resources.SubmitReview_Changes_Description))] +// [LocalizedCategory(nameof(Resources.Input_Category))] +// public InArgument Changes { get; set; } + +// [LocalizedDisplayName(nameof(Resources.SubmitReview_Rejected_DisplayName))] +// [LocalizedDescription(nameof(Resources.SubmitReview_Rejected_Description))] +// [LocalizedCategory(nameof(Resources.Input_Category))] +// public InArgument Rejected { get; set; } = false; + +// [LocalizedDisplayName(nameof(Resources.SubmitReview_ForceComplete_DisplayName))] +// [LocalizedDescription(nameof(Resources.SubmitReview_ForceComplete_Description))] +// [LocalizedCategory(nameof(Resources.Input_Category))] +// public InArgument ForceComplete { get; set; } + +// [LocalizedDisplayName(nameof(Resources.SubmitReview_Result_DisplayName))] +// [LocalizedDescription(nameof(Resources.SubmitReview_Result_Description))] +// [LocalizedCategory(nameof(Resources.Output_Category))] +// public OutArgument Result { get; set; } - protected override (int SubmissionId, JObject Changes, bool Rejected, bool? ForceComplete) GetInputs(AsyncCodeActivityContext ctx) - => (SubmissionID.Get(ctx), Changes.Get(ctx), Rejected.Get(ctx), ForceComplete.Get(ctx)); +// protected override (int SubmissionId, JObject Changes, bool Rejected, bool? ForceComplete) GetInputs(AsyncCodeActivityContext ctx) +// => (SubmissionID.Get(ctx), Changes.Get(ctx), Rejected.Get(ctx), ForceComplete.Get(ctx)); - protected override Task ExecuteAsync((int SubmissionId, JObject Changes, bool Rejected, bool? ForceComplete) input, CancellationToken cancellationToken) - => Application.SubmitReview(input.SubmissionId, input.Changes, input.Rejected, input.ForceComplete, cancellationToken); +// protected override Task ExecuteAsync((int SubmissionId, JObject Changes, bool Rejected, bool? ForceComplete) input, CancellationToken cancellationToken) +// => Application.SubmitReview(input.SubmissionId, input.Changes, input.Rejected, input.ForceComplete, cancellationToken); - protected override void SetOutputs(AsyncCodeActivityContext ctx, JObject output) => Result.Set(ctx, output); - } -} +// protected override void SetOutputs(AsyncCodeActivityContext ctx, JObject output) => Result.Set(ctx, output); +// } +//} diff --git a/Indico.RPAActivities/Indico.RPAActivities.Activities/Activities/WorkflowSubmission.cs b/Indico.RPAActivities/Indico.RPAActivities.Activities/Activities/WorkflowSubmission.cs index 4216c23..e50ef3b 100644 --- a/Indico.RPAActivities/Indico.RPAActivities.Activities/Activities/WorkflowSubmission.cs +++ b/Indico.RPAActivities/Indico.RPAActivities.Activities/Activities/WorkflowSubmission.cs @@ -1,68 +1,68 @@ -using System.Activities; -using System.Threading; -using System.Threading.Tasks; -using System.Collections.Generic; -using Indico.RPAActivities.Activities.Activities; -using Indico.RPAActivities.Activities.Properties; -using System.Linq; -using System; -using UiPath.Shared.Activities.Localization; +//using System.Activities; +//using System.Threading; +//using System.Threading.Tasks; +//using System.Collections.Generic; +//using Indico.RPAActivities.Activities.Activities; +//using Indico.RPAActivities.Activities.Properties; +//using System.Linq; +//using System; +//using UiPath.Shared.Activities.Localization; -namespace Indico.RPAActivities.Activities -{ - [LocalizedCategory(nameof(Resources.WorkflowCategory))] - [LocalizedDisplayName(nameof(Resources.WorkflowSubmission_DisplayName))] - [LocalizedDescription(nameof(Resources.WorkflowSubmission_Description))] - public class WorkflowSubmission : IndicoActivityBase<(int WorkflowId, List FilePaths, List Urls), List> - { - [LocalizedDisplayName(nameof(Resources.WorkflowSubmission_WorkflowID_DisplayName))] - [LocalizedDescription(nameof(Resources.WorkflowSubmission_WorkflowID_Description))] - [LocalizedCategory(nameof(Resources.Input_Category))] - [RequiredArgument] - public InArgument WorkflowID { get; set; } +//namespace Indico.RPAActivities.Activities +//{ +// [LocalizedCategory(nameof(Resources.WorkflowCategory))] +// [LocalizedDisplayName(nameof(Resources.WorkflowSubmission_DisplayName))] +// [LocalizedDescription(nameof(Resources.WorkflowSubmission_Description))] +// public class WorkflowSubmission : IndicoActivityBase<(int WorkflowId, List FilePaths, List Urls), List> +// { +// [LocalizedDisplayName(nameof(Resources.WorkflowSubmission_WorkflowID_DisplayName))] +// [LocalizedDescription(nameof(Resources.WorkflowSubmission_WorkflowID_Description))] +// [LocalizedCategory(nameof(Resources.Input_Category))] +// [RequiredArgument] +// public InArgument WorkflowID { get; set; } - [LocalizedDisplayName(nameof(Resources.WorkflowSubmission_FilePaths_DisplayName))] - [LocalizedDescription(nameof(Resources.WorkflowSubmission_FilePaths_Description))] - [LocalizedCategory(nameof(Resources.Input_Category))] - public InArgument> FilePaths { get; set; } +// [LocalizedDisplayName(nameof(Resources.WorkflowSubmission_FilePaths_DisplayName))] +// [LocalizedDescription(nameof(Resources.WorkflowSubmission_FilePaths_Description))] +// [LocalizedCategory(nameof(Resources.Input_Category))] +// public InArgument> FilePaths { get; set; } - [LocalizedDisplayName(nameof(Resources.WorkflowSubmission_Urls_DisplayName))] - [LocalizedDescription(nameof(Resources.WorkflowSubmission_Urls_Description))] - [LocalizedCategory(nameof(Resources.Input_Category))] - public InArgument> Urls { get; set; } +// [LocalizedDisplayName(nameof(Resources.WorkflowSubmission_Urls_DisplayName))] +// [LocalizedDescription(nameof(Resources.WorkflowSubmission_Urls_Description))] +// [LocalizedCategory(nameof(Resources.Input_Category))] +// public InArgument> Urls { get; set; } - [LocalizedDisplayName(nameof(Resources.WorkflowSubmission_SubmissionIDs_DisplayName))] - [LocalizedDescription(nameof(Resources.WorkflowSubmission_SubmissionIDs_Description))] - [LocalizedCategory(nameof(Resources.Output_Category))] - public OutArgument> SubmissionIDs { get; set; } +// [LocalizedDisplayName(nameof(Resources.WorkflowSubmission_SubmissionIDs_DisplayName))] +// [LocalizedDescription(nameof(Resources.WorkflowSubmission_SubmissionIDs_Description))] +// [LocalizedCategory(nameof(Resources.Output_Category))] +// public OutArgument> SubmissionIDs { get; set; } - protected override (int WorkflowId, List FilePaths, List Urls) GetInputs(AsyncCodeActivityContext ctx) - => (WorkflowID.Get(ctx), FilePaths.Get(ctx), Urls.Get(ctx)); +// protected override (int WorkflowId, List FilePaths, List Urls) GetInputs(AsyncCodeActivityContext ctx) +// => (WorkflowID.Get(ctx), FilePaths.Get(ctx), Urls.Get(ctx)); - protected override async Task> ExecuteAsync((int WorkflowId, List FilePaths, List Urls) input, CancellationToken cancellationToken) - { - var filePathsProvided = ValuesProvided(input.FilePaths); - var urisProvided = ValuesProvided(input.Urls); +// protected override async Task> ExecuteAsync((int WorkflowId, List FilePaths, List Urls) input, CancellationToken cancellationToken) +// { +// var filePathsProvided = ValuesProvided(input.FilePaths); +// var urisProvided = ValuesProvided(input.Urls); - if (filePathsProvided && urisProvided || !filePathsProvided && !urisProvided) - { - throw new ArgumentException(string.Format(Resources.ValidationExclusiveProperties_Error, nameof(FilePaths), nameof(Urls))); - } +// if (filePathsProvided && urisProvided || !filePathsProvided && !urisProvided) +// { +// throw new ArgumentException(string.Format(Resources.ValidationExclusiveProperties_Error, nameof(FilePaths), nameof(Urls))); +// } - return (await Application.WorkflowSubmission(input.WorkflowId, input.FilePaths, input.Urls, cancellationToken)).ToList(); - } +// return (await Application.WorkflowSubmission(input.WorkflowId, input.FilePaths, input.Urls, cancellationToken)).ToList(); +// } - private bool ValuesProvided(IEnumerable enumerable) - { - if (enumerable == null || !enumerable.Any()) - { - return true; - } +// private bool ValuesProvided(IEnumerable enumerable) +// { +// if (enumerable == null || !enumerable.Any()) +// { +// return true; +// } - return false; - } +// return false; +// } - protected override void SetOutputs(AsyncCodeActivityContext ctx, List output) => SubmissionIDs.Set(ctx, output); - } -} +// protected override void SetOutputs(AsyncCodeActivityContext ctx, List output) => SubmissionIDs.Set(ctx, output); +// } +//} diff --git a/Indico.RPAActivities/Indico.RPAActivities.Activities/Properties/Resources.Designer.cs b/Indico.RPAActivities/Indico.RPAActivities.Activities/Properties/Resources.Designer.cs index ecadf82..e0d9e33 100644 --- a/Indico.RPAActivities/Indico.RPAActivities.Activities/Properties/Resources.Designer.cs +++ b/Indico.RPAActivities/Indico.RPAActivities.Activities/Properties/Resources.Designer.cs @@ -19,7 +19,7 @@ namespace Indico.RPAActivities.Activities.Properties { // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] public class Resources { @@ -78,6 +78,24 @@ public static string Common_Category { } } + /// + /// Looks up a localized string similar to Continue this flow on error. + /// + public static string ContinueOnError_Description { + get { + return ResourceManager.GetString("ContinueOnError_Description", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Continue On Error. + /// + public static string ContinueOnError_DisplayName { + get { + return ResourceManager.GetString("ContinueOnError_DisplayName", resourceCulture); + } + } + /// /// Looks up a localized string similar to Do. /// @@ -582,6 +600,42 @@ public static string ListSubmissions_WorkflowIDs_DisplayName { } } + /// + /// Looks up a localized string similar to test. + /// + public static string ListWithTimeout_Description { + get { + return ResourceManager.GetString("ListWithTimeout_Description", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to ListWithTimeout. + /// + public static string ListWithTimeout_DisplayName { + get { + return ResourceManager.GetString("ListWithTimeout_DisplayName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to One. + /// + public static string ListWithTimeout_One_Description { + get { + return ResourceManager.GetString("ListWithTimeout_One_Description", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to One. + /// + public static string ListWithTimeout_One_DisplayName { + get { + return ResourceManager.GetString("ListWithTimeout_One_DisplayName", resourceCulture); + } + } + /// /// Looks up a localized string similar to ID of dataset to query. /// diff --git a/Indico.RPAActivities/Indico.RPAActivities.Activities/Properties/Resources.resx b/Indico.RPAActivities/Indico.RPAActivities.Activities/Properties/Resources.resx index dc0f455..0b21f74 100644 --- a/Indico.RPAActivities/Indico.RPAActivities.Activities/Properties/Resources.resx +++ b/Indico.RPAActivities/Indico.RPAActivities.Activities/Properties/Resources.resx @@ -549,4 +549,28 @@ SubmissionID property name + + ListWithTimeout + activity name + + + test + activity description + + + One + property name + + + One + property description + + + Continue this flow on error + property description + + + Continue On Error + property name + \ No newline at end of file diff --git a/Indico.RPAActivities/Indico.RPAActivities.IntegrationTests/Helpers/TaskActivityExtensions.cs b/Indico.RPAActivities/Indico.RPAActivities.IntegrationTests/Helpers/TaskActivityExtensions.cs index 2d325de..e63bf0a 100644 --- a/Indico.RPAActivities/Indico.RPAActivities.IntegrationTests/Helpers/TaskActivityExtensions.cs +++ b/Indico.RPAActivities/Indico.RPAActivities.IntegrationTests/Helpers/TaskActivityExtensions.cs @@ -16,27 +16,27 @@ internal static class TaskActivityExtensions private static string BaseUrl => Environment.GetEnvironmentVariable("INDICO_HOST"); private static string ApiToken => Environment.GetEnvironmentVariable("INDICO_TOKEN"); - public static List Invoke(this ListDatasets listDataSetsActivity) => - listDataSetsActivity.Invoke>((lds, output) => lds.Datasets = output); + //public static List Invoke(this ListDatasets listDataSetsActivity) => + // listDataSetsActivity.Invoke>((lds, output) => lds.Datasets = output); - public static List Invoke(this ListWorkflows listWorkflowsActivity) => - listWorkflowsActivity.Invoke>((a, output) => a.Workflows = output); + //public static List Invoke(this ListWorkflows listWorkflowsActivity) => + // listWorkflowsActivity.Invoke>((a, output) => a.Workflows = output); - public static List Invoke(this WorkflowSubmission workflowSubmissionActivity) => - workflowSubmissionActivity - .Invoke>((a, output) => a.SubmissionIDs = output); + //public static List Invoke(this WorkflowSubmission workflowSubmissionActivity) => + // workflowSubmissionActivity + //.Invoke>((a, output) => a.SubmissionIDs = output); public static List Invoke(this ListSubmissions listSubmissions) => listSubmissions.Invoke>((a, outArg) => a.Submissions = outArg); - public static JObject Invoke(this SubmissionResult submissionResultActivity) => - submissionResultActivity.Invoke((a, outArg) => a.Result = outArg); + //public static JObject Invoke(this SubmissionResult submissionResultActivity) => + // submissionResultActivity.Invoke((a, outArg) => a.Result = outArg); - public static JObject Invoke(this SubmitReview submitReviewActivity) => - submitReviewActivity.Invoke((a, outArg) => a.Result = outArg); + //public static JObject Invoke(this SubmitReview submitReviewActivity) => + // submitReviewActivity.Invoke((a, outArg) => a.Result = outArg); - public static string Invoke(this DocumentExtraction documentExtractionActivity) => - documentExtractionActivity.Invoke((a, outArg) => a.Results = outArg); + //public static string Invoke(this DocumentExtraction documentExtractionActivity) => + // documentExtractionActivity.Invoke((a, outArg) => a.Results = outArg); public static TOutput Invoke(this TActivity activity, Action> setOutput) where TActivity : Activity diff --git a/Indico.RPAActivities/Indico.RPAActivities/Application.cs b/Indico.RPAActivities/Indico.RPAActivities/Application.cs index 8d04f6d..dff4a49 100644 --- a/Indico.RPAActivities/Indico.RPAActivities/Application.cs +++ b/Indico.RPAActivities/Indico.RPAActivities/Application.cs @@ -86,6 +86,7 @@ public async Task GenerateSubmissionResult(int submissionId, Cancellatio public Task> ListSubmissions(List submissionIds, List workflowIds, string inputFilename, SubmissionStatus? status, bool? retrieved, int limit, CancellationToken cancellationToken = default) { + if (string.IsNullOrWhiteSpace(inputFilename)) { inputFilename = null;