use of org.talend.types.test.generalobjects.errorhandling._1.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;
}
use of org.talend.types.test.generalobjects.errorhandling._1.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);
}
use of org.talend.types.test.generalobjects.errorhandling._1.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;
}
use of org.talend.types.test.generalobjects.errorhandling._1.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);
}
use of org.talend.types.test.generalobjects.errorhandling._1.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;
}
Aggregations