Beispiel #1
0
        public static string GetDefaultTemplateDirectory(
            [CanBeNull] XmlVerificationOptions options)
        {
            if (options == null)
            {
                return(null);
            }

            string path = options.DefaultTemplateDirectoryPath;

            if (StringUtils.IsNullOrEmptyOrBlank(path))
            {
                return(null);
            }

            string trimmedPath = path.Trim();

            if (FileSystemUtils.HasInvalidPathChars(trimmedPath))
            {
                throw new InvalidConfigurationException(
                          $"Invalid default template directory path: {trimmedPath}");
            }

            if (!Path.IsPathRooted(trimmedPath))
            {
                throw new InvalidConfigurationException(
                          $"Default template directory should be an absolute path: {trimmedPath}");
            }

            return(trimmedPath);
        }
Beispiel #2
0
        public static InvolvedObjectsMatchCriteria GetInvolvedObjectMatchCriteria(
            [NotNull] XmlVerificationOptions verificationOptions)
        {
            List <XmlInvolvedObjectsMatchCriterionIgnoredDatasets> ignoredDatasets =
                verificationOptions.Exceptions?.InvolvedObjectsMatchCriteria?.IgnoredDatasets;

            if (ignoredDatasets == null || ignoredDatasets.Count == 0)
            {
                return(null);
            }

            return(new InvolvedObjectsMatchCriteria(ignoredDatasets));
        }
Beispiel #3
0
        public static ShapeMatchCriterion GetDefaultShapeMatchCriterion(
            [CanBeNull] XmlVerificationOptions verificationOptions)
        {
            const ShapeMatchCriterion defaultValue = ShapeMatchCriterion.EqualEnvelope;

            if (verificationOptions == null)
            {
                return(defaultValue);
            }

            XmlExceptionConfiguration exceptions = verificationOptions.Exceptions;

            return(exceptions?.DefaultShapeMatchCriterion ?? defaultValue);
        }
Beispiel #4
0
        public static ExceptionObjectStatus GetDefaultExceptionObjectStatus(
            [CanBeNull] XmlVerificationOptions verificationOptions)
        {
            const ExceptionObjectStatus defaultValue = ExceptionObjectStatus.Active;

            if (verificationOptions == null)
            {
                return(defaultValue);
            }

            XmlExceptionConfiguration exceptions = verificationOptions.Exceptions;

            return(exceptions?.DefaultExceptionObjectStatus ?? defaultValue);
        }
Beispiel #5
0
        public static IWorkspace GetExceptionWorkspace(
            [NotNull] XmlVerificationOptions verificationOptions)
        {
            XmlExceptionConfiguration exceptions = verificationOptions.Exceptions;

            if (exceptions == null)
            {
                return(null);
            }

            string dataSource = exceptions.DataSource;

            return(StringUtils.IsNullOrEmptyOrBlank(dataSource)
                                       ? null
                                       : WorkspaceUtils.OpenWorkspace(dataSource.Trim()));
        }
Beispiel #6
0
        public static string GetMxdDocumentName([CanBeNull] XmlVerificationOptions options)
        {
            if (options == null || StringUtils.IsNullOrEmptyOrBlank(options.MxdDocumentName))
            {
                return("issues.mxd");
            }

            string name = Assert.NotNull(options.MxdDocumentName).Trim();

            if (FileSystemUtils.HasInvalidFileNameChars(name))
            {
                throw new InvalidConfigurationException(
                          $"Mxd document name is not a valid file name: {name}");
            }

            return(name);
        }
Beispiel #7
0
        public static string GetExportedExceptionsWorkspaceName(
            [CanBeNull] XmlVerificationOptions options)
        {
            if (options == null || StringUtils.IsNullOrEmptyOrBlank(options.ExceptionGdbName))
            {
                return("exceptions");
            }

            string name = Assert.NotNull(options.ExceptionGdbName).Trim();

            if (FileSystemUtils.HasInvalidFileNameChars(name))
            {
                throw new InvalidConfigurationException(
                          $"Exception workspace name is not a valid file or directory name: {name}");
            }

            return(name);
        }
Beispiel #8
0
        public static string GetXmlReportFileName(
            [CanBeNull] XmlVerificationOptions options)
        {
            if (options == null || StringUtils.IsNullOrEmptyOrBlank(options.XmlReportName))
            {
                return("verification.xml");
            }

            string name = Assert.NotNull(options.XmlReportName).Trim();

            if (FileSystemUtils.HasInvalidFileNameChars(name))
            {
                throw new InvalidConfigurationException(
                          $"Xml report name is not a valid file name: {name}");
            }

            return(name);
        }
Beispiel #9
0
        public static IEnumerable <XmlIssueMapOptions> GetIssueMapOptions(
            [CanBeNull] XmlVerificationOptions options,
            [CanBeNull] string defaultIssueMapTemplatePath,
            [NotNull] string defaultIssueMapFileName)
        {
            List <XmlIssueMapOptions> result =
                options?.IssueMaps ?? new List <XmlIssueMapOptions>();

            if (result.Count == 0 && StringUtils.IsNotEmpty(defaultIssueMapTemplatePath))
            {
                result.Add(new XmlIssueMapOptions
                {
                    MxdFileName  = defaultIssueMapFileName,
                    TemplatePath = defaultIssueMapTemplatePath
                });
            }

            return(result);
        }
Beispiel #10
0
        GetSpecificationReportOptions(
            [CanBeNull] XmlVerificationOptions options,
            [CanBeNull] string defaultTemplatePath)
        {
            const string defaultReportFileName = "qualityspecification.html";

            List <XmlSpecificationReportOptions> result =
                options?.SpecificationReports ?? new List <XmlSpecificationReportOptions>();

            if (result.Count == 0 && !string.IsNullOrEmpty(defaultTemplatePath))
            {
                result.Add(new XmlSpecificationReportOptions
                {
                    ReportFileName = defaultReportFileName,
                    TemplatePath   = defaultTemplatePath
                });
            }

            return(result);
        }
Beispiel #11
0
        public static IEnumerable <XmlHtmlReportOptions> GetHtmlReportOptions(
            [CanBeNull] XmlVerificationOptions options,
            [CanBeNull] string defaultReportTemplatePath)
        {
            const string defaultReportFileName = "verification.html";

            List <XmlHtmlReportOptions> result = options?.HtmlReports ??
                                                 new List <XmlHtmlReportOptions>();

            if (result.Count == 0 &&
                !string.IsNullOrEmpty(defaultReportTemplatePath))
            {
                result.Add(new XmlHtmlReportOptions
                {
                    ReportFileName = defaultReportFileName,
                    TemplatePath   = defaultReportTemplatePath
                });
            }

            return(result);
        }
Beispiel #12
0
 public static bool ExportExceptions([CanBeNull] XmlVerificationOptions options)
 {
     return(options?.Exceptions != null && options.Exceptions.ExportExceptions);
 }