Search in sources :

Example 1 with Status

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());
    }
}
Also used : Status(org.hisp.dhis.feedback.Status) ErrorReport(org.hisp.dhis.feedback.ErrorReport)

Example 2 with Status

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());
    }
}
Also used : Status(org.hisp.dhis.feedback.Status)

Example 3 with Status

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;
}
Also used : Status(org.hisp.dhis.feedback.Status) ImportReport(org.hisp.dhis.dxf2.metadata.feedback.ImportReport)

Aggregations

Status (org.hisp.dhis.feedback.Status)3 ImportReport (org.hisp.dhis.dxf2.metadata.feedback.ImportReport)1 ErrorReport (org.hisp.dhis.feedback.ErrorReport)1