]>
git.argeo.org Git - gpl/argeo-slc.git/blob - msg/ExecutionAnswer.java
1 package org
.argeo
.slc
.msg
;
3 import org
.argeo
.slc
.SlcException
;
5 /** Answer to an execution of a remote service which performed changes. */
6 public class ExecutionAnswer
{
7 public final static String OK
= "OK";
8 public final static String ERROR
= "ERROR";
10 private String status
= OK
;
11 private String message
= "";
13 /** Canonical constructor */
14 public ExecutionAnswer(String status
, String message
) {
17 throw new SlcException("Message cannot be null");
18 this.message
= message
;
21 /** Empty constructor */
22 public ExecutionAnswer() {
25 public String
getStatus() {
29 public void setStatus(String status
) {
30 if (status
== null || (!status
.equals(OK
) && !status
.equals(ERROR
)))
31 throw new SlcException("Bad status format: " + status
);
35 public String
getMessage() {
39 public void setMessage(String message
) {
40 this.message
= message
;
43 public static ExecutionAnswer
error(String message
) {
44 return new ExecutionAnswer(ERROR
, message
);
47 public static ExecutionAnswer
ok(String message
) {
48 return new ExecutionAnswer(OK
, message
);