Package gov.nasa.pds.validate.report
Class Report
java.lang.Object
gov.nasa.pds.validate.report.Report
- Direct Known Subclasses:
FullReport
,JSONReport
,XmlReport
public abstract class Report extends Object
Abstract class that represents a Report for the Vtool command line API. This
class handles basic utilities for reporting and calling customized portions
of reports.
- Author:
- pramirez
-
Field Summary
Fields Modifier and Type Field Description protected List<String>
configurations
protected boolean
integrityCheckFlag
protected Map<String,Long>
messageSummary
protected int
numProducts
protected List<String>
parameters
protected int
totalIntegrityChecks
protected int
totalProducts
protected PrintWriter
writer
-
Constructor Summary
Constructors Constructor Description Report()
Default constructor to initialize report variables. -
Method Summary
Modifier and Type Method Description void
addConfiguration(String configuration)
Adds the string supplied to the configuration section in the heading of the report.void
addParameter(String parameter)
Adds the string supplied to the parameter section in the heading of the report.void
enableDeprecatedFlagWarning()
Enables deprecation warning message when deprecated CLI flags are usedExceptionType
getLevel()
int
getNumFailed()
int
getNumPassed()
int
getNumSkipped()
int
getTotalErrors()
int
getTotalInfos()
int
getTotalIntegrityChecks()
int
getTotalProducts()
int
getTotalWarnings()
String
getType(String systemId)
boolean
hasErrors()
boolean
hasWarnings()
void
printFooter()
Prints out the footer or the report and calls the customized footer section.protected abstract void
printFooter(PrintWriter writer)
Allows customization of the footer section of the reportvoid
printHeader()
This method will display the default header for the Vtool command line library reports.protected abstract void
printHeader(PrintWriter writer, String title)
Allows a Report to customize the header portion of the Report if necessary.void
printHeader(String title)
protected abstract void
printRecordMessages(PrintWriter writer, Status status, URI sourceUri, List<ValidationProblem> problems)
Allows a report to customize how it handles reporting on a particular label.protected void
printRecordSkip(PrintWriter writer, URI sourceUri, ValidationProblem problem)
Status
record(URI sourceUri, ValidationProblem problem)
Status
record(URI sourceUri, List<ValidationProblem> problems)
Allows a report to change how they manage reporting on a given file that has been parsed and validated.Status
recordSkip(URI sourceUri, ValidationProblem problem)
void
setLevel(ExceptionType ExceptionType)
Anything at or above the level will be reported.void
setOutput(File file)
Handles writing a Report to aFile
.void
setOutput(OutputStream os)
Handle writing a Report to anOutputStream
.void
setOutput(Writer writer)
Handles writing a Report to the writer interface.protected Map<String,Long>
sortMessageSummary(Map<String,Long> messageSummary)
-
Field Details
-
integrityCheckFlag
protected boolean integrityCheckFlag -
totalProducts
protected int totalProducts -
numProducts
protected int numProducts -
totalIntegrityChecks
protected int totalIntegrityChecks -
parameters
-
configurations
-
writer
-
messageSummary
-
-
Constructor Details
-
Report
public Report()Default constructor to initialize report variables. Initializes default output to System.out if you wish to write the report to a different sourse use the appropriate setOutput method.
-
-
Method Details
-
setOutput
Handles writing a Report to the writer interface. This is is useful if someone would like to put the contents of the Report to something such asStringWriter
.- Parameters:
writer
- which the report will be written to
-
setOutput
Handle writing a Report to anOutputStream
. This is useful to get the report to print to something such as System.out- Parameters:
os
- stream which the report will be written to
-
setOutput
Handles writing a Report to aFile
.- Parameters:
file
- which the report will output to- Throws:
IOException
- if there is an issue in writing the report to the file
-
printHeader
public void printHeader()This method will display the default header for the Vtool command line library reports. This is the standard header across all reports. -
addParameter
Adds the string supplied to the parameter section in the heading of the report.- Parameters:
parameter
- in a string form that represents something that was passed in when the tool was run
-
addConfiguration
Adds the string supplied to the configuration section in the heading of the report.- Parameters:
configuration
- in a string form that represents a configuration that was used during parsing and validation
-
printHeader
-
printHeader
Allows a Report to customize the header portion of the Report if necessary.- Parameters:
writer
- passed down to write header contents to
-
record
-
record
Allows a report to change how they manage reporting on a given file that has been parsed and validated. Also handles generating a status for a file and generating some summary statistics.- Parameters:
sourceUri
- reference to the file that is being reported onproblems
- the set of issues found with the file. to be reported on- Returns:
- status of the file (i.e. PASS, FAIL, or SKIP)
-
sortMessageSummary
-
recordSkip
-
printRecordSkip
-
printRecordMessages
protected abstract void printRecordMessages(PrintWriter writer, Status status, URI sourceUri, List<ValidationProblem> problems)Allows a report to customize how it handles reporting on a particular label.- Parameters:
writer
- passed on to write customized messages tosourceUri
- reference to the file that is being reported onproblems
- which to report on for this source
-
getNumPassed
public int getNumPassed()- Returns:
- number of labels that passed (had no errors)
-
getNumFailed
public int getNumFailed()- Returns:
- number of labels that failed (had one or more errors)
-
getNumSkipped
public int getNumSkipped()- Returns:
- number of files that were not recognized as a label
-
getTotalProducts
public int getTotalProducts() -
getTotalIntegrityChecks
public int getTotalIntegrityChecks() -
getTotalErrors
public int getTotalErrors()- Returns:
- total number of errors that were found across all labels inspected. Will not count errors generated from files that were considered skipped.
-
getTotalWarnings
public int getTotalWarnings()- Returns:
- total number of warning that were found across all labels inspected. Will not count warnings generated from files that were considered skipped.
-
getTotalInfos
public int getTotalInfos()- Returns:
- total number of info messages that were found across all labels inspected. Will not count info messages from files that were considered skipped.
-
hasErrors
public boolean hasErrors()- Returns:
- flag indicating if errors were found in the inspected files
-
hasWarnings
public boolean hasWarnings()- Returns:
- flag indicating if warnings were found in the inspected files
-
enableDeprecatedFlagWarning
public void enableDeprecatedFlagWarning()Enables deprecation warning message when deprecated CLI flags are used -
setLevel
Anything at or above the level will be reported. Default ExceptionType level is info and above- Parameters:
ExceptionType
- level on which items will be reported
-
getLevel
- Returns:
- ExceptionType level of items that will be reported on. Anything at or above this level will be reported on
-
getType
-