Search in sources :

Example 1 with DataIntegrityJobParameters

use of org.hisp.dhis.scheduling.parameters.DataIntegrityJobParameters in project dhis2-core by dhis2.

the class DataIntegrityController method runDataIntegrityAsync.

private WebMessage runDataIntegrityAsync(Collection<String> checks, User currentUser, String description, DataIntegrityReportType type) {
    DataIntegrityJobParameters params = new DataIntegrityJobParameters();
    params.setChecks(toUniformCheckNames(checks));
    params.setType(type);
    JobConfiguration config = new JobConfiguration(description, JobType.DATA_INTEGRITY, null, params, true, true);
    config.setUserUid(currentUser.getUid());
    config.setAutoFields();
    if (!schedulingManager.executeNow(config)) {
        return conflict("Data integrity check is already running");
    }
    return jobConfigurationReport(config);
}
Also used : DataIntegrityJobParameters(org.hisp.dhis.scheduling.parameters.DataIntegrityJobParameters) JobConfiguration(org.hisp.dhis.scheduling.JobConfiguration)

Example 2 with DataIntegrityJobParameters

use of org.hisp.dhis.scheduling.parameters.DataIntegrityJobParameters in project dhis2-core by dhis2.

the class DataIntegrityJob method execute.

@Override
public void execute(JobConfiguration config, JobProgress progress) {
    DataIntegrityJobParameters parameters = (DataIntegrityJobParameters) config.getJobParameters();
    Set<String> checks = parameters == null ? Set.of() : parameters.getChecks();
    DataIntegrityReportType type = parameters == null ? null : parameters.getType();
    if (type == null || type == DataIntegrityReportType.REPORT) {
        runReport(config, progress, checks);
    } else if (type == DataIntegrityReportType.SUMMARY) {
        dataIntegrityService.runSummaryChecks(checks, progress);
    } else {
        dataIntegrityService.runDetailsChecks(checks, progress);
    }
}
Also used : DataIntegrityReportType(org.hisp.dhis.scheduling.parameters.DataIntegrityJobParameters.DataIntegrityReportType) DataIntegrityJobParameters(org.hisp.dhis.scheduling.parameters.DataIntegrityJobParameters)

Aggregations

DataIntegrityJobParameters (org.hisp.dhis.scheduling.parameters.DataIntegrityJobParameters)2 JobConfiguration (org.hisp.dhis.scheduling.JobConfiguration)1 DataIntegrityReportType (org.hisp.dhis.scheduling.parameters.DataIntegrityJobParameters.DataIntegrityReportType)1