| | | 1 | | using Elsa.Workflows.Runtime.Entities; |
| | | 2 | | using Elsa.Workflows.Runtime.Extensions; |
| | | 3 | | using Elsa.Workflows.Runtime.Filters; |
| | | 4 | | using Elsa.Workflows.Runtime.Options; |
| | | 5 | | |
| | | 6 | | namespace Elsa.Workflows.Runtime; |
| | | 7 | | |
| | | 8 | | /// <inheritdoc /> |
| | 57 | 9 | | public class WorkflowMatcher(IStimulusHasher stimulusHasher, ITriggerStore triggerStore, IBookmarkStore bookmarkStore) : |
| | | 10 | | { |
| | | 11 | | /// <inheritdoc /> |
| | | 12 | | public Task<IEnumerable<StoredTrigger>> FindTriggersAsync(string activityTypeName, object stimulus, CancellationToke |
| | | 13 | | { |
| | 0 | 14 | | var hash = stimulusHasher.Hash(activityTypeName, stimulus); |
| | 0 | 15 | | return FindTriggersAsync(hash, cancellationToken); |
| | | 16 | | } |
| | | 17 | | |
| | | 18 | | /// <inheritdoc /> |
| | | 19 | | public async Task<IEnumerable<StoredTrigger>> FindTriggersAsync(string stimulusHash, CancellationToken cancellationT |
| | | 20 | | { |
| | 5 | 21 | | return await triggerStore.FindManyByStimulusHashAsync(stimulusHash, cancellationToken); |
| | 5 | 22 | | } |
| | | 23 | | |
| | | 24 | | /// <inheritdoc /> |
| | | 25 | | public Task<IEnumerable<StoredBookmark>> FindBookmarksAsync(string activityTypeName, object stimulus, FindBookmarkOp |
| | | 26 | | { |
| | 0 | 27 | | var hash = stimulusHasher.Hash(activityTypeName, stimulus, options?.ActivityInstanceId); |
| | 0 | 28 | | return FindBookmarksAsync(hash, options, cancellationToken); |
| | | 29 | | } |
| | | 30 | | |
| | | 31 | | /// <inheritdoc /> |
| | | 32 | | public async Task<IEnumerable<StoredBookmark>> FindBookmarksAsync(string stimulusHash, FindBookmarkOptions? options |
| | | 33 | | { |
| | 0 | 34 | | var correlationId = options?.CorrelationId; |
| | 0 | 35 | | var workflowInstanceId = options?.WorkflowInstanceId; |
| | 0 | 36 | | var activityInstanceId = options?.ActivityInstanceId; |
| | 0 | 37 | | var filter = new BookmarkFilter |
| | 0 | 38 | | { |
| | 0 | 39 | | Hash = stimulusHash, |
| | 0 | 40 | | CorrelationId = correlationId, |
| | 0 | 41 | | WorkflowInstanceId = workflowInstanceId, |
| | 0 | 42 | | ActivityInstanceId = activityInstanceId, |
| | 0 | 43 | | BookmarkId = options?.BookmarkId |
| | 0 | 44 | | }; |
| | 0 | 45 | | return await bookmarkStore.FindManyAsync(filter, cancellationToken); |
| | 0 | 46 | | } |
| | | 47 | | } |