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

Kai Reinhard
10.18.2019 b9a02dcfbbce3c3b473b2f583e1f83440b58e63f
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
package de.micromata.borgbutler;
 
import de.micromata.borgbutler.jobs.JobResult;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.Setter;
 
/**
 * Holder of result object of borg commands. Holds the result object as well as error messages and status.
 */
public class BorgCommandResult<T> {
 
    @Getter
    @Setter(AccessLevel.PACKAGE)
    private T object;
 
    @Getter
    @Setter(AccessLevel.PACKAGE)
    private JobResult<String> jobResult;
 
    public JobResult.Status getStatus() {
        return jobResult != null ? jobResult.getStatus() : JobResult.Status.ERROR;
    }
 
    public String getError() {
        if (jobResult != null) {
            return jobResult.getErrorString();
        }
        return "Unkown error... (please refer the log files)";
    }
}