Merge "Fixed for bug 1168 : Issue while update subnet"
[controller.git] / opendaylight / md-sal / sal-dom-xsql / src / main / java / org / opendaylight / controller / md / sal / dom / xsql / jdbc / JDBCCommand.java
1 package org.opendaylight.controller.md.sal.dom.xsql.jdbc;
2
3 import java.io.Serializable;
4 import java.util.Map;
5
6 public class JDBCCommand implements Serializable {
7     public int type = 0;
8     public static final int TYPE_EXECUTE_QUERY = 1;
9     public static final int TYPE_QUERY_REPLY = 2;
10     public static final int TYPE_QUERY_RECORD = 3;
11     public static final int TYPE_QUERY_FINISH = 4;
12     public static final int TYPE_QUERY_ERROR = 5;
13
14     private JDBCResultSet rs = null;
15     private Map record = null;
16     private int rsID = -1;
17     private Exception err = null;
18
19     public JDBCCommand(Exception _err, int _RSID) {
20         this.type = TYPE_QUERY_ERROR;
21         this.err = _err;
22         this.rsID = _RSID;
23     }
24
25     public JDBCCommand(JDBCResultSet _rs, int _type) {
26         this.type = TYPE_EXECUTE_QUERY;
27         this.rs = _rs;
28         this.type = _type;
29         this.rsID = rs.getID();
30     }
31
32     public JDBCCommand(Map _record, int _rsID) {
33         this.record = _record;
34         this.rsID = _rsID;
35         this.type = TYPE_QUERY_RECORD;
36     }
37
38     public JDBCCommand(int _rsID) {
39         this.rsID = _rsID;
40         this.type = TYPE_QUERY_FINISH;
41     }
42
43     public int getType() {
44         return this.type;
45     }
46
47     public JDBCResultSet getRS() {
48         return this.rs;
49     }
50
51     public Map getRecord() {
52         return this.record;
53     }
54
55     public int getRSID() {
56         return this.rsID;
57     }
58
59     public Exception getERROR() {
60         return this.err;
61     }
62 }