/// <summary> /// Tries to add a <see cref="Data.ChangeNotificationSubscriptionData"/> based on a <see cref="ChangeNotificationSubscription"/> instance /// to the <see cref="ChangeNotificationSubscriptionData"/> property. /// If a <see cref="Data.ChangeNotificationSubscriptionData"/> for the <see cref="changeNotificationSubscription"/> was already create in the /// <see cref="ChangeNotificationSubscriptionData"/> property, then no new one will be created. /// </summary> /// <param name="changeNotificationSubscription"> /// The <see cref="ChangeNotificationSubscription"/> /// </param> public void TryAddChangeNotificationSubscriptionData(ChangeNotificationSubscription changeNotificationSubscription) { if (this.ChangeNotificationSubscriptionData.All(x => x.ChangeNotificationSubscription != changeNotificationSubscription)) { this.ChangeNotificationSubscriptionData.Add(new ChangeNotificationSubscriptionData(changeNotificationSubscription, this)); } }
/// <summary> /// Create a <see cref="IChangeNotificationFilter"/> for a <see cref="ChangeNotificationSubscription"/>. /// </summary> /// <param name="changeNotificationSubscription"> /// The <see cref="ChangeNotificationSubscription"/> /// </param> /// <param name="domainOfExpertises"> /// The current user's <see cref="DomainOfExpertise"/>s /// </param> /// <returns> /// The <see cref="IChangeNotificationFilter"/> /// </returns> private IChangeNotificationFilter CreateChangeLogNotificationFilter(ChangeNotificationSubscription changeNotificationSubscription, IEnumerable <DomainOfExpertise> domainOfExpertises) { switch (changeNotificationSubscription.ChangeNotificationSubscriptionType) { case ChangeNotificationSubscriptionType.AppliedCategory: return(new CategoryChangeNotificationFilter(changeNotificationSubscription, domainOfExpertises)); case ChangeNotificationSubscriptionType.ParameterSubscription: return(new ParameterSubscriptionChangeNotificationFilter(changeNotificationSubscription, domainOfExpertises)); case ChangeNotificationSubscriptionType.ParameterType: return(new ParameterTypeChangeNotificationFilter(changeNotificationSubscription, domainOfExpertises)); case ChangeNotificationSubscriptionType.NamedThing: return(new DefaultThingChangeNotificationFilter(changeNotificationSubscription, domainOfExpertises)); case ChangeNotificationSubscriptionType.ParameterOrOverride: return(new ParameterOrOverrideChangeNotificationFilter(changeNotificationSubscription, domainOfExpertises)); default: throw new NotImplementedException($"{changeNotificationSubscription.ChangeNotificationSubscriptionType} is not implemented."); } }
/// <summary> /// Creates a new instance of the <see cref="ChangeNotificationFilter"/> class. /// </summary> /// <param name="changeNotificationSubscription"> /// The <see cref="ChangeNotificationSubscription"/> that resulted into this <see cref="IChangeNotificationFilter"/>. /// </param> /// <param name="domainOfExpertises"> /// The <see cref="DomainOfExpertise"/>s where to filter on. /// </param> protected ChangeNotificationFilter(ChangeNotificationSubscription changeNotificationSubscription, IEnumerable <DomainOfExpertise> domainOfExpertises) { this.DomainOfExpertises = domainOfExpertises; this.ChangeNotificationSubscription = changeNotificationSubscription; }
/// <summary> /// Tries to add objects base on a combination of <see cref="LogEntryChangelogItem"/> and <see cref="ChangeNotificationSubscription"/> instances to the object structure /// where this <see cref="ModelLogEntryData"/> is the root object of. /// If a <see cref="Data.LogEntryChangelogItemData"/> for the <see cref="logEntryChangelogItem"/> was already create in the /// <see cref="LogEntryChangelogItemData"/> property, then no new one will be created. /// </summary> /// <param name="logEntryChangelogItem"> /// The <see cref="LogEntryChangelogItem"/> /// </param> /// <param name="changeNotificationSubscription"> /// The <see cref="ChangeNotificationSubscription"/> /// </param> public void TryAddLogEntryChangelogData(LogEntryChangelogItem logEntryChangelogItem, ChangeNotificationSubscription changeNotificationSubscription) { if (this.LogEntryChangelogItemData.All(x => x.LogEntryChangelogItem != logEntryChangelogItem)) { this.LogEntryChangelogItemData.Add(new LogEntryChangelogItemData(logEntryChangelogItem, this)); } var logEntryChangelogItemData = this.LogEntryChangelogItemData.Single(x => x.LogEntryChangelogItem == logEntryChangelogItem); logEntryChangelogItemData.TryAddChangeNotificationSubscriptionData(changeNotificationSubscription); }
/// <summary> /// Creates a new instance of the <see cref="CategoryChangeNotificationFilter"/> class. /// </summary> /// <param name="changeNotificationSubscription"> /// The <see cref="ChangeNotificationSubscription"/> that resulted into this <see cref="IChangeNotificationFilter"/>. /// </param> /// <param name="domainOfExpertises"> /// The <see cref="IChangeNotificationFilter"/>s where to filter on. /// </param> public CategoryChangeNotificationFilter(ChangeNotificationSubscription changeNotificationSubscription, IEnumerable <DomainOfExpertise> domainOfExpertises) : base(changeNotificationSubscription, domainOfExpertises) { }
/// <summary> /// Creates a new instance of the <see cref="ParameterTypeChangeNotificationFilter"/> class. /// </summary> /// <param name="changeNotificationSubscription"> /// The <see cref="IChangeNotificationFilter"/> that resulted into this <see cref="IChangeNotificationFilter"/>. /// </param> /// <param name="domainOfExpertises"> /// The <see cref="ChangeNotificationSubscription"/>s where to filter on. /// </param> public ParameterOrOverrideChangeNotificationFilter(ChangeNotificationSubscription changeNotificationSubscription, IEnumerable <DomainOfExpertise> domainOfExpertises) : base(changeNotificationSubscription, domainOfExpertises) { }
/// <summary> /// Creates a new instance of <see cref="ChangeNotificationSubscriptionData"/> /// </summary> /// <param name="changeNotificationSubscription"> /// The <see cref="ChangeNotificationSubscription"/> /// </param> /// <param name="logEntryChangelogItemData"> /// The <see cref="LogEntryChangelogItemData"/> /// </param> public ChangeNotificationSubscriptionData(ChangeNotificationSubscription changeNotificationSubscription, LogEntryChangelogItemData logEntryChangelogItemData) { this.ChangeNotificationSubscription = changeNotificationSubscription; this.LogEntryChangelogItemData = logEntryChangelogItemData; }
/// <summary> /// Creates a new instance of the <see cref="DefaultThingChangeNotificationFilter"/> class. /// </summary> /// <param name="changeNotificationSubscription"> /// The <see cref="ChangeNotificationSubscription"/> that resulted into this <see cref="IChangeNotificationFilter"/>. /// </param> /// <param name="domainOfExpertises"> /// The <see cref="DomainOfExpertise"/>s where to filter on. /// </param> public DefaultThingChangeNotificationFilter(ChangeNotificationSubscription changeNotificationSubscription, IEnumerable <DomainOfExpertise> domainOfExpertises) : base(changeNotificationSubscription, domainOfExpertises) { }