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

Kai Reinhard
15.39.2018 60b424b101e42fa1aadb9300f32a842c9681a092
borgbutler-core/src/main/java/de/micromata/borgbutler/data/Archive.java
@@ -5,16 +5,32 @@
import de.micromata.borgbutler.json.borg.BorgEncryption;
import lombok.Getter;
import lombok.Setter;
import org.apache.commons.lang3.StringUtils;
import java.io.Serializable;
/**
 *
 */
public class Archive implements Serializable {
public class Archive implements Serializable, Comparable<Archive> {
    /**
     * For convenience purposes for the client.
     */
    @Getter
    @Setter
    private Repository repository;
    private String repoName;
    /**
     * For convenience purposes for the client.
     */
    @Getter
    @Setter
    private String repoId;
    @Getter
    @Setter
    private String name;
    @Getter
    @Setter
    private String id;
    @Getter
    @Setter
    private BorgCache cache;
@@ -39,6 +55,40 @@
    private String start;
    @Getter
    @Setter
    private String time;
    @Getter
    @Setter
    private BorgArchiveStats stats;
    @Getter
    @Setter
    private String username;
    /**
     *
     * @return repoName::archiveName
     */
    public String getBorgIdentifier() {
        return repoName + "::" + name;
    }
    /**
     * Is <tt>borg info repo::archive</tt> already called for this archive?
     *
     * @return true, if borg info was called, otherwise false.
     */
    public boolean hasInfoData() {
        return commandLine != null && commandLine.length > 0;
    }
    /**
     * In reverse order, compares times.
     *
     * @param o
     * @return
     */
    @Override
    public int compareTo(Archive o) {
        // Reverse order:
        return StringUtils.compare(o.time, this.time);
    }
}