| | | 1 | | using Elsa.Workflows.Runtime.Entities; |
| | | 2 | | |
| | | 3 | | namespace Elsa.Workflows.Runtime.Filters; |
| | | 4 | | |
| | | 5 | | /// <summary> |
| | | 6 | | /// A filter for bookmark queue dead-letter items. |
| | | 7 | | /// </summary> |
| | | 8 | | public class BookmarkQueueDeadLetterFilter |
| | | 9 | | { |
| | | 10 | | /// <summary> |
| | | 11 | | /// Gets or sets the ID of the dead-letter item. |
| | | 12 | | /// </summary> |
| | 53 | 13 | | public string? Id { get; set; } |
| | | 14 | | |
| | | 15 | | /// <summary> |
| | | 16 | | /// Gets or sets the IDs of the dead-letter items. |
| | | 17 | | /// </summary> |
| | 45 | 18 | | public IEnumerable<string>? Ids { get; set; } |
| | | 19 | | |
| | | 20 | | /// <summary> |
| | | 21 | | /// Gets or sets the original queue item ID. |
| | | 22 | | /// </summary> |
| | 43 | 23 | | public string? OriginalQueueItemId { get; set; } |
| | | 24 | | |
| | | 25 | | /// <summary> |
| | | 26 | | /// Gets or sets the original queue item IDs. |
| | | 27 | | /// </summary> |
| | 58 | 28 | | public IEnumerable<string>? OriginalQueueItemIds { get; set; } |
| | | 29 | | |
| | | 30 | | /// <summary> |
| | | 31 | | /// Gets or sets the ID of the workflow instance. |
| | | 32 | | /// </summary> |
| | 43 | 33 | | public string? WorkflowInstanceId { get; set; } |
| | | 34 | | |
| | | 35 | | /// <summary> |
| | | 36 | | /// The timestamp less than which the dead-letter item was created. |
| | | 37 | | /// </summary> |
| | 63 | 38 | | public DateTimeOffset? DeadLetteredAtLessThan { get; set; } |
| | | 39 | | |
| | | 40 | | /// <summary> |
| | | 41 | | /// Gets or sets a value indicating whether the filter is tenant agnostic. |
| | | 42 | | /// </summary> |
| | 0 | 43 | | public bool TenantAgnostic { get; set; } |
| | | 44 | | |
| | | 45 | | /// <summary> |
| | | 46 | | /// Applies the filter to the specified query. |
| | | 47 | | /// </summary> |
| | | 48 | | public IQueryable<BookmarkQueueDeadLetterItem> Apply(IQueryable<BookmarkQueueDeadLetterItem> query) |
| | | 49 | | { |
| | 43 | 50 | | var filter = this; |
| | 48 | 51 | | if (filter.Id != null) query = query.Where(x => x.Id == filter.Id); |
| | 44 | 52 | | if (filter.Ids != null) query = query.Where(x => filter.Ids.Contains(x.Id)); |
| | 43 | 53 | | if (filter.OriginalQueueItemId != null) query = query.Where(x => x.OriginalQueueItemId == filter.OriginalQueueIt |
| | 55 | 54 | | if (filter.OriginalQueueItemIds != null) query = query.Where(x => filter.OriginalQueueItemIds.Contains(x.Origina |
| | 43 | 55 | | if (filter.WorkflowInstanceId != null) query = query.Where(x => x.WorkflowInstanceId == filter.WorkflowInstanceI |
| | 55 | 56 | | if (filter.DeadLetteredAtLessThan != null) query = query.Where(x => x.DeadLetteredAt < filter.DeadLetteredAtLess |
| | | 57 | | |
| | 43 | 58 | | return query; |
| | | 59 | | } |
| | | 60 | | } |