Class ModelValidation
- java.lang.Object
-
- io.jenkins.plugins.analysis.core.util.ModelValidation
-
public class ModelValidation extends Object
Validates all properties of a configuration of a static analysis tool in a job.- Author:
- Ullrich Hafner
-
-
Constructor Summary
Constructors Constructor Description ModelValidation()
Creates a new descriptor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FormValidation
doCheckPattern(AbstractProject<?,?> project, String pattern)
Performs on-the-fly validation on the ant pattern for input files.FormValidation
doCheckSourceDirectory(AbstractProject<?,?> project, String sourceDirectory)
Performs on-the-fly validation on the source code directory.void
ensureValidId(String id)
Ensures that the specified ID is valid.ComboBoxModel
getAllCharsets()
Returns all available character set names.ComboBoxModel
getAllJobs()
Returns the model with the possible reference jobs.ListBoxModel
getAllSeverityFilters()
Returns a model with all available severity filters.ListBoxModel
getAllTrendChartTypes()
Returns a model with all available aggregation trend chart positions.Charset
getCharset(String charset)
Returns the default charset for the specified encoding string.FormValidation
validateCharset(String reportEncoding)
Performs on-the-fly validation of the character encoding.FormValidation
validateHealthy(int healthy, int unhealthy)
Performs on-the-fly validation of the health report thresholds.FormValidation
validateId(String id)
Performs on-the-fly validation of the ID.FormValidation
validateJob(String referenceJobName)
Performs on-the-fly validation of the reference job.FormValidation
validateThreshold(int threshold)
Performs on-the-fly validation of the quality gate threshold.FormValidation
validateUnhealthy(int healthy, int unhealthy)
Performs on-the-fly validation of the health report thresholds.
-
-
-
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 ornull
, 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 thresholdunhealthy
- 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 thresholdunhealthy
- 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 configuredpattern
- 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 configuredsourceDirectory
- the file pattern- Returns:
- the validation result
-
-