2021-05-13 20:03:07 +02:00
|
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
2021-06-26 20:57:55 +02:00
|
|
|
|
using System.Linq;
|
2021-05-13 20:03:07 +02:00
|
|
|
|
|
|
|
|
|
namespace TINK.Model.Connector.Filter
|
|
|
|
|
{
|
|
|
|
|
public static class GroupFilterFactory
|
|
|
|
|
{
|
2021-06-26 20:57:55 +02:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Creates filter object.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="group">if value consists
|
|
|
|
|
/// - list of strings entries are used to filter (intersect) with or if value is
|
|
|
|
|
/// - null or an empty list null filter is applied, i.e. filtering is off.</param>
|
|
|
|
|
/// <returns>Filtering object.</returns>
|
|
|
|
|
/// <remarks>
|
|
|
|
|
/// Tread group values of null and empty lists as marker to turn filtering off to handle COPRI responses maximal flexible.
|
|
|
|
|
/// </remarks>
|
2021-05-13 20:03:07 +02:00
|
|
|
|
public static IGroupFilter Create(IEnumerable<string> group)
|
|
|
|
|
{
|
2021-06-26 20:57:55 +02:00
|
|
|
|
return group != null && group.Count() > 0
|
|
|
|
|
? (IGroupFilter) new IntersectGroupFilter(group) :
|
|
|
|
|
new NullGroupFilter();
|
2021-05-13 20:03:07 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|