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

Kai Reinhard
15.39.2021 d80a4b3ab35af575fd06d4e2fb9a3726418c6727
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
package de.micromata.borgbutler.data;
 
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.
     */
    private String repoName;
    private String repoId;
    private String name;
    private String id;
    private String time;
    /**
     * Is the file list of this archive loaded and available in Butler's cache.
     */
    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);
    }
 
    public String getRepoName() {
        return this.repoName;
    }
 
    public String getRepoId() {
        return this.repoId;
    }
 
    public String getName() {
        return this.name;
    }
 
    public String getId() {
        return this.id;
    }
 
    public String getTime() {
        return this.time;
    }
 
    public boolean isFileListAlreadyCached() {
        return this.fileListAlreadyCached;
    }
 
    public ArchiveShortInfo setRepoName(String repoName) {
        this.repoName = repoName;
        return this;
    }
 
    public ArchiveShortInfo setRepoId(String repoId) {
        this.repoId = repoId;
        return this;
    }
 
    public ArchiveShortInfo setName(String name) {
        this.name = name;
        return this;
    }
 
    public ArchiveShortInfo setId(String id) {
        this.id = id;
        return this;
    }
 
    public ArchiveShortInfo setTime(String time) {
        this.time = time;
        return this;
    }
 
    public ArchiveShortInfo setFileListAlreadyCached(boolean fileListAlreadyCached) {
        this.fileListAlreadyCached = fileListAlreadyCached;
        return this;
    }
}