All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.icij.extract.tasks.WipeReportTask Maven / Gradle / Ivy

There is a newer version: 7.4.0
Show newest version
package org.icij.extract.tasks;

import org.icij.extract.report.ReportMap;
import org.icij.extract.report.ReportMapFactory;
import org.icij.task.DefaultTask;
import org.icij.task.annotation.OptionsClass;
import org.icij.task.annotation.Task;

/**
 * CLI class for wiping a report from the backend.
 *
 *
 */
@Task("Wipe a report.")
@OptionsClass(ReportMapFactory.class)
public class WipeReportTask extends DefaultTask {

	@Override
	public Integer call() throws Exception {
		final int cleared;

		try (final ReportMap reportMap = new ReportMapFactory(options).createShared()) {
			cleared = reportMap.size();
			reportMap.clear();
		} catch (Exception e) {
			throw new RuntimeException("Unexpected exception while wiping report.", e);
		}

		return cleared;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy