public class CsvQueryResponseTransformer extends Object implements QueryResponseTransformer
QueryResponseTransformer
Constructor and Description |
---|
CsvQueryResponseTransformer() |
Modifier and Type | Method and Description |
---|---|
BinaryContent |
transform(SourceResponse upstreamResponse,
Map<String,Serializable> arguments)
Transforms the list of results into the
BinaryContent . |
public BinaryContent transform(SourceResponse upstreamResponse, Map<String,Serializable> arguments) throws CatalogTransformerException
QueryResponseTransformer
BinaryContent
.transform
in interface QueryResponseTransformer
upstreamResponse
- the SourceResponse to be converted.arguments
- this transformer accepts 3 parameters in the 'arguments' map. 1) key:
'hiddenFields' value: a java.util.Set containing Attribute names (as Strings) to be
excluded from the output. 2) key: 'attributeOrder' value: a java.utilList containing
Attribute name (as Strings) to identify the order that the columns will appear in the
output. 3) key: 'aliases' value: a java.util.Map whose keys are attribute names and values
are the how that attribute column should be aliased 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'.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.This work is licensed under a Creative Commons Attribution 4.0 International License.