Class CsvQueryResponseTransformer

java.lang.Object
ddf.catalog.transformer.csv.CsvQueryResponseTransformer
All Implemented Interfaces:
ddf.catalog.transform.QueryResponseTransformer

public class CsvQueryResponseTransformer extends Object implements ddf.catalog.transform.QueryResponseTransformer
An implementation of QueryResponseTransformer that produces CSV output.
See Also:
  • QueryResponseTransformer
  • Constructor Details

    • CsvQueryResponseTransformer

      public CsvQueryResponseTransformer()
  • Method Details

    • transform

      public ddf.catalog.data.BinaryContent transform(ddf.catalog.operation.SourceResponse upstreamResponse, Map<String,Serializable> arguments) throws ddf.catalog.transform.CatalogTransformerException
      Specified by:
      transform in interface ddf.catalog.transform.QueryResponseTransformer
      Parameters:
      upstreamResponse - the SourceResponse to be converted.
      arguments - this transformer accepts 2 parameters in the 'arguments' map.
      1. key: 'columnOrder' value: a List of attribute names (as strings) that specifies the order in which the columns will appear in the output.
      2. key: 'aliases' value: a Map with keys that are attribute names and with values that are the corresponding column headers that will be printed in the output. For example, if the key is 'title' and the value is 'Product' then the resulting CSV will have a column name of 'Product' instead of 'title'.
      Returns:
      a BinaryContent object that contains an InputStream with the CSV content.
      Throws:
      ddf.catalog.transform.CatalogTransformerException - during processing, the CSV output is written to an Appendable, whose 'append()' method signature declares that it throws IOException. When that Appendable throws IOException, this class will theoretically convert that into a CatalogTransformerException and raise that. Because this implementation uses a StringBuilder which doesn't throw IOException, this will never occur.