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

Kai Reinhard
31.45.2019 e24dcccdda9ae085534e0f16814486eb155aaa59
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
package de.micromata.borgbutler;
 
import de.micromata.borgbutler.jobs.JobResult;
 
/**
 * Holder of result object of borg commands. Holds the result object as well as error messages and status.
 */
public class BorgCommandResult<T> {
 
    private T object;
 
    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)";
    }
 
    public T getObject() {
        return this.object;
    }
 
    public JobResult<String> getJobResult() {
        return this.jobResult;
    }
 
    BorgCommandResult<T> setObject(T object) {
        this.object = object;
        return this;
    }
 
    BorgCommandResult<T> setJobResult(JobResult<String> jobResult) {
        this.jobResult = jobResult;
        return this;
    }
}