Search in sources :

Example 1 with ExceptionReport

use of net.opengis.ows.x11.ExceptionReportDocument.ExceptionReport in project arctic-sea by 52North.

the class OwsEncoderv110 method encodeOwsExceptionReport.

private ExceptionReportDocument encodeOwsExceptionReport(final OwsExceptionReport owsExceptionReport) {
    ExceptionReportDocument erd = ExceptionReportDocument.Factory.newInstance(getXmlOptions());
    ExceptionReport er = erd.addNewExceptionReport();
    // er.setLanguage("en");
    er.setVersion(owsExceptionReport.getVersion());
    List<ExceptionType> exceptionTypes = new ArrayList<>(owsExceptionReport.getExceptions().size());
    owsExceptionReport.getExceptions().stream().map(this::encodeOwsException).map(ExceptionDocument::getException).forEach(exceptionTypes::add);
    er.setExceptionArray(exceptionTypes.toArray(new ExceptionType[exceptionTypes.size()]));
    N52XmlHelper.setSchemaLocationsToDocument(erd, Collections.singletonList(N52XmlHelper.getSchemaLocationForOWS110()));
    return erd;
}
Also used : ExceptionType(net.opengis.ows.x11.ExceptionType) ExceptionReport(net.opengis.ows.x11.ExceptionReportDocument.ExceptionReport) OwsExceptionReport(org.n52.shetland.ogc.ows.exception.OwsExceptionReport) ArrayList(java.util.ArrayList) ExceptionReportDocument(net.opengis.ows.x11.ExceptionReportDocument)

Example 2 with ExceptionReport

use of net.opengis.ows.x11.ExceptionReportDocument.ExceptionReport in project arctic-sea by 52North.

the class OwsExceptionReportDecoder method decode.

private OwsExceptionReport decode(ExceptionReport report) {
    String version = report.getVersion();
    ExceptionType[] exceptionTypes = report.getExceptionArray();
    List<CodedException> exceptions = Streams.stream(exceptionTypes).map(this::decode).collect(toList());
    return new CompositeOwsException(exceptions).setVersion(version);
}
Also used : ExceptionType(net.opengis.ows.x11.ExceptionType) CodedException(org.n52.shetland.ogc.ows.exception.CodedException) CompositeOwsException(org.n52.shetland.ogc.ows.exception.CompositeOwsException)

Aggregations

ExceptionType (net.opengis.ows.x11.ExceptionType)2 ArrayList (java.util.ArrayList)1 ExceptionReportDocument (net.opengis.ows.x11.ExceptionReportDocument)1 ExceptionReport (net.opengis.ows.x11.ExceptionReportDocument.ExceptionReport)1 CodedException (org.n52.shetland.ogc.ows.exception.CodedException)1 CompositeOwsException (org.n52.shetland.ogc.ows.exception.CompositeOwsException)1 OwsExceptionReport (org.n52.shetland.ogc.ows.exception.OwsExceptionReport)1