Generates a list of object identified by authority codes for a given
authority factory.
This class recognizes the following property values. Note that default values are
automatically generated for the "COUNT.*"
and "PERCENT.*"
entries.
Key | Remarks | Meaning |
---|---|---|
TITLE | Title of the web page to produce. | |
DESCRIPTION | optional | Description to write after the introductory paragraph. |
OBJECTS.KIND | Kind of objects listed in the page (e.g. Coordinate Reference Systems). | |
FACTORY.NAME | The name of the authority factory. | |
FACTORY.VERSION | The version of the authority factory. | |
FACTORY.VERSION.SUFFIX | optional | An optional text to write after the factory version (in the main text only). |
PRODUCT.NAME | Name of the product for which the report is generated. | |
PRODUCT.VERSION | Version of the product for which the report is generated. | |
PRODUCT.VERSION.SUFFIX | optional | An optional text to write after the product version (in the main text only). |
PRODUCT.URL | URL where more information is available about the product. | |
JAVADOC.GEOAPI | predefined | Base URL of GeoAPI javadoc. |
COUNT.OBJECTS | automatic | Number of identified objects. |
PERCENT.VALIDS | automatic | Percentage of objects successfully created (i.e. having no error). |
PERCENT.ANNOTATED | automatic | Percentage of objects having an annotation. |
PERCENT.DEPRECATED | automatic | Percentage of deprecated objects. |
FILENAME | predefined | Name of the file to create if the write(File) argument is a directory. |
How to use this class:
- Create a
Properties
map with the values documented in the above table. Default values exist for many keys, but may depend on the environment. It is safer to specify values explicitly when they are known, except the automatic ones. - Create a new
AuthorityCodesReport
with the above properties map given to the constructor. - Invoke one of the
add(…)
methods for the factory of identified objects to include in the HTML page. - Invoke
write(File)
.
- Since:
- 3.1
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected static class
A single row in the table produced byAuthorityCodesReport
. -
Field Summary
Modifier and TypeFieldDescriptionprotected final List
<AuthorityCodesReport.Row> The list of objects identified by the codes declared by the authority factory.Fields inherited from class org.opengis.test.report.Report
properties
-
Constructor Summary
ConstructorDescriptionAuthorityCodesReport
(Properties properties) Creates a new report generator using the given property values. -
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(CRSAuthorityFactory factory) Adds the Coordinate Reference Systems identified by all codes available from the given CRS authority factory.protected AuthorityCodesReport.Row
createRow
(String code, IdentifiedObject object) Creates a new row for the given authority code and identified object.protected AuthorityCodesReport.Row
createRow
(String code, FactoryException exception) Creates a new row for the given authority code and exception.protected AuthorityCodesReport.Row
newRow()
Returns a newAuthorityCodesReport.Row
instance.protected void
sortRows()
Sorts the rows before to write them.Formats the identified objects as a HTML page in the given file.
-
Field Details
-
rows
The list of objects identified by the codes declared by the authority factory. Elements are added in this list by any of theadd
methods.
-
-
Constructor Details
-
AuthorityCodesReport
Creates a new report generator using the given property values. See the class javadoc for a list of expected values.- Parameters:
properties
- the property values, ornull
for the default values.
-
-
Method Details
-
add
Adds the Coordinate Reference Systems identified by all codes available from the given CRS authority factory. This method performs the following steps:- Get the list of available codes for type
CoordinateReferenceSystem
withAuthorityFactory.getAuthorityCodes(Class)
. - For each code, try to instantiate an object with
CRSAuthorityFactory.createCoordinateReferenceSystem(String)
, then:- In case of success, invoke
createRow(String, IdentifiedObject)
; - In case of failure, invoke
createRow(String, FactoryException)
.
- In case of success, invoke
- If the
createRow(…)
method returned a non-null instance, add the created row to therows
list.
createRow(…)
methods in order to customize the table content.- Parameters:
factory
- the factory from which to get Coordinate Reference System instances.- Throws:
FactoryException
- if a non-recoverable error occurred while querying the factory.
- Get the list of available codes for type
-
newRow
Returns a newAuthorityCodesReport.Row
instance. Subclasses can override this method if they wish to instantiate a subclass ofRow
.- Returns:
- the new, initially empty,
Row
instance.
-
createRow
Creates a new row for the given authority code and identified object. Subclasses can override this method in order to customize the table content.- Parameters:
code
- the authority code of the created object.object
- the object created from the given authority code.- Returns:
- the created row, or
null
if the row should be ignored.
-
createRow
Creates a new row for the given authority code and exception. Subclasses can override this method in order to customize the table content.- Parameters:
code
- the authority code of the object to create.exception
- the exception that occurred while creating the identified object.- Returns:
- the created row, or
null
if the row should be ignored.
-
sortRows
Sorts the rows before to write them. The default implementation sort the rows by their natural ordering. Subclasses can override this method if they want to sort the rows otherwise, or if they want to add or remove rows before or after the sorting. -
write
Formats the identified objects as a HTML page in the given file.- Specified by:
write
in classReport
- Parameters:
destination
- the file to generate.- Returns:
- the given
destination
file. - Throws:
IOException
- if an error occurred while writing the report.
-