]> gerrit.simantics Code Review - simantics/platform.git/blob - server/serverResponse/ServerResponse.java
Fixed multiple issues causing dangling references to discarded queries
[simantics/platform.git] / server / serverResponse / ServerResponse.java
1 package org.simantics.document.server.serverResponse;
2
3 import org.simantics.document.server.io.CommandContextMutable;
4 import org.simantics.document.server.io.CommandResult;
5
6
7 public class ServerResponse implements CommandResult {
8     
9     protected int code;
10     protected String message;
11     protected CommandContextMutable assignments;
12     
13     public ServerResponse(int code, String message, CommandContextMutable assignments) {
14         this.code = code;
15         this.message = message;
16         this.assignments = assignments;
17     }
18     
19     public void setMessage(String message) {
20         this.message = message;
21     }
22     
23     public void setCode(int code) {
24         this.code = code;
25     }
26     
27     public int getCode() {
28         return code;
29     }
30     
31     public String getMessage() {
32         return message;
33     }
34
35         @Override
36         public int getReturnCode() {
37                 return code;
38         }
39
40         @Override
41         public String getStatus() {
42                 return getMessage();
43         }
44         
45         @Override
46         public CommandContextMutable getAssignments() {
47                 return assignments;
48         }
49         
50         public static CommandResult create(int code, String message, CommandContextMutable assignments) {
51                 return new ServerResponse(code, message, assignments);
52         }
53 }