Class AuthorityCodesReport

Object
Report
AuthorityCodesReport

public class AuthorityCodesReport extends Report
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.

Report properties
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 predefinedBase 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 predefinedName of the file to create if the write(File) argument is a directory.

How to use this class:

  1. 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.
  2. Create a new AuthorityCodesReport with the above properties map given to the constructor.
  3. Invoke one of the add(…) methods for the factory of identified objects to include in the HTML page.
  4. Invoke write(File).
Since:
3.1
  • Field Details

    • rows

      protected final List<AuthorityCodesReport.Row> rows
      The list of objects identified by the codes declared by the authority factory. Elements are added in this list by any of the add methods.
  • Constructor Details

    • AuthorityCodesReport

      public AuthorityCodesReport(Properties properties)
      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, or null for the default values.
  • Method Details

    • add

      public void add(CRSAuthorityFactory factory) throws FactoryException
      Adds the Coordinate Reference Systems identified by all codes available from the given CRS authority factory. This method performs the following steps: Subclasses can override the above-cited 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.
    • add

      public void add(AuthorityFactory factory, Collection<String> codes) throws FactoryException
      Adds the objects identified by the given codes. This method performs the following steps: Subclasses can override the above-cited createRow(…) methods in order to customize the table content.
      Parameters:
      factory - the factory from which to get the objects.
      codes - the authority codes of the objects to create.
      Throws:
      FactoryException - if a non-recoverable error occurred while querying the factory.
    • newRow

      protected AuthorityCodesReport.Row newRow()
      Returns a new AuthorityCodesReport.Row instance. Subclasses can override this method if they wish to instantiate a subclass of Row.
      Returns:
      the new, initially empty, Row instance.
    • createRow

      protected AuthorityCodesReport.Row createRow(String code, IdentifiedObject object)
      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

      protected AuthorityCodesReport.Row createRow(String code, FactoryException exception)
      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

      protected void 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

      public File write(File destination) throws IOException
      Formats the identified objects as a HTML page in the given file.
      Specified by:
      write in class Report
      Parameters:
      destination - the file to generate.
      Returns:
      the given destination file.
      Throws:
      IOException - if an error occurred while writing the report.