/// <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> /// Serialize the <see cref="LogEntryChangelogItem"/> /// </summary> /// <param name="logEntryChangelogItem">The <see cref="LogEntryChangelogItem"/> to serialize</param> /// <returns>The <see cref="JObject"/></returns> private JObject Serialize(LogEntryChangelogItem logEntryChangelogItem) { var jsonObject = new JObject(); jsonObject.Add("affectedItemIid", this.PropertySerializerMap["affectedItemIid"](logEntryChangelogItem.AffectedItemIid)); jsonObject.Add("affectedReferenceIid", this.PropertySerializerMap["affectedReferenceIid"](logEntryChangelogItem.AffectedReferenceIid.OrderBy(x => x, this.guidComparer))); jsonObject.Add("changeDescription", this.PropertySerializerMap["changeDescription"](logEntryChangelogItem.ChangeDescription)); jsonObject.Add("changelogKind", this.PropertySerializerMap["changelogKind"](Enum.GetName(typeof(CDP4Common.CommonData.LogEntryChangelogItemKind), logEntryChangelogItem.ChangelogKind))); jsonObject.Add("classKind", this.PropertySerializerMap["classKind"](Enum.GetName(typeof(CDP4Common.CommonData.ClassKind), logEntryChangelogItem.ClassKind))); jsonObject.Add("excludedDomain", this.PropertySerializerMap["excludedDomain"](logEntryChangelogItem.ExcludedDomain.OrderBy(x => x, this.guidComparer))); jsonObject.Add("excludedPerson", this.PropertySerializerMap["excludedPerson"](logEntryChangelogItem.ExcludedPerson.OrderBy(x => x, this.guidComparer))); jsonObject.Add("iid", this.PropertySerializerMap["iid"](logEntryChangelogItem.Iid)); jsonObject.Add("modifiedOn", this.PropertySerializerMap["modifiedOn"](logEntryChangelogItem.ModifiedOn)); jsonObject.Add("revisionNumber", this.PropertySerializerMap["revisionNumber"](logEntryChangelogItem.RevisionNumber)); jsonObject.Add("thingPreference", this.PropertySerializerMap["thingPreference"](logEntryChangelogItem.ThingPreference)); return(jsonObject); }
/// <summary> /// Checks if a <see cref="LogEntryChangelogItem"/> has certain specifics related to the <see cref="Iid"/>. /// </summary> /// <param name="logEntryChangelogItem"> /// The <see cref="LogEntryChangelogItem"/> /// </param> /// <returns> /// True is the specifics of the <see cref="LogEntryChangelogItem"/> match certain criteria, otherwise false. /// </returns> public abstract bool CheckFilter(LogEntryChangelogItem logEntryChangelogItem);
/// <summary> /// Creates a new instance of <see cref="LogEntryChangelogItemData"/> /// </summary> /// <param name="logEntryChangelogItem"> /// The <see cref="CDP4Common.DTO.LogEntryChangelogItem"/> /// </param> /// <param name="modelLogEntryData"> /// The <see cref="Data.ModelLogEntryData"/> /// </param> public LogEntryChangelogItemData(LogEntryChangelogItem logEntryChangelogItem, ModelLogEntryData modelLogEntryData) { this.ModelLogEntryData = modelLogEntryData; this.LogEntryChangelogItem = logEntryChangelogItem; }
/// <summary> /// Checks if a <see cref="LogEntryChangelogItem"/> has certain specifics related to the <see cref="ChangeNotificationFilter.Iid"/>. /// </summary> /// <param name="logEntryChangelogItem"> /// The <see cref="LogEntryChangelogItem"/> /// </param> /// <returns> /// True is the specifics of the <see cref="LogEntryChangelogItem"/> match certain criteria, otherwise false. /// </returns> public override bool CheckFilter(LogEntryChangelogItem logEntryChangelogItem) { return(logEntryChangelogItem.AffectedReferenceIid.Intersect(this.DomainOfExpertises.Select(x => x.Iid)).Any() && logEntryChangelogItem.AffectedReferenceIid.Contains(this.Iid)); }