Skip to content

Commit a9b9ae9

Browse files
authored
Merge pull request #732 from Project-MONAI/AC-2032-ReaddNotificationPreferences
AC-2032 Readded the notification preferences validation
2 parents 0833d1d + 8953e5b commit a9b9ae9

File tree

6 files changed

+1536
-1052
lines changed

6 files changed

+1536
-1052
lines changed

src/Shared/Shared/ValidationConstants.cs

+11
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,24 @@ public static class ValidationConstants
4848
/// </summary>
4949
public static readonly string Mode = "mode";
5050

51+
/// <summary>
52+
/// Key for the notifications.
53+
/// </summary>
54+
public static readonly string Notifications = "notifications";
55+
5156
public enum ModeValues
5257
{
5358
QA,
5459
Research,
5560
Clinical
5661
}
5762

63+
public enum NotificationValues
64+
{
65+
True,
66+
False
67+
}
68+
5869
/// <summary>
5970
/// Required arguments to run the clinical review task workflow args.
6071
/// </summary>

src/WorkflowManager/WorkflowManager/Validators/WorkflowValidator.cs

+10
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,16 @@ private void ValidateClinicalReviewRequiredFields(TaskObject[] tasks, TaskObject
407407
return;
408408
}
409409

410+
if (!currentTask.Args.ContainsKey(Notifications))
411+
{
412+
Errors.Add($"Task: '{currentTask.Id}' notifications must be specified.");
413+
return;
414+
}
415+
else if (!Enum.TryParse(typeof(NotificationValues), currentTask.Args[Notifications], true, out var _))
416+
{
417+
Errors.Add($"Task: '{currentTask.Id}' notifications is incorrectly specified{Comma}please specify 'true' or 'false'");
418+
}
419+
410420
var reviewedTask = tasks.First(t => t.Id.ToLower() == currentTask.Args[ReviewedTaskId].ToLower());
411421

412422
if (reviewedTask.Type.Equals(ArgoTaskType, StringComparison.OrdinalIgnoreCase) is false)

0 commit comments

Comments
 (0)