| | | 1 | | using Elsa.Workflows.Runtime.Entities; |
| | | 2 | | |
| | | 3 | | namespace Elsa.Workflows.Runtime.Filters; |
| | | 4 | | |
| | | 5 | | /// <summary> |
| | | 6 | | /// A filter for bookmark queue items. |
| | | 7 | | /// </summary> |
| | | 8 | | public class BookmarkQueueFilter |
| | | 9 | | { |
| | | 10 | | /// <summary> |
| | | 11 | | /// Gets or sets the ID of the bookmark queue item. |
| | | 12 | | /// </summary> |
| | 55 | 13 | | public string? Id { get; set; } |
| | | 14 | | |
| | | 15 | | /// <summary> |
| | | 16 | | /// Gets or sets the IDs of the bookmark queue items. |
| | | 17 | | /// </summary> |
| | 18 | 18 | | public IEnumerable<string>? Ids { get; set; } |
| | | 19 | | |
| | | 20 | | /// <summary> |
| | | 21 | | /// Gets or sets the ID of the bookmark. |
| | | 22 | | /// </summary> |
| | 18 | 23 | | public string? BookmarkId { get; set; } |
| | | 24 | | |
| | | 25 | | /// <summary> |
| | | 26 | | /// Gets or sets the IDs of the workflow instance. |
| | | 27 | | /// </summary> |
| | 18 | 28 | | public string? WorkflowInstanceId { get; set; } |
| | | 29 | | |
| | | 30 | | /// <summary> |
| | | 31 | | /// Gets or sets the bookmark hash of the bookmark queue item to find. |
| | | 32 | | /// </summary> |
| | 18 | 33 | | public string? BookmarkHash { get; set; } |
| | | 34 | | |
| | | 35 | | /// <summary> |
| | | 36 | | /// The ID of the activity instance associated with the bookmark. |
| | | 37 | | /// </summary> |
| | 18 | 38 | | public string? ActivityInstanceId { get; set; } |
| | | 39 | | |
| | | 40 | | /// <summary> |
| | | 41 | | /// The type name of the activity associated with the bookmark. |
| | | 42 | | /// </summary> |
| | 18 | 43 | | public string? ActivityTypeName { get; set; } |
| | | 44 | | |
| | | 45 | | /// <summary> |
| | | 46 | | /// The timestamp less than which the bookmark queue item was created. |
| | | 47 | | /// </summary> |
| | 18 | 48 | | public DateTimeOffset? CreatedAtLessThan { get; set; } |
| | | 49 | | |
| | | 50 | | /// <summary> |
| | | 51 | | /// Gets or sets a value indicating whether the filter is tenant agnostic. |
| | | 52 | | /// </summary> |
| | 0 | 53 | | public bool TenantAgnostic { get; set; } |
| | | 54 | | |
| | | 55 | | /// <summary> |
| | | 56 | | /// Applies the filter to the specified query. |
| | | 57 | | /// </summary> |
| | | 58 | | public IQueryable<BookmarkQueueItem> Apply(IQueryable<BookmarkQueueItem> query) |
| | | 59 | | { |
| | 18 | 60 | | var filter = this; |
| | 36 | 61 | | if (filter.Id != null) query = query.Where(x => x.Id == filter.Id); |
| | 18 | 62 | | if (filter.Ids != null) query = query.Where(x => filter.Ids.Contains(x.Id)); |
| | 18 | 63 | | if (filter.BookmarkId != null) query = query.Where(x => x.BookmarkId == filter.BookmarkId); |
| | 18 | 64 | | if (filter.BookmarkHash != null) query = query.Where(x => x.StimulusHash == filter.BookmarkHash); |
| | 18 | 65 | | if (filter.ActivityInstanceId != null) query = query.Where(x => x.ActivityInstanceId == filter.ActivityInstanceI |
| | 18 | 66 | | if (filter.ActivityTypeName != null) query = query.Where(x => x.ActivityTypeName == filter.ActivityTypeName); |
| | 18 | 67 | | if (filter.WorkflowInstanceId != null) query = query.Where(x => x.WorkflowInstanceId == filter.WorkflowInstanceI |
| | 18 | 68 | | if (filter.CreatedAtLessThan != null) query = query.Where(x => x.CreatedAt < filter.CreatedAtLessThan); |
| | | 69 | | |
| | 18 | 70 | | return query; |
| | | 71 | | } |
| | | 72 | | } |