Esempio n. 1
0
        private static string GetCurrentValueOrigin(IssueAttribute attribute,
                                                    [CanBeNull] object currentValue,
                                                    Guid startVersionGuid,
                                                    [NotNull] ExceptionLineage lineage,
                                                    out DateTime?importDate)
        {
            string origin = null;

            importDate = null;

            foreach (ManagedExceptionVersion exceptionObject in
                     lineage.GetAll()
                     .OrderByDescending(e => e.VersionBeginDate))
            {
                if (!Equals(exceptionObject.GetValue(attribute), currentValue))
                {
                    // value is different --> next version (by date) must have introduced this value
                    break;
                }

                if (exceptionObject.VersionUuid == startVersionGuid)
                {
                    // start version for search (excluded) reached
                    break;
                }

                // value is equal
                origin     = exceptionObject.VersionImportOrigin;
                importDate = exceptionObject.VersionBeginDate;
            }

            return(origin);
        }
Esempio n. 2
0
        public void AddExistingException([NotNull] ManagedExceptionVersion exceptionVersion)
        {
            Assert.ArgumentNotNull(exceptionVersion, nameof(exceptionVersion));

            ExceptionLineage lineage;

            if (!_lineages.TryGetValue(exceptionVersion.LineageUuid, out lineage))
            {
                lineage = new ExceptionLineage(exceptionVersion.LineageUuid);
                _lineages.Add(lineage.Uuid, lineage);
            }

            lineage.Include(exceptionVersion);
        }
Esempio n. 3
0
        private ExceptionAttributeConflict CreateConflict(
            IssueAttribute attribute, object newValue, object currentValue,
            object originalValue, Guid lineageUuid, Guid startVersionGuid)
        {
            ExceptionLineage lineage = _lineages[lineageUuid];

            DateTime?currentValueImportDate;
            string   currentValueOrigin = GetCurrentValueOrigin(
                attribute, currentValue, startVersionGuid, lineage,
                out currentValueImportDate);

            return(new ExceptionAttributeConflict(attribute,
                                                  newValue, currentValue, originalValue,
                                                  currentValueOrigin,
                                                  currentValueImportDate));
        }