use of org.hisp.dhis.feedback.Status in project dhis2-core by dhis2.
the class MetadataRetryContext method setupImportReport.
//----------------------------------------------------------------------------------------
// Private Methods
//----------------------------------------------------------------------------------------
private void setupImportReport(ImportReport importReport) {
Status status = importReport.getStatus();
if (Status.ERROR.equals(status)) {
StringBuilder report = new StringBuilder();
List<ErrorReport> errorReports = importReport.getErrorReports();
for (ErrorReport errorReport : errorReports) {
if (errorReport != null) {
report.append(errorReport.toString() + "\n");
}
}
retryContext.setAttribute(MetadataSyncTask.METADATA_SYNC_REPORT, report.toString());
}
}
use of org.hisp.dhis.feedback.Status in project dhis2-core by dhis2.
the class MetadataRetryContext method setupImportReport.
// ----------------------------------------------------------------------------------------
// Private Methods
// ----------------------------------------------------------------------------------------
private void setupImportReport(ImportReport importReport) {
Status status = importReport.getStatus();
if (Status.ERROR == status) {
StringBuilder report = new StringBuilder();
importReport.forEachErrorReport(errorReport -> report.append(errorReport.toString() + "\n"));
retryContext.setAttribute(MetadataSyncJob.METADATA_SYNC_REPORT, report.toString());
}
}
use of org.hisp.dhis.feedback.Status in project dhis2-core by dhis2.
the class MetadataSyncPostProcessor method handleSyncNotificationsAndAbortStatus.
public boolean handleSyncNotificationsAndAbortStatus(MetadataSyncSummary metadataSyncSummary, MetadataRetryContext retryContext, MetadataVersion dataVersion) {
ImportReport importReport = metadataSyncSummary.getImportReport();
if (importReport == null) {
handleImportFailedContext(null, retryContext, dataVersion);
return true;
}
Status syncStatus = importReport.getStatus();
log.info("Import completed. Import Status: " + syncStatus);
if (Status.OK.equals(syncStatus) || (Status.WARNING.equals(syncStatus) && VersionType.BEST_EFFORT.equals(dataVersion.getType()))) {
sendSuccessMailToAdmin(metadataSyncSummary);
return false;
}
if (Status.ERROR.equals(syncStatus)) {
handleImportFailedContext(metadataSyncSummary, retryContext, dataVersion);
return true;
}
return false;
}
Aggregations