Search in sources :

Example 1 with IntervalWithTimeZone

use of org.n52.io.IntervalWithTimeZone in project series-rest-api by 52North.

the class RequestParameterSet method createDefaultTimespan.

private String createDefaultTimespan() {
    DateTime now = new DateTime();
    DateTime lastWeek = now.minusWeeks(1);
    String interval = lastWeek.toString().concat("/").concat(now.toString());
    return new IntervalWithTimeZone(interval).toString();
}
Also used : IntervalWithTimeZone(org.n52.io.IntervalWithTimeZone) DateTime(org.joda.time.DateTime)

Example 2 with IntervalWithTimeZone

use of org.n52.io.IntervalWithTimeZone in project series-rest-api by 52North.

the class RequestSimpleParameterSet method createForSingleSeries.

public static RequestSimpleParameterSet createForSingleSeries(String seriesId, IoParameters parameters) {
    RequestSimpleParameterSet parameterSet = parameters.toSimpleParameterSet();
    parameterSet.setDatasets(new String[] { seriesId });
    IntervalWithTimeZone timespan = parameters.getTimespan();
    parameterSet.setTimespan(timespan.toString());
    return parameterSet;
}
Also used : IntervalWithTimeZone(org.n52.io.IntervalWithTimeZone)

Example 3 with IntervalWithTimeZone

use of org.n52.io.IntervalWithTimeZone in project series-rest-api by 52North.

the class ChartIoHandler method getTimespan.

private String getTimespan() {
    IoParameters parameters = getParameters();
    IntervalWithTimeZone timespan = parameters.getTimespan();
    return timespan.toString();
}
Also used : IoParameters(org.n52.io.request.IoParameters) IntervalWithTimeZone(org.n52.io.IntervalWithTimeZone)

Example 4 with IntervalWithTimeZone

use of org.n52.io.IntervalWithTimeZone in project series-rest-api by 52North.

the class PreRenderingJob method renderWithStyle.

private void renderWithStyle(String datasetId, RenderingConfig renderingConfig, String interval) throws IOException, DatasetFactoryException, URISyntaxException {
    IntervalWithTimeZone timespan = createTimespanFromInterval(datasetId, interval);
    IoParameters parameters = createConfig(datasetId, timespan.toString(), renderingConfig);
    String chartQualifier = renderingConfig.getChartQualifier();
    FileOutputStream fos = createFile(datasetId, interval, chartQualifier);
    try (FileOutputStream out = fos) {
        createIoFactory(parameters).createHandler(IMAGE_EXTENSION).writeBinary(out);
        fos.flush();
    } catch (IoHandlerException | IOException e) {
        LOGGER.error("Image creation occures error.", e);
    }
}
Also used : IoHandlerException(org.n52.io.handler.IoHandlerException) FileOutputStream(java.io.FileOutputStream) IntervalWithTimeZone(org.n52.io.IntervalWithTimeZone) IoParameters(org.n52.io.request.IoParameters) IOException(java.io.IOException)

Example 5 with IntervalWithTimeZone

use of org.n52.io.IntervalWithTimeZone in project series-rest-api by 52North.

the class IoParameters method createDefaultTimespan.

private IntervalWithTimeZone createDefaultTimespan() {
    DateTime now = new DateTime();
    DateTime lastWeek = now.minusWeeks(1);
    String interval = lastWeek.toString().concat("/").concat(now.toString());
    return new IntervalWithTimeZone(interval);
}
Also used : IntervalWithTimeZone(org.n52.io.IntervalWithTimeZone) DateTime(org.joda.time.DateTime)

Aggregations

IntervalWithTimeZone (org.n52.io.IntervalWithTimeZone)8 IoParameters (org.n52.io.request.IoParameters)4 DateTime (org.joda.time.DateTime)3 FileOutputStream (java.io.FileOutputStream)2 IOException (java.io.IOException)2 RequestSimpleParameterSet (org.n52.io.request.RequestSimpleParameterSet)2 DateTimeFormatter (org.joda.time.format.DateTimeFormatter)1 Test (org.junit.jupiter.api.Test)1 IoHandlerException (org.n52.io.handler.IoHandlerException)1 ChartDimension (org.n52.io.quantity.img.ChartDimension)1 RequestStyledParameterSet (org.n52.io.request.RequestStyledParameterSet)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1 ModelAndView (org.springframework.web.servlet.ModelAndView)1