20b8589bbad569d5de7b28f908d1b228408e2111
[controller.git] / opendaylight / md-sal / sal-dom-xsql / src / main / java / org / opendaylight / controller / md / sal / dom / xsql / jdbc / JDBCCommand.java
1 /*
2  * Copyright (c) 2014, 2015 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8
9 package org.opendaylight.controller.md.sal.dom.xsql.jdbc;
10
11 import java.io.Serializable;
12 import java.util.Map;
13
14 import org.opendaylight.controller.md.sal.dom.xsql.XSQLBluePrint;
15
16 /**
17  * To be removed in Nitrogen
18  */
19 @Deprecated
20 public class JDBCCommand implements Serializable {
21     private static final long serialVersionUID = 1L;
22
23     public int type = 0;
24     public static final int TYPE_EXECUTE_QUERY = 1;
25     public static final int TYPE_QUERY_REPLY = 2;
26     public static final int TYPE_QUERY_RECORD = 3;
27     public static final int TYPE_QUERY_FINISH = 4;
28     public static final int TYPE_QUERY_ERROR = 5;
29     public static final int TYPE_METADATA = 6;
30     public static final int TYPE_METADATA_REPLY = 7;
31
32     private JDBCResultSet rs = null;
33     private Map<String, Object> record = null;
34     private int rsID = -1;
35     private Exception err = null;
36     private XSQLBluePrint bluePrint = null;
37
38     public JDBCCommand() {
39
40     }
41
42     public void setType(int t) {
43         this.type = t;
44     }
45
46     public JDBCCommand(Exception _err, int _RSID) {
47         this.type = TYPE_QUERY_ERROR;
48         this.err = _err;
49         this.rsID = _RSID;
50     }
51
52     public JDBCCommand(XSQLBluePrint bl) {
53         this.type = TYPE_METADATA_REPLY;
54         this.bluePrint = bl;
55     }
56
57     public JDBCCommand(JDBCResultSet _rs, int _type) {
58         this.type = TYPE_EXECUTE_QUERY;
59         this.rs = _rs;
60         this.type = _type;
61         this.rsID = rs.getID();
62     }
63
64     public JDBCCommand(Map<String, Object> _record, int _rsID) {
65         this.record = _record;
66         this.rsID = _rsID;
67         this.type = TYPE_QUERY_RECORD;
68     }
69
70     public JDBCCommand(int _rsID) {
71         this.rsID = _rsID;
72         this.type = TYPE_QUERY_FINISH;
73     }
74
75     public int getType() {
76         return this.type;
77     }
78
79     public JDBCResultSet getRS() {
80         return this.rs;
81     }
82
83     public Map<String, Object> getRecord() {
84         return this.record;
85     }
86
87     public int getRSID() {
88         return this.rsID;
89     }
90
91     public Exception getERROR() {
92         return this.err;
93     }
94
95     public XSQLBluePrint getBluePrint() {
96         return this.bluePrint;
97     }
98 }