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

Kai Reinhard
29.52.2018 fcb7fffe9ab6b5d08bae9e7dbd703096b567e3d6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package de.micromata.borgbutler.data;
 
import lombok.Getter;
import lombok.Setter;
import org.apache.commons.lang3.StringUtils;
 
import java.io.Serializable;
 
/**
 * Used e. g. for the drop down box for comparing current archive with others.
 */
public class ArchiveShortInfo implements Serializable, Comparable<ArchiveShortInfo> {
    /**
     * For convenience purposes for the client.
     */
    @Getter
    @Setter
    private String repoName;
    @Getter
    @Setter
    private String repoId;
    @Getter
    @Setter
    private String name;
    @Getter
    @Setter
    private String id;
    @Getter
    @Setter
    private String time;
    /**
     * Is the file list of this archive loaded and available in Butler's cache.
     */
    @Getter
    @Setter
    private boolean fileListAlreadyCached;
 
    public ArchiveShortInfo() {
 
    }
 
    public ArchiveShortInfo(Archive archive) {
        this.id = archive.getId();
        this.name = archive.getName();
        this.repoId = archive.getRepoId();
        this.time = archive.getTime();
        this.fileListAlreadyCached = archive.isFileListAlreadyCached();
    }
 
    /**
     * In reverse order, compares times.
     *
     * @param o
     * @return
     */
    @Override
    public int compareTo(ArchiveShortInfo o) {
        // Reverse order:
        return StringUtils.compare(o.time, this.time);
    }
}