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

...
Kai Reinhard
16.52.2018 78d82418ff8fa4212dbdeec904512092f1a5ac67
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
102
103
104
105
106
107
108
109
110
111
112
113
package de.micromata.borgbutler.data;
 
import de.micromata.borgbutler.json.borg.BorgArchiveLimits;
import de.micromata.borgbutler.json.borg.BorgArchiveStats;
import de.micromata.borgbutler.json.borg.BorgCache;
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, Comparable<Archive> {
    /**
     * For convenience purposes for the client.
     */
    @Getter
    @Setter
    private String repoName;
    /**
     * For convenience purposes for the client.
     */
    @Getter
    @Setter
    private String repoDisplayName;
    /**
     * 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;
    @Getter
    @Setter
    private BorgEncryption encryption;
 
    @Getter
    @Setter
    private int[] chunkerParams;
    /**
     * The command line used for creating this archive: borg create --filter...
     */
    @Getter
    @Setter
    private String[] commandLine;
    @Getter
    @Setter
    private String comment;
    @Getter
    @Setter
    private String start;
    @Getter
    @Setter
    private String end;
    @Getter
    @Setter
    private String time;
    @Getter
    @Setter
    private String duration;
    @Getter
    @Setter
    private BorgArchiveStats stats;
    @Getter
    @Setter
    private BorgArchiveLimits limits;
    @Getter
    @Setter
    private String username;
    @Getter
    @Setter
    private String hostname;
 
    /**
     *
     * @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);
    }
}