示例#1
0
        private static string FormatOriginValue(
            [NotNull] string updateOriginValue,
            [CanBeNull] ManagedExceptionVersion replacedExceptionVersion)
        {
            var origins = new HashSet <string>(StringComparer.OrdinalIgnoreCase)
            {
                updateOriginValue
            };

            if (replacedExceptionVersion != null)
            {
                foreach (string replacedOrigin in
                         ExceptionObjectUtils.ParseOrigins(replacedExceptionVersion.ImportOrigin))
                {
                    origins.Add(replacedOrigin);
                }
            }

            return(ExceptionObjectUtils.FormatOrigins(origins));
        }
示例#2
0
        private static bool ImportException(
            [NotNull] IRow row, [NotNull] string importOriginValue, DateTime importDate,
            [NotNull] ExceptionObjectFactory factory,
            [NotNull]
            IDictionary <Guid, QualityConditionExceptions> targetExceptionsByConditionVersion,
            [NotNull] IDictionary <esriGeometryType, HashSet <int> > replacedExceptionObjects,
            [NotNull] ExceptionWriter writer,
            out int matchCount)
        {
            ExceptionObject exceptionObject = factory.CreateExceptionObject(row);

            matchCount = 0;

            // import only active exceptions
            if (exceptionObject.Status != ExceptionObjectStatus.Active)
            {
                return(false);
            }

            var matchingLineageUuids = new DistinctValues <Guid>();

            var origins = new HashSet <string>(StringComparer.OrdinalIgnoreCase)
            {
                importOriginValue
            };

            foreach (ExceptionObject matchingExceptionObject in GetMatchingExceptionObjects(
                         targetExceptionsByConditionVersion,
                         exceptionObject))
            {
                // add to Uuids of matching exceptions (usually, should be unique)
                if (matchingExceptionObject.ManagedLineageUuid != null)
                {
                    // also if matching exception is inactive
                    // --> lineage of inactive exceptions may be continued (resurrection of inactive exceptions)
                    matchingLineageUuids.Add(matchingExceptionObject.ManagedLineageUuid.Value);

                    // NOTE: consider *preferring* active exceptions, only if none: resurrect inactive exception lineage
                }

                // include the origin values of active replaced exceptions
                // Note: not for resurrected exceptions (inactive/with end date -> active)
                if (matchingExceptionObject.ManagedVersionEndDate == null)
                {
                    foreach (string replacedOrigin in
                             ExceptionObjectUtils.ParseOrigins(matchingExceptionObject.ManagedOrigin))
                    {
                        origins.Add(replacedOrigin);
                    }
                }

                matchCount++;

                AddToReplacedExceptionObjects(matchingExceptionObject, replacedExceptionObjects);
            }

            writer.Write(row,
                         importDate,
                         ExceptionObjectUtils.FormatOrigins(origins),
                         GetLineageUuid(matchingLineageUuids),
                         versionOriginValue: importOriginValue,
                         statusValue: "Active");

            return(true);
        }