Search in sources :

Example 1 with ExceptionType

use of net.opengis.ows.x11.ExceptionType in project ddf by codice.

the class CswResponseExceptionMapper method convertToCswException.

private CswException convertToCswException(ExceptionReport report) {
    CswException cswException = null;
    List<ExceptionType> list = new ArrayList<ExceptionType>(report.getException());
    for (ExceptionType exceptionType : list) {
        String exceptionCode = exceptionType.getExceptionCode();
        String locator = exceptionType.getLocator();
        List<String> exceptionText = exceptionType.getExceptionText();
        StringBuilder exceptionMsg = new StringBuilder();
        // Exception code is required per CSW schema, but check it anyway
        if (StringUtils.isNotBlank(exceptionCode)) {
            exceptionMsg.append("exceptionCode = " + exceptionCode + "\n");
        } else {
            exceptionMsg.append("exceptionCode = UNSPECIFIED");
        }
        // Locator and exception text(s) are both optional
        if (StringUtils.isNotBlank(locator)) {
            exceptionMsg.append("locator = " + locator + "\n");
        }
        if (!CollectionUtils.isEmpty(exceptionText)) {
            for (String text : exceptionText) {
                exceptionMsg.append(text);
            }
        }
        cswException = new CswException(exceptionMsg.toString());
    }
    if (null == cswException) {
        cswException = new CswException("Empty Exception Report (version = " + report.getVersion() + ")");
    }
    return cswException;
}
Also used : ExceptionType(net.opengis.ows.v_1_0_0.ExceptionType) CswException(org.codice.ddf.spatial.ogc.csw.catalog.common.CswException) ArrayList(java.util.ArrayList)

Example 2 with ExceptionType

use of net.opengis.ows.x11.ExceptionType in project tesb-rt-se by Talend.

the class LibraryServerImpl method prepareException.

private SeekBookError prepareException(String message) {
    ExceptionType exception = new ExceptionType();
    exception.setOperation("seekBook");
    exception.setServiceName("LibraryService");
    exception.setExceptionText(message);
    ExceptionFrame frame = new ExceptionFrame();
    frame.getException().add(exception);
    return new SeekBookError("Book not found", frame);
}
Also used : ExceptionType(org.talend.types.test.generalobjects.errorhandling._1.ExceptionType) SeekBookError(org.talend.services.test.library._1_0.SeekBookError) ExceptionFrame(org.talend.types.test.generalobjects.errorhandling._1.ExceptionFrame)

Example 3 with ExceptionType

use of net.opengis.ows.x11.ExceptionType in project tesb-rt-se by Talend.

the class LibraryServerImpl method prepareException.

private SeekBookError prepareException(String message) {
    ExceptionType exception = new ExceptionType();
    exception.setOperation("seekBook");
    exception.setServiceName("LibraryService");
    exception.setExceptionText(message);
    ExceptionFrame frame = new ExceptionFrame();
    frame.getException().add(exception);
    SeekBookError e = new SeekBookError("Book not found", frame);
    return e;
}
Also used : ExceptionType(org.talend.types.demos.generalobjects.errorhandling._1.ExceptionType) SeekBookError(org.talend.services.demos.library._1_0.SeekBookError) ExceptionFrame(org.talend.types.demos.generalobjects.errorhandling._1.ExceptionFrame)

Example 4 with ExceptionType

use of net.opengis.ows.x11.ExceptionType in project tesb-rt-se by Talend.

the class LibraryServerImpl method prepareException.

private SeekBookError prepareException(String message) {
    ExceptionType exception = new ExceptionType();
    exception.setOperation("seekBook");
    exception.setServiceName("LibraryService");
    exception.setExceptionText(message);
    ExceptionFrame frame = new ExceptionFrame();
    frame.getException().add(exception);
    return new SeekBookError("Book not found", frame);
}
Also used : ExceptionType(org.talend.types.test.generalobjects.errorhandling._1.ExceptionType) SeekBookError(org.talend.services.test.library._1_0.SeekBookError) ExceptionFrame(org.talend.types.test.generalobjects.errorhandling._1.ExceptionFrame)

Example 5 with ExceptionType

use of net.opengis.ows.x11.ExceptionType 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)

Aggregations

SeekBookError (org.talend.services.test.library._1_0.SeekBookError)5 ExceptionFrame (org.talend.types.test.generalobjects.errorhandling._1.ExceptionFrame)5 ExceptionType (org.talend.types.test.generalobjects.errorhandling._1.ExceptionType)5 ExceptionType (org.oasis_open.docs.ws_tx.wsba._2006._06.ExceptionType)4 ArrayList (java.util.ArrayList)3 ExceptionType (net.opengis.ows.x11.ExceptionType)3 Task (com.arjuna.services.framework.task.Task)2 ArjunaContext (com.arjuna.webservices11.wsarj.ArjunaContext)2 Action (javax.xml.ws.Action)2 MessageContext (javax.xml.ws.handler.MessageContext)2 ExceptionType (net.opengis.ows.v_1_0_0.ExceptionType)2 MAP (org.jboss.ws.api.addressing.MAP)2 MAPEndpoint (org.jboss.ws.api.addressing.MAPEndpoint)2 SuppressFBWarnings (edu.umd.cs.findbugs.annotations.SuppressFBWarnings)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 PrintStream (java.io.PrintStream)1 ExceptionReport (net.opengis.ows.v_1_0_0.ExceptionReport)1 ExceptionType (net.opengis.ows.v_1_1_0.ExceptionType)1 ExceptionDocument (net.opengis.ows.x11.ExceptionDocument)1 ExceptionReportDocument (net.opengis.ows.x11.ExceptionReportDocument)1