use of net.geoprism.dhis2.dhis2adapter.response.model.ErrorReport in project geoprism-registry by terraframe.
the class DHIS2SynchronizationManager method recordExportError.
private void recordExportError(DHIS2SyncError ee, ExportHistory history) {
DHIS2ImportResponse resp = ee.response;
Throwable ex = ee.error;
String geoObjectCode = ee.geoObjectCode;
ExportError exportError = new ExportError();
if (ee.submittedJson != null) {
exportError.setSubmittedJson(ee.submittedJson);
}
if (resp != null) {
if (resp.getResponse() != null && resp.getResponse().length() > 0) {
exportError.setResponseJson(resp.getResponse());
if (resp.hasErrorReports()) {
List<ErrorReport> reports = resp.getErrorReports();
ErrorReport report = reports.get(0);
exportError.setErrorMessage(report.getMessage());
}
}
exportError.setErrorCode(resp.getStatusCode());
}
exportError.setCode(geoObjectCode);
if (ex != null) {
exportError.setErrorJson(JobHistory.exceptionToJson(ex).toString());
}
exportError.setRowIndex(ee.rowIndex);
exportError.setHistory(history);
exportError.apply();
}
Aggregations