mirror of https://github.com/micromata/borgbackup-butler.git

Kai Reinhard
28.19.2018 072b27a0e1f0ec459f388f5b62a82cd42c2476db
borgbutler-core/src/main/java/de/micromata/borgbutler/jobs/AbstractJob.java
@@ -1,5 +1,6 @@
package de.micromata.borgbutler.jobs;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.Setter;
@@ -10,6 +11,7 @@
    private boolean stopRequested;
    @Getter
    @Setter(AccessLevel.PACKAGE)
    private Status status;
    @Getter
    @Setter
@@ -21,10 +23,23 @@
    @Setter
    private String log;
    protected void stopped() {
        this.status = Status.STOPPED;
    /**
     *
     * @return true, if the job is done, stopped or failed. Otherwise false (if job is running or queued).
     */
    public boolean isFinished() {
        if (status == Status.DONE || status == Status.STOPPED || status == Status.FAILED) {
            return true;
        }
        return false;
    }
    public abstract void execute() throws InterruptedException;
    public abstract void execute();
    /**
     * A job is identified by this id. If a job with the same id is already queued (not yet finished), this job will
     * not be added twice.
     * @return
     */
    public abstract Object getId();
}