< 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
34%
Covered branches: 32
Total branches: 94
Branch coverage: 34%
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(...)53.57%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>
 14513    public string? Id { get; set; }
 14
 15    /// <summary>
 16    /// The IDs of the activity execution records.
 17    /// </summary>
 5818    public ICollection<string>? Ids { get; set; }
 19
 20    /// <summary>
 21    /// The ID of the workflow instance.
 22    /// </summary>
 7823    public string? WorkflowInstanceId { get; set; }
 24
 25    /// <summary>
 26    /// The IDs of the workflow instances.
 27    /// </summary>
 8428    public ICollection<string>? WorkflowInstanceIds { get; set; }
 29
 30    /// <summary>
 31    /// The ID of the activity.
 32    /// </summary>
 7733    public string? ActivityId { get; set; }
 34
 35    /// <summary>
 36    /// The IDs of the activities.
 37    /// </summary>
 5838    public ICollection<string>? ActivityIds { get; set; }
 39
 40    /// <summary>
 41    /// The node ID of the activity.
 42    /// </summary>
 5843    public string? ActivityNodeId { get; set; }
 44
 45    /// <summary>
 46    /// The node IDs of the activities.
 47    /// </summary>
 5848    public ICollection<string>? ActivityNodeIds { get; set; }
 49
 50    /// <summary>
 51    /// The name of the activity.
 52    /// </summary>
 6053    public string? Name { get; set; }
 54
 55    /// <summary>
 56    /// The names of the activities.
 57    /// </summary>
 5858    public ICollection<string>? Names { get; set; }
 59
 60    /// <summary>
 61    /// The status of the activity.
 62    /// </summary>
 5863    public ActivityStatus? Status { get; set; }
 64
 65    /// <summary>
 66    /// The statuses of the activities.
 67    /// </summary>
 5868    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>
 5873    public bool? Completed { get; set; }
 74
 75    /// <summary>
 76    /// The ID of the activity execution context that scheduled this activity execution.
 77    /// </summary>
 5878    public string? SchedulingActivityExecutionId { get; set; }
 79
 80    /// <summary>
 81    /// The IDs of the activity execution contexts that scheduled activity executions.
 82    /// </summary>
 5883    public ICollection<string>? SchedulingActivityExecutionIds { get; set; }
 84
 85    /// <summary>
 86    /// The ID of the activity that scheduled this activity execution (denormalized).
 87    /// </summary>
 5888    public string? SchedulingActivityId { get; set; }
 89
 90    /// <summary>
 91    /// The IDs of the activities that scheduled activity executions (denormalized).
 92    /// </summary>
 5893    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>
 5899    public string? SchedulingWorkflowInstanceId { get; set; }
 100
 101    /// <summary>
 102    /// The workflow instance IDs of the workflows that scheduled activity executions.
 103    /// </summary>
 58104    public ICollection<string>? SchedulingWorkflowInstanceIds { get; set; }
 105
 106    /// <summary>
 107    /// The call stack depth of the activity execution.
 108    /// </summary>
 58109    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    {
 58141        var filter = this;
 86142        if (filter.Id != null) queryable = queryable.Where(x => x.Id == filter.Id);
 58143        if (filter.Ids != null) queryable = queryable.Where(x => filter.Ids.Contains(x.Id));
 68144        if (filter.WorkflowInstanceId != null) queryable = queryable.Where(x => x.WorkflowInstanceId == filter.WorkflowI
 71145        if (filter.WorkflowInstanceIds != null) queryable = queryable.Where(x => filter.WorkflowInstanceIds.Contains(x.W
 64146        if (filter.ActivityId != null) queryable = queryable.Where(x => x.ActivityId == filter.ActivityId);
 58147        if (filter.ActivityIds != null && filter.ActivityIds.Any()) queryable = queryable.Where(x => filter.ActivityIds.
 58148        if (filter.ActivityNodeId != null) queryable = queryable.Where(x => x.ActivityNodeId == filter.ActivityNodeId);
 58149        if (filter.ActivityNodeIds != null && filter.ActivityNodeIds.Any()) queryable = queryable.Where(x => filter.Acti
 59150        if (filter.Name != null) queryable = queryable.Where(x => x.ActivityName == filter.Name);
 58151        if (filter.Names != null && filter.Names.Any()) queryable = queryable.Where(x => filter.Names.Contains(x.Activit
 58152        if (filter.Status != null) queryable = queryable.Where(x => x.Status == filter.Status);
 58153        if (filter.Statuses != null && filter.Statuses.Any()) queryable = queryable.Where(x => filter.Statuses.Contains(
 58154        if (filter.Completed != null) queryable = filter.Completed == true ? queryable.Where(x => x.CompletedAt != null)
 58155        if (filter.SchedulingActivityExecutionId != null) queryable = queryable.Where(x => x.SchedulingActivityExecution
 58156        if (filter.SchedulingActivityExecutionIds != null && filter.SchedulingActivityExecutionIds.Any()) queryable = qu
 58157        if (filter.SchedulingActivityId != null) queryable = queryable.Where(x => x.SchedulingActivityId == filter.Sched
 58158        if (filter.SchedulingActivityIds != null && filter.SchedulingActivityIds.Any()) queryable = queryable.Where(x =>
 58159        if (filter.SchedulingWorkflowInstanceId != null) queryable = queryable.Where(x => x.SchedulingWorkflowInstanceId
 58160        if (filter.SchedulingWorkflowInstanceIds != null && filter.SchedulingWorkflowInstanceIds.Any()) queryable = quer
 58161        if (filter.CallStackDepth != null) queryable = queryable.Where(x => x.CallStackDepth == filter.CallStackDepth);
 162
 58163        return queryable;
 164    }
 165}