< Summary

Information
Class: Elsa.Workflows.Runtime.Filters.ActivityExecutionRecordFilter
Assembly: Elsa.Workflows.Runtime
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Runtime/Filters/ActivityExecutionRecordFilter.cs
Line coverage
67%
Covered lines: 42
Uncovered lines: 20
Coverable lines: 62
Total lines: 165
Line coverage: 67.7%
Branch coverage
38%
Covered branches: 36
Total branches: 94
Branch coverage: 38.2%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_Id()100%11100%
get_Ids()100%11100%
get_WorkflowInstanceId()100%11100%
get_WorkflowInstanceIds()100%11100%
get_ActivityId()100%11100%
get_ActivityIds()100%11100%
get_ActivityNodeId()100%11100%
get_ActivityNodeIds()100%11100%
get_Name()100%11100%
get_Names()100%11100%
get_Status()100%11100%
get_Statuses()100%11100%
get_Completed()100%11100%
get_SchedulingActivityExecutionId()100%11100%
get_SchedulingActivityExecutionIds()100%11100%
get_SchedulingActivityId()100%11100%
get_SchedulingActivityIds()100%11100%
get_SchedulingWorkflowInstanceId()100%11100%
get_SchedulingWorkflowInstanceIds()100%11100%
get_CallStackDepth()100%11100%
get_IsEmpty()0%1482380%
Apply(...)62.5%5656100%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Runtime/Filters/ActivityExecutionRecordFilter.cs

#LineLine coverage
 1using Elsa.Workflows.Runtime.Entities;
 2
 3namespace Elsa.Workflows.Runtime.Filters;
 4
 5/// <summary>
 6/// A specification to use when finding activity execution log records. Only non-null fields will be included in the con
 7/// </summary>
 8public class ActivityExecutionRecordFilter
 9{
 10    /// <summary>
 11    /// The ID of the activity execution record.
 12    /// </summary>
 22213    public string? Id { get; set; }
 14
 15    /// <summary>
 16    /// The IDs of the activity execution records.
 17    /// </summary>
 11518    public ICollection<string>? Ids { get; set; }
 19
 20    /// <summary>
 21    /// The ID of the workflow instance.
 22    /// </summary>
 24623    public string? WorkflowInstanceId { get; set; }
 24
 25    /// <summary>
 26    /// The IDs of the workflow instances.
 27    /// </summary>
 14728    public ICollection<string>? WorkflowInstanceIds { get; set; }
 29
 30    /// <summary>
 31    /// The ID of the activity.
 32    /// </summary>
 13933    public string? ActivityId { get; set; }
 34
 35    /// <summary>
 36    /// The IDs of the activities.
 37    /// </summary>
 11538    public ICollection<string>? ActivityIds { get; set; }
 39
 40    /// <summary>
 41    /// The node ID of the activity.
 42    /// </summary>
 11543    public string? ActivityNodeId { get; set; }
 44
 45    /// <summary>
 46    /// The node IDs of the activities.
 47    /// </summary>
 11548    public ICollection<string>? ActivityNodeIds { get; set; }
 49
 50    /// <summary>
 51    /// The name of the activity.
 52    /// </summary>
 14353    public string? Name { get; set; }
 54
 55    /// <summary>
 56    /// The names of the activities.
 57    /// </summary>
 11558    public ICollection<string>? Names { get; set; }
 59
 60    /// <summary>
 61    /// The status of the activity.
 62    /// </summary>
 13263    public ActivityStatus? Status { get; set; }
 64
 65    /// <summary>
 66    /// The statuses of the activities.
 67    /// </summary>
 11568    public ICollection<ActivityStatus>? Statuses { get; set; }
 69
 70    /// <summary>
 71    /// Whether to include completed activity execution records. If not specified, all activity execution records will b
 72    /// </summary>
 12973    public bool? Completed { get; set; }
 74
 75    /// <summary>
 76    /// The ID of the activity execution context that scheduled this activity execution.
 77    /// </summary>
 11578    public string? SchedulingActivityExecutionId { get; set; }
 79
 80    /// <summary>
 81    /// The IDs of the activity execution contexts that scheduled activity executions.
 82    /// </summary>
 11583    public ICollection<string>? SchedulingActivityExecutionIds { get; set; }
 84
 85    /// <summary>
 86    /// The ID of the activity that scheduled this activity execution (denormalized).
 87    /// </summary>
 11588    public string? SchedulingActivityId { get; set; }
 89
 90    /// <summary>
 91    /// The IDs of the activities that scheduled activity executions (denormalized).
 92    /// </summary>
 11593    public ICollection<string>? SchedulingActivityIds { get; set; }
 94
 95    /// <summary>
 96    /// The workflow instance ID of the workflow that scheduled this activity execution.
 97    /// Used for cross-workflow call stack tracking.
 98    /// </summary>
 11599    public string? SchedulingWorkflowInstanceId { get; set; }
 100
 101    /// <summary>
 102    /// The workflow instance IDs of the workflows that scheduled activity executions.
 103    /// </summary>
 115104    public ICollection<string>? SchedulingWorkflowInstanceIds { get; set; }
 105
 106    /// <summary>
 107    /// The call stack depth of the activity execution.
 108    /// </summary>
 115109    public int? CallStackDepth { get; set; }
 110
 111    /// <summary>
 112    /// Returns true if the filter is empty.
 113    /// </summary>
 114    public bool IsEmpty =>
 0115        Id == null
 0116        && Ids == null
 0117        && WorkflowInstanceId == null
 0118        && WorkflowInstanceIds == null
 0119        && ActivityId == null
 0120        && ActivityIds == null
 0121        && ActivityNodeId == null
 0122        && ActivityNodeIds == null
 0123        && Name == null
 0124        && Names == null
 0125        && Status == null
 0126        && Statuses == null
 0127        && Completed == null
 0128        && SchedulingActivityExecutionId == null
 0129        && SchedulingActivityExecutionIds == null
 0130        && SchedulingActivityId == null
 0131        && SchedulingActivityIds == null
 0132        && SchedulingWorkflowInstanceId == null
 0133        && SchedulingWorkflowInstanceIds == null
 0134        && CallStackDepth == null;
 135
 136    /// <summary>
 137    /// Applies the filter to the specified queryable.
 138    /// </summary>
 139    public IQueryable<ActivityExecutionRecord> Apply(IQueryable<ActivityExecutionRecord> queryable)
 140    {
 115141        var filter = this;
 150142        if (filter.Id != null) queryable = queryable.Where(x => x.Id == filter.Id);
 115143        if (filter.Ids != null) queryable = queryable.Where(x => filter.Ids.Contains(x.Id));
 169144        if (filter.WorkflowInstanceId != null) queryable = queryable.Where(x => x.WorkflowInstanceId == filter.WorkflowI
 131145        if (filter.WorkflowInstanceIds != null) queryable = queryable.Where(x => filter.WorkflowInstanceIds.Contains(x.W
 123146        if (filter.ActivityId != null) queryable = queryable.Where(x => x.ActivityId == filter.ActivityId);
 115147        if (filter.ActivityIds != null && filter.ActivityIds.Any()) queryable = queryable.Where(x => filter.ActivityIds.
 115148        if (filter.ActivityNodeId != null) queryable = queryable.Where(x => x.ActivityNodeId == filter.ActivityNodeId);
 115149        if (filter.ActivityNodeIds != null && filter.ActivityNodeIds.Any()) queryable = queryable.Where(x => filter.Acti
 128150        if (filter.Name != null) queryable = queryable.Where(x => x.ActivityName == filter.Name);
 115151        if (filter.Names != null && filter.Names.Any()) queryable = queryable.Where(x => filter.Names.Contains(x.Activit
 122152        if (filter.Status != null) queryable = queryable.Where(x => x.Status == filter.Status);
 115153        if (filter.Statuses != null && filter.Statuses.Any()) queryable = queryable.Where(x => filter.Statuses.Contains(
 125154        if (filter.Completed != null) queryable = filter.Completed == true ? queryable.Where(x => x.CompletedAt != null)
 115155        if (filter.SchedulingActivityExecutionId != null) queryable = queryable.Where(x => x.SchedulingActivityExecution
 115156        if (filter.SchedulingActivityExecutionIds != null && filter.SchedulingActivityExecutionIds.Any()) queryable = qu
 115157        if (filter.SchedulingActivityId != null) queryable = queryable.Where(x => x.SchedulingActivityId == filter.Sched
 115158        if (filter.SchedulingActivityIds != null && filter.SchedulingActivityIds.Any()) queryable = queryable.Where(x =>
 115159        if (filter.SchedulingWorkflowInstanceId != null) queryable = queryable.Where(x => x.SchedulingWorkflowInstanceId
 115160        if (filter.SchedulingWorkflowInstanceIds != null && filter.SchedulingWorkflowInstanceIds.Any()) queryable = quer
 115161        if (filter.CallStackDepth != null) queryable = queryable.Where(x => x.CallStackDepth == filter.CallStackDepth);
 162
 115163        return queryable;
 164    }
 165}