1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
package org.kuali.rice.ksb.messaging.web; |
18 | |
|
19 | |
import org.apache.commons.beanutils.ConversionException; |
20 | |
import org.apache.commons.beanutils.ConvertUtils; |
21 | |
import org.apache.commons.beanutils.Converter; |
22 | |
import org.apache.struts.action.ActionForm; |
23 | |
import org.kuali.rice.core.util.KeyValue; |
24 | |
import org.kuali.rice.ksb.messaging.PersistedMessageBO; |
25 | |
import org.kuali.rice.ksb.util.CodeTranslator; |
26 | |
|
27 | |
import java.sql.Timestamp; |
28 | |
import java.util.ArrayList; |
29 | |
import java.util.Collection; |
30 | |
import java.util.List; |
31 | |
|
32 | |
|
33 | |
|
34 | |
|
35 | |
|
36 | |
|
37 | |
|
38 | |
public class MessageQueueForm extends ActionForm { |
39 | |
|
40 | |
private static final long serialVersionUID = -247925603792980036L; |
41 | |
public static final int DEFAULT_MAX_ROWS = 1000; |
42 | |
public static final int DEFAULT_PAGE_SIZE = 100; |
43 | |
|
44 | 0 | private int maxRows = DEFAULT_MAX_ROWS; |
45 | 0 | private int pageSize = DEFAULT_PAGE_SIZE; |
46 | |
private Long messageId; |
47 | 0 | private String methodToCall = ""; |
48 | |
private Collection<PersistedMessageBO> messageQueueRows; |
49 | |
private String showEdit; |
50 | |
private String command; |
51 | |
private PersistedMessageBO messageQueueFromDatabase; |
52 | |
private PersistedMessageBO messageQueueFromForm; |
53 | |
private String newQueueDate; |
54 | |
private String existingQueueDate; |
55 | |
private String ipAddress; |
56 | |
|
57 | |
|
58 | |
private String routeQueueIdFilter; |
59 | |
private String serviceNameFilter; |
60 | |
private String applicationIdFilter; |
61 | |
private String queueStatusFilter; |
62 | |
private String ipNumberFilter; |
63 | |
private String value1Filter; |
64 | |
private String value2Filter; |
65 | |
private String filterApplied; |
66 | |
|
67 | 0 | private Integer maxMessageFetcherMessages = Integer.valueOf(50); |
68 | |
|
69 | |
private String myIpAddress; |
70 | |
private String myApplicationId; |
71 | |
private String messagePersistence; |
72 | |
private String messageDelivery; |
73 | |
private String messageOff; |
74 | 0 | private List<KeyValue> ipAddresses = new ArrayList<KeyValue>(); |
75 | |
|
76 | |
static { |
77 | 0 | ConvertUtils.register(new SqlTimestampConverter(), Timestamp.class); |
78 | 0 | } |
79 | |
|
80 | 0 | public MessageQueueForm() { |
81 | 0 | messageQueueFromForm = new PersistedMessageBO(); |
82 | 0 | maxRows = DEFAULT_MAX_ROWS; |
83 | 0 | pageSize = DEFAULT_PAGE_SIZE; |
84 | 0 | } |
85 | |
|
86 | |
public String getRouteQueueStatusLabel(String statusCode) { |
87 | 0 | return CodeTranslator.getRouteQueueStatusLabel(statusCode); |
88 | |
} |
89 | |
|
90 | |
public String getMethodToCall() { |
91 | 0 | return methodToCall; |
92 | |
} |
93 | |
|
94 | |
public void setMethodToCall(String methodToCall) { |
95 | 0 | this.methodToCall = methodToCall; |
96 | 0 | } |
97 | |
|
98 | |
public Long getMessageId() { |
99 | 0 | return messageId; |
100 | |
} |
101 | |
|
102 | |
public void setMessageId(Long routeQueueId) { |
103 | 0 | this.messageId = routeQueueId; |
104 | 0 | } |
105 | |
|
106 | |
public Collection<PersistedMessageBO> getMessageQueueRows() { |
107 | 0 | return messageQueueRows; |
108 | |
} |
109 | |
|
110 | |
public void setMessageQueueRows(Collection<PersistedMessageBO> routeQueueRows) { |
111 | 0 | this.messageQueueRows = routeQueueRows; |
112 | 0 | } |
113 | |
|
114 | |
public int getMessageQueueRowsSize() { |
115 | 0 | if (messageQueueRows == null) { |
116 | 0 | return 0; |
117 | |
} |
118 | 0 | return messageQueueRows.size(); |
119 | |
} |
120 | |
|
121 | |
public String getCommand() { |
122 | 0 | return command; |
123 | |
} |
124 | |
|
125 | |
public void setCommand(String command) { |
126 | 0 | this.command = command; |
127 | 0 | } |
128 | |
|
129 | |
public PersistedMessageBO getMessageQueueFromDatabase() { |
130 | 0 | return messageQueueFromDatabase; |
131 | |
} |
132 | |
|
133 | |
public void setMessageQueueFromDatabase(PersistedMessageBO existingRouteQueue) { |
134 | 0 | this.messageQueueFromDatabase = existingRouteQueue; |
135 | 0 | } |
136 | |
|
137 | |
public PersistedMessageBO getMessageQueueFromForm() { |
138 | 0 | return messageQueueFromForm; |
139 | |
} |
140 | |
|
141 | |
public void setMessageQueueFromForm(PersistedMessageBO routeQueue) { |
142 | 0 | this.messageQueueFromForm = routeQueue; |
143 | 0 | } |
144 | |
|
145 | |
public String getShowEdit() { |
146 | 0 | return showEdit; |
147 | |
} |
148 | |
|
149 | |
public void setShowEdit(String showEdit) { |
150 | 0 | this.showEdit = showEdit; |
151 | 0 | } |
152 | |
|
153 | |
public String getExistingQueueDate() { |
154 | 0 | return existingQueueDate; |
155 | |
} |
156 | |
|
157 | |
public void setExistingQueueDate(String existingQueueDate) { |
158 | 0 | this.existingQueueDate = existingQueueDate; |
159 | 0 | } |
160 | |
|
161 | |
public String getNewQueueDate() { |
162 | 0 | return newQueueDate; |
163 | |
} |
164 | |
|
165 | |
public void setNewQueueDate(String newQueueDate) { |
166 | 0 | this.newQueueDate = newQueueDate; |
167 | 0 | } |
168 | |
|
169 | |
public int getMaxRows() { |
170 | 0 | return maxRows; |
171 | |
} |
172 | |
|
173 | |
public void setMaxRows(int maxRows) { |
174 | 0 | this.maxRows = maxRows; |
175 | 0 | } |
176 | |
|
177 | |
public int getPageSize() { |
178 | 0 | return this.pageSize; |
179 | |
} |
180 | |
|
181 | |
public void setPageSize(int pageSize) { |
182 | 0 | this.pageSize = pageSize; |
183 | 0 | } |
184 | |
|
185 | |
|
186 | |
|
187 | |
|
188 | |
public String getIpNumberFilter() { |
189 | 0 | return ipNumberFilter; |
190 | |
} |
191 | |
|
192 | |
|
193 | |
|
194 | |
|
195 | |
public void setIpNumberFilter(String ipNumberFilter) { |
196 | 0 | this.ipNumberFilter = ipNumberFilter; |
197 | 0 | } |
198 | |
|
199 | |
|
200 | |
|
201 | |
|
202 | |
public String getApplicationIdFilter() { |
203 | 0 | return applicationIdFilter; |
204 | |
} |
205 | |
|
206 | |
|
207 | |
|
208 | |
|
209 | |
public void setApplicationIdFilter(String applicationIdFilter) { |
210 | 0 | this.applicationIdFilter = applicationIdFilter; |
211 | 0 | } |
212 | |
|
213 | |
|
214 | |
|
215 | |
|
216 | |
public String getQueueStatusFilter() { |
217 | 0 | return queueStatusFilter; |
218 | |
} |
219 | |
|
220 | |
|
221 | |
|
222 | |
|
223 | |
public void setQueueStatusFilter(String queueStatusFilter) { |
224 | 0 | this.queueStatusFilter = queueStatusFilter; |
225 | 0 | } |
226 | |
|
227 | |
|
228 | |
|
229 | |
|
230 | |
public String getServiceNameFilter() { |
231 | 0 | return serviceNameFilter; |
232 | |
} |
233 | |
|
234 | |
|
235 | |
|
236 | |
|
237 | |
public void setServiceNameFilter(String serviceNameFilter) { |
238 | 0 | this.serviceNameFilter = serviceNameFilter; |
239 | 0 | } |
240 | |
|
241 | |
|
242 | |
|
243 | |
|
244 | |
public String getFilterApplied() { |
245 | 0 | return filterApplied; |
246 | |
} |
247 | |
|
248 | |
|
249 | |
|
250 | |
|
251 | |
public void setFilterApplied(String filterApplied) { |
252 | 0 | this.filterApplied = filterApplied; |
253 | 0 | } |
254 | |
|
255 | |
public String getRouteQueueIdFilter() { |
256 | 0 | return this.routeQueueIdFilter; |
257 | |
} |
258 | |
|
259 | |
public void setRouteQueueIdFilter(String messageIdFilter) { |
260 | 0 | this.routeQueueIdFilter = messageIdFilter; |
261 | 0 | } |
262 | |
|
263 | |
public String getValue1Filter() { |
264 | 0 | return this.value1Filter; |
265 | |
} |
266 | |
|
267 | |
public void setValue1Filter(String value1Filter) { |
268 | 0 | this.value1Filter = value1Filter; |
269 | 0 | } |
270 | |
|
271 | |
public String getValue2Filter() { |
272 | 0 | return this.value2Filter; |
273 | |
} |
274 | |
|
275 | |
public void setValue2Filter(String value2Filter) { |
276 | 0 | this.value2Filter = value2Filter; |
277 | 0 | } |
278 | |
|
279 | |
public List<KeyValue> getIpAddresses() { |
280 | 0 | return this.ipAddresses; |
281 | |
} |
282 | |
|
283 | |
public void setIpAddresses(List<KeyValue> ipAddresses) { |
284 | 0 | this.ipAddresses = ipAddresses; |
285 | 0 | } |
286 | |
|
287 | |
public String getIpAddress() { |
288 | 0 | return this.ipAddress; |
289 | |
} |
290 | |
|
291 | |
public void setIpAddress(String ipAddress) { |
292 | 0 | this.ipAddress = ipAddress; |
293 | 0 | } |
294 | |
|
295 | |
public Integer getMaxMessageFetcherMessages() { |
296 | 0 | return this.maxMessageFetcherMessages; |
297 | |
} |
298 | |
|
299 | |
public void setMaxMessageFetcherMessages(Integer maxMessageFetcherMessages) { |
300 | 0 | this.maxMessageFetcherMessages = maxMessageFetcherMessages; |
301 | 0 | } |
302 | |
|
303 | |
public String getMyIpAddress() { |
304 | 0 | return this.myIpAddress; |
305 | |
} |
306 | |
|
307 | |
public void setMyIpAddress(String myIpAddress) { |
308 | 0 | this.myIpAddress = myIpAddress; |
309 | 0 | } |
310 | |
|
311 | |
public String getMyApplicationId() { |
312 | 0 | return this.myApplicationId; |
313 | |
} |
314 | |
|
315 | |
public void setMyApplicationId(String myApplicationId) { |
316 | 0 | this.myApplicationId = myApplicationId; |
317 | 0 | } |
318 | |
|
319 | |
public String getMessageDelivery() { |
320 | 0 | return this.messageDelivery; |
321 | |
} |
322 | |
|
323 | |
public void setMessageDelivery(String messageDelivery) { |
324 | 0 | this.messageDelivery = messageDelivery; |
325 | 0 | } |
326 | |
|
327 | |
public String getMessageOff() { |
328 | 0 | return this.messageOff; |
329 | |
} |
330 | |
|
331 | |
public void setMessageOff(String messageOff) { |
332 | 0 | this.messageOff = messageOff; |
333 | 0 | } |
334 | |
|
335 | |
public String getMessagePersistence() { |
336 | 0 | return this.messagePersistence; |
337 | |
} |
338 | |
|
339 | |
public void setMessagePersistence(String messagePersistence) { |
340 | 0 | this.messagePersistence = messagePersistence; |
341 | 0 | } |
342 | |
|
343 | |
|
344 | |
|
345 | |
|
346 | |
|
347 | |
|
348 | |
public static class SqlTimestampConverter implements Converter { |
349 | |
|
350 | |
|
351 | |
|
352 | |
|
353 | |
|
354 | 0 | public SqlTimestampConverter() { |
355 | 0 | this.defaultValue = null; |
356 | 0 | this.useDefault = true; |
357 | 0 | } |
358 | |
|
359 | |
|
360 | |
|
361 | |
|
362 | |
|
363 | |
|
364 | |
|
365 | 0 | public SqlTimestampConverter(Object defaultValue) { |
366 | 0 | this.defaultValue = defaultValue; |
367 | 0 | this.useDefault = true; |
368 | 0 | } |
369 | |
|
370 | |
|
371 | |
|
372 | |
|
373 | |
|
374 | |
|
375 | 0 | private Object defaultValue = null; |
376 | |
|
377 | |
|
378 | |
|
379 | |
|
380 | 0 | private boolean useDefault = true; |
381 | |
|
382 | |
|
383 | |
|
384 | |
|
385 | |
|
386 | |
|
387 | |
|
388 | |
|
389 | |
|
390 | |
|
391 | |
|
392 | |
|
393 | |
|
394 | |
public Object convert(Class type, Object value) { |
395 | 0 | if (value == null) { |
396 | 0 | if (useDefault) { |
397 | 0 | return (defaultValue); |
398 | |
} else { |
399 | 0 | throw new ConversionException("No value specified"); |
400 | |
} |
401 | |
} |
402 | |
|
403 | 0 | if (value instanceof Timestamp) { |
404 | 0 | return (value); |
405 | |
} |
406 | |
|
407 | |
try { |
408 | 0 | return (Timestamp.valueOf(value.toString())); |
409 | 0 | } catch (Exception e) { |
410 | 0 | if (useDefault) { |
411 | 0 | return (defaultValue); |
412 | |
} else { |
413 | 0 | throw new ConversionException(e); |
414 | |
} |
415 | |
} |
416 | |
} |
417 | |
|
418 | |
} |
419 | |
} |