| | | 1 | | using Elsa.Workflows.Runtime.Entities; |
| | | 2 | | using Elsa.Workflows.Runtime.Options; |
| | | 3 | | |
| | | 4 | | namespace Elsa.Workflows.Runtime; |
| | | 5 | | |
| | | 6 | | /// <inheritdoc /> |
| | | 7 | | [Obsolete("Will be removed in a future version.")] |
| | 0 | 8 | | public class BookmarkBoundWorkflowService(IWorkflowMatcher workflowMatcher) : IBookmarkBoundWorkflowService |
| | | 9 | | { |
| | | 10 | | /// <inheritdoc /> |
| | | 11 | | public async Task<IEnumerable<BookmarkBoundWorkflow>> FindManyAsync(string activityTypeName, object stimulus, FindBo |
| | | 12 | | { |
| | 0 | 13 | | var bookmarks = await workflowMatcher.FindBookmarksAsync(activityTypeName, stimulus, options, cancellationToken) |
| | 0 | 14 | | return Map(bookmarks); |
| | 0 | 15 | | } |
| | | 16 | | |
| | | 17 | | /// <inheritdoc /> |
| | | 18 | | public async Task<IEnumerable<BookmarkBoundWorkflow>> FindManyAsync(string stimulusHash, FindBookmarkOptions? option |
| | | 19 | | { |
| | 0 | 20 | | var bookmarks = await workflowMatcher.FindBookmarksAsync(stimulusHash, options, cancellationToken); |
| | 0 | 21 | | return Map(bookmarks); |
| | 0 | 22 | | } |
| | | 23 | | |
| | | 24 | | private IEnumerable<BookmarkBoundWorkflow> Map(IEnumerable<StoredBookmark> bookmarks) |
| | | 25 | | { |
| | 0 | 26 | | var groupedBookmarks = bookmarks.GroupBy(x => x.WorkflowInstanceId); |
| | 0 | 27 | | var bookmarkBoundWorkflows = new List<BookmarkBoundWorkflow>(); |
| | | 28 | | |
| | 0 | 29 | | foreach (var bookmarkGroup in groupedBookmarks) |
| | | 30 | | { |
| | 0 | 31 | | var workflowInstanceId = bookmarkGroup.Key; |
| | 0 | 32 | | var bookmarkBoundWorkflow = new BookmarkBoundWorkflow(workflowInstanceId, bookmarkGroup.ToList()); |
| | 0 | 33 | | bookmarkBoundWorkflows.Add(bookmarkBoundWorkflow); |
| | | 34 | | } |
| | | 35 | | |
| | 0 | 36 | | return bookmarkBoundWorkflows; |
| | | 37 | | } |
| | | 38 | | } |