Search in sources :

Example 1 with VacuumListenerImpl

use of com.enonic.xp.app.system.listener.VacuumListenerImpl in project xp by enonic.

the class VacuumTaskHandler method execute.

public void execute() {
    final ProgressReporter progressReporter = TaskProgressReporterContext.current();
    final VacuumResult result = vacuumService.vacuum(VacuumParameters.create().ageThreshold(ageThreshold != null ? Duration.parse(ageThreshold) : null).taskNames(tasks == null || tasks.isEmpty() ? DEFAULT_VACUUM_TASKS : tasks).vacuumListener(new VacuumListenerImpl(progressReporter)).build());
    try {
        progressReporter.info(MAPPER.writeValueAsString(MAPPER.createObjectNode().putPOJO("taskResults", result.getResults())));
    } catch (JsonProcessingException e) {
        throw new RuntimeException(e);
    }
}
Also used : VacuumResult(com.enonic.xp.vacuum.VacuumResult) ProgressReporter(com.enonic.xp.task.ProgressReporter) JsonProcessingException(com.fasterxml.jackson.core.JsonProcessingException) VacuumListenerImpl(com.enonic.xp.app.system.listener.VacuumListenerImpl)

Aggregations

VacuumListenerImpl (com.enonic.xp.app.system.listener.VacuumListenerImpl)1 ProgressReporter (com.enonic.xp.task.ProgressReporter)1 VacuumResult (com.enonic.xp.vacuum.VacuumResult)1 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)1