Data validation in JIRA reports
Whenever we take user inputs, it is always a good idea to validate them to make sure the input is in the format that is expected. The same applies to reports also. JIRA reports, as we have seen in the previous recipes, accept user inputs based on which the reports are generated. In the example we used, a project is selected and the details of issues in the selected project are displayed.
In the previous example, the likelihood of a wrong project being selected is low as the project is selected from a valid list of available projects. But still, the final URL that generates the report can be tampered with to include a wrong project ID, and so it is best to do the validation no matter how the input is taken.
Getting ready
Create the report plugin, as explained in the first recipe.
How to do it...
All we need here is to override the validate method to include our custom validations. The following are the steps:
Override the
validate
method in the report class we created...