1
2
3
4
5
6
7
8
9
10
11 package psiprobe.model.sql;
12
13 import java.io.Serializable;
14 import java.util.LinkedList;
15 import java.util.List;
16 import java.util.Map;
17
18
19
20
21 public class DataSourceTestInfo implements Serializable {
22
23
24 private static final long serialVersionUID = 1L;
25
26
27 public static final String DS_TEST_SESS_ATTR = "dataSourceTestData";
28
29
30 private List<Map<String, String>> results;
31
32
33 private final LinkedList<String> queryHistory;
34
35
36 private int maxRows;
37
38
39 private int rowsPerPage;
40
41
42 private int historySize;
43
44
45
46
47 public DataSourceTestInfo() {
48 queryHistory = new LinkedList<>();
49 }
50
51
52
53
54
55
56 public void addQueryToHistory(String sql) {
57 queryHistory.remove(sql);
58 queryHistory.addFirst(sql);
59
60 while (historySize >= 0 && queryHistory.size() > historySize) {
61 queryHistory.removeLast();
62 }
63 }
64
65
66
67
68
69
70 public List<Map<String, String>> getResults() {
71 return results;
72 }
73
74
75
76
77
78
79 public void setResults(List<Map<String, String>> results) {
80 this.results = results;
81 }
82
83
84
85
86
87
88 public List<String> getQueryHistory() {
89 return queryHistory;
90 }
91
92
93
94
95
96
97 public int getMaxRows() {
98 return maxRows;
99 }
100
101
102
103
104
105
106 public void setMaxRows(int maxRows) {
107 this.maxRows = maxRows;
108 }
109
110
111
112
113
114
115 public int getRowsPerPage() {
116 return rowsPerPage;
117 }
118
119
120
121
122
123
124 public void setRowsPerPage(int rowsPerPage) {
125 this.rowsPerPage = rowsPerPage;
126 }
127
128
129
130
131
132
133 public int getHistorySize() {
134 return historySize;
135 }
136
137
138
139
140
141
142 public void setHistorySize(int historySize) {
143 this.historySize = historySize;
144 }
145
146 }