| | | 1 | | using System.ComponentModel; |
| | | 2 | | using System.Runtime.CompilerServices; |
| | | 3 | | using Elsa.Workflows.Attributes; |
| | | 4 | | using Elsa.Workflows.Exceptions; |
| | | 5 | | using JetBrains.Annotations; |
| | | 6 | | |
| | | 7 | | namespace Elsa.Workflows.Activities; |
| | | 8 | | |
| | | 9 | | /// <summary> |
| | | 10 | | /// This activity is instantiated in case a workflow references an activity type that could not be found. |
| | | 11 | | /// </summary> |
| | | 12 | | [Browsable(false)] |
| | | 13 | | [Activity("Elsa", "System", "A placeholder activity that will be used in case a workflow definition references an activi |
| | | 14 | | [PublicAPI] |
| | | 15 | | public class NotFoundActivity : CodeActivity |
| | | 16 | | { |
| | | 17 | | /// <inheritdoc /> |
| | 14 | 18 | | public NotFoundActivity([CallerFilePath] string? source = null, [CallerLineNumber] int? line = null) : base(source, |
| | | 19 | | { |
| | 14 | 20 | | } |
| | | 21 | | |
| | | 22 | | /// <inheritdoc /> |
| | 7 | 23 | | public NotFoundActivity(string missingTypeName, [CallerFilePath] string? source = null, [CallerLineNumber] int? line |
| | | 24 | | { |
| | 7 | 25 | | MissingTypeName = missingTypeName; |
| | 7 | 26 | | } |
| | | 27 | | |
| | | 28 | | /// <summary> |
| | | 29 | | /// The type name of the missing activity type. |
| | | 30 | | /// </summary> |
| | 28 | 31 | | public string MissingTypeName { get; set; } = null!; |
| | | 32 | | |
| | | 33 | | /// <summary> |
| | | 34 | | /// The version of the missing activity type. |
| | | 35 | | /// </summary> |
| | 28 | 36 | | public int MissingTypeVersion { get; set; } |
| | | 37 | | |
| | | 38 | | /// <summary> |
| | | 39 | | /// The original activity JSON. |
| | | 40 | | /// </summary> |
| | 14 | 41 | | public string OriginalActivityJson { get; set; } = null!; |
| | | 42 | | |
| | | 43 | | /// <inheritdoc /> |
| | | 44 | | protected override void Execute(ActivityExecutionContext context) |
| | | 45 | | { |
| | 7 | 46 | | throw new ActivityNotFoundException(MissingTypeName, MissingTypeVersion); |
| | | 47 | | } |
| | | 48 | | } |