use of org.n52.io.type.quantity.handler.img.ChartIoHandler in project series-rest-api by 52North.
the class QuantityIoFactory method createHandler.
@Override
public IoHandler<QuantityData> createHandler(String outputMimeType) {
IoParameters parameters = getParameters();
MimeType mimeType = MimeType.toInstance(outputMimeType);
if (mimeType == MimeType.IMAGE_PNG) {
return createMultiChartRenderer(mimeType);
} else if (mimeType == MimeType.APPLICATION_PDF) {
ChartIoHandler imgRenderer = createMultiChartRenderer(mimeType);
PDFReportGenerator reportGenerator = new PDFReportGenerator(getRequestParameters(), createProcessChain(), imgRenderer);
reportGenerator.setBaseURI(getBasePath());
return reportGenerator;
} else if (mimeType == MimeType.TEXT_CSV || mimeType == MimeType.APPLICATION_ZIP) {
QuantityCsvIoHandler handler = new QuantityCsvIoHandler(getRequestParameters(), createProcessChain(), getMetadatas());
handler.setTokenSeparator(parameters.getOther("tokenSeparator"));
boolean zipOutput = parameters.getAsBoolean(MimeType.APPLICATION_ZIP.name());
handler.setZipOutput(zipOutput || mimeType == MimeType.APPLICATION_ZIP);
boolean byteOderMark = Boolean.parseBoolean(parameters.getOther("bom"));
handler.setIncludeByteOrderMark(byteOderMark);
return handler;
}
String msg = "The requested media type '" + outputMimeType + "' is not supported.";
IllegalArgumentException exception = new IllegalArgumentException(msg);
throw exception;
}
use of org.n52.io.type.quantity.handler.img.ChartIoHandler 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