Class ModelValidation


  • public class ModelValidation
    extends Object
    Validates all properties of a configuration of a static analysis tool in a job.
    Author:
    Ullrich Hafner
    • Constructor Detail

      • ModelValidation

        public ModelValidation()
        Creates a new descriptor.
    • Method Detail

      • getAllCharsets

        public ComboBoxModel getAllCharsets()
        Returns all available character set names.
        Returns:
        all available character set names
      • getCharset

        public Charset getCharset​(@CheckForNull
                                  String charset)
        Returns the default charset for the specified encoding string. If the default encoding is empty or null, or if the charset is not valid then the default encoding of the platform is returned.
        Parameters:
        charset - identifier of the character set
        Returns:
        the default charset for the specified encoding string
      • ensureValidId

        public void ensureValidId​(String id)
        Ensures that the specified ID is valid.
        Parameters:
        id - the custom ID of the tool
        Throws:
        IllegalArgumentException - if the ID is not valid
      • validateId

        public FormValidation validateId​(String id)
        Performs on-the-fly validation of the ID.
        Parameters:
        id - the custom ID of the tool
        Returns:
        the validation result
      • validateCharset

        public FormValidation validateCharset​(String reportEncoding)
        Performs on-the-fly validation of the character encoding.
        Parameters:
        reportEncoding - the character encoding
        Returns:
        the validation result
      • getAllSeverityFilters

        public ListBoxModel getAllSeverityFilters()
        Returns a model with all available severity filters.
        Returns:
        a model with all available severity filters
      • getAllTrendChartTypes

        public ListBoxModel getAllTrendChartTypes()
        Returns a model with all available aggregation trend chart positions.
        Returns:
        a model with all available aggregation trend chart positions
      • getAllJobs

        public ComboBoxModel getAllJobs()
        Returns the model with the possible reference jobs.
        Returns:
        the model with the possible reference jobs
      • validateJob

        public FormValidation validateJob​(String referenceJobName)
        Performs on-the-fly validation of the reference job.
        Parameters:
        referenceJobName - the reference job
        Returns:
        the validation result
      • validateThreshold

        public FormValidation validateThreshold​(int threshold)
        Performs on-the-fly validation of the quality gate threshold.
        Parameters:
        threshold - the threshold
        Returns:
        the validation result
      • validateHealthy

        public FormValidation validateHealthy​(int healthy,
                                              int unhealthy)
        Performs on-the-fly validation of the health report thresholds.
        Parameters:
        healthy - the healthy threshold
        unhealthy - the unhealthy threshold
        Returns:
        the validation result
      • validateUnhealthy

        public FormValidation validateUnhealthy​(int healthy,
                                                int unhealthy)
        Performs on-the-fly validation of the health report thresholds.
        Parameters:
        healthy - the healthy threshold
        unhealthy - the unhealthy threshold
        Returns:
        the validation result
      • doCheckPattern

        public FormValidation doCheckPattern​(AbstractProject<?,​?> project,
                                             String pattern)
        Performs on-the-fly validation on the ant pattern for input files.
        Parameters:
        project - the project that is configured
        pattern - the file pattern
        Returns:
        the validation result
      • doCheckSourceDirectory

        public FormValidation doCheckSourceDirectory​(@AncestorInPath
                                                     AbstractProject<?,​?> project,
                                                     @QueryParameter
                                                     String sourceDirectory)
        Performs on-the-fly validation on the source code directory.
        Parameters:
        project - the project that is configured
        sourceDirectory - the file pattern
        Returns:
        the validation result