1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.waarp.commandexec.utils;
21
22
23
24
25 public class LocalExecResult {
26 private int status;
27 private boolean isSuccess;
28 private Exception exception;
29 private String result;
30
31
32
33
34
35
36 public LocalExecResult(final boolean isSuccess, final int status,
37 final Exception exception, final String result) {
38 setSuccess(isSuccess);
39 setStatus(status);
40 setException(exception);
41 setResult(result);
42 }
43
44
45
46
47
48
49 public LocalExecResult(final LocalExecResult localExecResult) {
50 setSuccess(localExecResult.isSuccess());
51 setStatus(localExecResult.getStatus());
52 setException(localExecResult.getException());
53 setResult(localExecResult.getResult());
54 }
55
56
57
58
59
60
61 public final void set(final LocalExecResult localExecResult) {
62 setSuccess(localExecResult.isSuccess());
63 setStatus(localExecResult.getStatus());
64 setException(localExecResult.getException());
65 setResult(localExecResult.getResult());
66 }
67
68 @Override
69 public String toString() {
70 return "Status: " + getStatus() + " Output: " + getResult() +
71 (getException() != null? "\nError: " + getException().getMessage() :
72 "");
73 }
74
75
76
77
78 public final int getStatus() {
79 return status;
80 }
81
82
83
84
85 public final void setStatus(final int status) {
86 this.status = status;
87 }
88
89
90
91
92 public final boolean isSuccess() {
93 return isSuccess;
94 }
95
96
97
98
99 public final void setSuccess(final boolean isSuccess) {
100 this.isSuccess = isSuccess;
101 }
102
103
104
105
106 public final Exception getException() {
107 return exception;
108 }
109
110
111
112
113 public final void setException(final Exception exception) {
114 this.exception = exception;
115 }
116
117
118
119
120 public final String getResult() {
121 return result;
122 }
123
124
125
126
127 public final void setResult(final String result) {
128 this.result = result;
129 }
130
131 }