use of org.n52.io.handler.simple.SimpleCsvIoHandler in project series-rest-api by 52North.
the class QuantityIoFactory method createHandler.
@Override
public IoHandler<Data<QuantityValue>> createHandler(String outputMimeType) {
IoParameters parameters = getParameters();
Constants.MimeType mimeType = Constants.MimeType.toInstance(outputMimeType);
if (mimeType == Constants.MimeType.IMAGE_PNG) {
return createMultiChartRenderer(mimeType);
} else if (mimeType == Constants.MimeType.APPLICATION_PDF) {
ChartIoHandler imgRenderer = createMultiChartRenderer(mimeType);
return new PDFReportGenerator(parameters, createProcessChain(), imgRenderer);
} else if (isCsvOutput(mimeType)) {
CsvIoHandler<QuantityValue> handler = new SimpleCsvIoHandler<>(parameters, createProcessChain(), getMetadatas());
boolean zipOutput = parameters.getAsBoolean(Parameters.ZIP, false);
handler.setZipOutput(zipOutput || mimeType == Constants.MimeType.APPLICATION_ZIP);
return handler;
}
String msg = "The requested media type '" + outputMimeType + "' is not supported.";
IllegalArgumentException exception = new IllegalArgumentException(msg);
throw exception;
}
Aggregations