use of net.opengis.ows.v_1_1_0.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 net.opengis.ows.v_1_1_0.ExceptionType in project ddf by codice.
the class CswExceptionMapper method createServiceException.
private ExceptionReport createServiceException(CswException cswException) {
ExceptionReport exceptionReport = new ExceptionReport();
exceptionReport.setVersion(SERVICE_EXCEPTION_REPORT_VERSION);
ExceptionType exception = new ExceptionType();
exception.setExceptionCode(cswException.getExceptionCode());
exception.setLocator(cswException.getLocator());
exception.getExceptionText().add(cswException.getMessage());
exceptionReport.getException().add(exception);
return exceptionReport;
}
use of net.opengis.ows.v_1_1_0.ExceptionType in project ddf by codice.
the class WfsResponseExceptionMapper method convertToWfsException.
private WfsException convertToWfsException(ExceptionReport report) {
WfsException wfsException = null;
List<ExceptionType> list = new ArrayList<ExceptionType>(report.getException());
if (list.size() > 0) {
Collections.reverse(list);
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);
}
}
wfsException = new WfsException(exceptionMsg.toString());
}
if (null == wfsException) {
wfsException = new WfsException("Empty Service Exception Report (version = " + report.getVersion() + ")");
}
} else {
wfsException = new WfsException("Empty Service Exception Report (version = " + report.getVersion() + ")");
}
return wfsException;
}
Aggregations