Search in sources :

Example 1 with DatasetOutput

use of org.n52.io.response.dataset.DatasetOutput in project series-rest-api by 52North.

the class PDFReportGenerator method generateTimeseriesMetadata.

private void generateTimeseriesMetadata() {
    for (DatasetOutput metadata : getSeriesMetadatas()) {
        TimeSeries timeseries = addTimeseries(metadata);
        // addDataTable(timeseries, metadata, data);
        addMetadata(timeseries, metadata);
    }
}
Also used : TimeSeries(org.n52.oxf.DocumentStructureType.TimeSeries) DatasetOutput(org.n52.io.response.dataset.DatasetOutput)

Example 2 with DatasetOutput

use of org.n52.io.response.dataset.DatasetOutput in project series-rest-api by 52North.

the class PDFReportGenerator method addTimeseries.

private TimeSeries addTimeseries(DatasetOutput metadata) {
    DocumentStructureType report = document.getDocumentStructure();
    TimeSeries timeseries = report.addNewTimeSeries();
    SeriesParameters parameters = metadata.getSeriesParameters();
    timeseries.setFeatureOfInterestID(parameters.getFeature().getLabel());
    timeseries.setPhenomenID(parameters.getPhenomenon().getLabel());
    timeseries.setProcedureID(parameters.getProcedure().getLabel());
    return timeseries;
}
Also used : TimeSeries(org.n52.oxf.DocumentStructureType.TimeSeries) SeriesParameters(org.n52.io.response.dataset.SeriesParameters) DocumentStructureType(org.n52.oxf.DocumentStructureType)

Example 3 with DatasetOutput

use of org.n52.io.response.dataset.DatasetOutput in project series-rest-api by 52North.

the class RenderingHintsExtension method getExtras.

@Override
public Map<String, Object> getExtras(DatasetOutput output, IoParameters parameters) {
    if (!hasExtrasToReturn(output, parameters)) {
        return Collections.emptyMap();
    }
    if (hasSeriesConfiguration(output)) {
        final StyleProperties style = createStyle(getSeriesStyle(output));
        checkForBackwardCompatiblity(output, style);
        return wrapSingleIntoMap(style);
    } else if (hasPhenomenonConfiguration(output)) {
        final StyleProperties style = createStyle(getPhenomenonStyle(output));
        checkForBackwardCompatiblity(output, style);
        return wrapSingleIntoMap(style);
    }
    LOGGER.error("No rendering style found for {} (id={})", output, output.getId());
    return Collections.emptyMap();
}
Also used : StyleProperties(org.n52.io.request.StyleProperties)

Example 4 with DatasetOutput

use of org.n52.io.response.dataset.DatasetOutput in project series-rest-api by 52North.

the class IoStyleContext method createContextForSingleSeries.

public static IoStyleContext createContextForSingleSeries(DatasetOutput metadata, IoParameters ioConfig) {
    RequestStyledParameterSet parameters = ioConfig.toStyledParameterSet();
    parameters.addSeriesWithStyleOptions(metadata.getId(), ioConfig.getStyle());
    return createContextWith(parameters, Collections.singletonList(metadata));
}
Also used : RequestStyledParameterSet(org.n52.io.request.RequestStyledParameterSet)

Example 5 with DatasetOutput

use of org.n52.io.response.dataset.DatasetOutput in project series-rest-api by 52North.

the class ChartIoHandler method formatTitle.

protected String formatTitle(DatasetOutput metadata, String title) {
    SeriesParameters parameters = metadata.getSeriesParameters();
    Object[] varargs = { // index important to reference in config!
    parameters.getPlatform().getLabel(), parameters.getPhenomenon().getLabel(), parameters.getProcedure().getLabel(), parameters.getCategory().getLabel(), parameters.getOffering().getLabel(), parameters.getFeature().getLabel(), parameters.getService().getLabel(), metadata.getUom() };
    try {
        return String.format(title, varargs);
    } catch (Exception e) {
        String datasetId = metadata.getId();
        LOGGER.info("Couldn't format title while prerendering dataset '{}'", datasetId, e);
        // return template as fallback
        return title;
    }
}
Also used : SeriesParameters(org.n52.io.response.dataset.SeriesParameters) IoParseException(org.n52.io.IoParseException) IOException(java.io.IOException)

Aggregations

DatasetOutput (org.n52.io.response.dataset.DatasetOutput)4 ParameterOutput (org.n52.io.response.ParameterOutput)3 SeriesParameters (org.n52.io.response.dataset.SeriesParameters)3 IOException (java.io.IOException)2 IoParameters (org.n52.io.request.IoParameters)2 RequestStyledParameterSet (org.n52.io.request.RequestStyledParameterSet)2 StyleProperties (org.n52.io.request.StyleProperties)2 QuantityData (org.n52.io.response.dataset.quantity.QuantityData)2 TimeSeries (org.n52.oxf.DocumentStructureType.TimeSeries)2 FileOutputStream (java.io.FileOutputStream)1 HashMap (java.util.HashMap)1 DateTime (org.joda.time.DateTime)1 IoParseException (org.n52.io.IoParseException)1 RenderingConfig (org.n52.io.PrerenderingJobConfig.RenderingConfig)1 ChartDimension (org.n52.io.quantity.img.ChartDimension)1 RequestSimpleParameterSet (org.n52.io.request.RequestSimpleParameterSet)1 ReferenceValueOutput (org.n52.io.response.dataset.ReferenceValueOutput)1 TimeseriesMetadataOutput (org.n52.io.response.dataset.TimeseriesMetadataOutput)1 QuantityDatasetMetadata (org.n52.io.response.dataset.quantity.QuantityDatasetMetadata)1 QuantityValue (org.n52.io.response.dataset.quantity.QuantityValue)1