示例#1
0
        /// <summary>
        /// Serialize the <see cref="ModelLogEntry"/>
        /// </summary>
        /// <param name="modelLogEntry">The <see cref="ModelLogEntry"/> to serialize</param>
        /// <returns>The <see cref="JObject"/></returns>
        private JObject Serialize(ModelLogEntry modelLogEntry)
        {
            var jsonObject = new JObject();

            jsonObject.Add("affectedDomainIid", this.PropertySerializerMap["affectedDomainIid"](modelLogEntry.AffectedDomainIid.OrderBy(x => x, this.guidComparer)));
            jsonObject.Add("affectedItemIid", this.PropertySerializerMap["affectedItemIid"](modelLogEntry.AffectedItemIid.OrderBy(x => x, this.guidComparer)));
            jsonObject.Add("author", this.PropertySerializerMap["author"](modelLogEntry.Author));
            jsonObject.Add("category", this.PropertySerializerMap["category"](modelLogEntry.Category.OrderBy(x => x, this.guidComparer)));
            jsonObject.Add("classKind", this.PropertySerializerMap["classKind"](Enum.GetName(typeof(CDP4Common.CommonData.ClassKind), modelLogEntry.ClassKind)));
            jsonObject.Add("content", this.PropertySerializerMap["content"](modelLogEntry.Content));
            jsonObject.Add("createdOn", this.PropertySerializerMap["createdOn"](modelLogEntry.CreatedOn));
            jsonObject.Add("excludedDomain", this.PropertySerializerMap["excludedDomain"](modelLogEntry.ExcludedDomain.OrderBy(x => x, this.guidComparer)));
            jsonObject.Add("excludedPerson", this.PropertySerializerMap["excludedPerson"](modelLogEntry.ExcludedPerson.OrderBy(x => x, this.guidComparer)));
            jsonObject.Add("iid", this.PropertySerializerMap["iid"](modelLogEntry.Iid));
            jsonObject.Add("languageCode", this.PropertySerializerMap["languageCode"](modelLogEntry.LanguageCode));
            jsonObject.Add("level", this.PropertySerializerMap["level"](Enum.GetName(typeof(CDP4Common.CommonData.LogLevelKind), modelLogEntry.Level)));
            jsonObject.Add("logEntryChangelogItem", this.PropertySerializerMap["logEntryChangelogItem"](modelLogEntry.LogEntryChangelogItem.OrderBy(x => x, this.guidComparer)));
            jsonObject.Add("modifiedOn", this.PropertySerializerMap["modifiedOn"](modelLogEntry.ModifiedOn));
            jsonObject.Add("revisionNumber", this.PropertySerializerMap["revisionNumber"](modelLogEntry.RevisionNumber));
            jsonObject.Add("thingPreference", this.PropertySerializerMap["thingPreference"](modelLogEntry.ThingPreference));
            return(jsonObject);
        }
 /// <summary>
 /// Checks if a <see cref="ModelLogEntry"/> has certain specifics related to the <see cref="Iid"/>.
 /// </summary>
 /// <param name="modelLogEntry">
 /// The <see cref="ModelLogEntry"/>
 /// </param>
 /// <returns>
 /// True is the specifics of the <see cref="ModelLogEntry"/> match certain criteria, otherwise false.
 /// </returns>
 public bool CheckFilter(ModelLogEntry modelLogEntry)
 {
     return(modelLogEntry.AffectedDomainIid.Intersect(this.DomainOfExpertises.Select(x => x.Iid)).Any());
 }
 /// <summary>
 /// Creates a new instance of <see cref="ModelLogEntryData"/>
 /// </summary>
 /// <param name="modelLogEntry">
 /// The <see cref="CDP4Common.DTO.ModelLogEntry"/>
 /// </param>
 public ModelLogEntryData(ModelLogEntry modelLogEntry)
 {
     this.ModelLogEntry = modelLogEntry;
 }
 /// <summary>
 /// Add an Log Entry row view model to the list of <see cref="LogEntry"/>
 /// </summary>
 /// <param name="logEntry">
 /// The <see cref="LogEntry"/> that is to be added
 /// </param>
 private ModelLogEntryRowViewModel AddLogEntryRowViewModel(ModelLogEntry logEntry)
 {
     return(new ModelLogEntryRowViewModel(logEntry, this.Session, this));
 }
        /// <summary>
        /// Persist the <see cref="ModelLogEntry"/> containment tree to the ORM layer. Update if it already exists.
        /// This is typically used during the import of existing data to the Database.
        /// </summary>
        /// <param name="transaction">
        /// The current <see cref="NpgsqlTransaction"/> to the database.
        /// </param>
        /// <param name="partition">
        /// The database partition (schema) where the requested resource will be stored.
        /// </param>
        /// <param name="modelLogEntry">
        /// The <see cref="ModelLogEntry"/> instance to persist.
        /// </param>
        /// <returns>
        /// True if the persistence was successful.
        /// </returns>
        private bool UpsertContainment(NpgsqlTransaction transaction, string partition, ModelLogEntry modelLogEntry)
        {
            var results = new List <bool>();

            foreach (var logEntryChangelogItem in this.ResolveFromRequestCache(modelLogEntry.LogEntryChangelogItem))
            {
                results.Add(this.LogEntryChangelogItemService.UpsertConcept(transaction, partition, logEntryChangelogItem, modelLogEntry));
            }

            return(results.All(x => x));
        }