1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
package org.kuali.rice.kew.messaging.exceptionhandling; |
15 | |
|
16 | |
import org.apache.commons.lang.StringUtils; |
17 | |
import org.kuali.rice.kew.api.WorkflowRuntimeException; |
18 | |
import org.kuali.rice.kew.service.KEWServiceLocator; |
19 | |
import org.kuali.rice.ksb.messaging.PersistedMessageBO; |
20 | |
import org.kuali.rice.ksb.messaging.exceptionhandling.DefaultMessageExceptionHandler; |
21 | |
import org.kuali.rice.ksb.messaging.exceptionhandling.MessageExceptionHandler; |
22 | |
import org.kuali.rice.ksb.service.KSBServiceLocator; |
23 | |
|
24 | |
|
25 | |
|
26 | |
|
27 | |
|
28 | |
|
29 | |
|
30 | 0 | public class DocumentMessageExceptionHandler extends DefaultMessageExceptionHandler { |
31 | |
|
32 | |
@Override |
33 | |
protected void placeInException(Throwable throwable, PersistedMessageBO message) throws Exception { |
34 | 0 | KEWServiceLocator.getExceptionRoutingService().placeInExceptionRouting(throwable, message, getDocumentId(message)); |
35 | 0 | } |
36 | |
|
37 | |
|
38 | |
|
39 | |
@Override |
40 | |
public void handleExceptionLastDitchEffort(Throwable throwable, PersistedMessageBO message, Object service) throws Exception { |
41 | 0 | KEWServiceLocator.getExceptionRoutingService().placeInExceptionRoutingLastDitchEffort(throwable, message, getDocumentId(message)); |
42 | 0 | } |
43 | |
|
44 | |
|
45 | |
|
46 | |
@Override |
47 | |
protected void scheduleExecution(Throwable throwable, PersistedMessageBO message) throws Exception { |
48 | 0 | String description = "DocumentId: " + getDocumentId(message); |
49 | 0 | KSBServiceLocator.getExceptionRoutingService().scheduleExecution(throwable, message, description); |
50 | 0 | } |
51 | |
|
52 | |
protected String getDocumentId(PersistedMessageBO message) { |
53 | 0 | if (!StringUtils.isEmpty(message.getValue1())) { |
54 | 0 | return message.getValue1(); |
55 | |
} |
56 | 0 | throw new WorkflowRuntimeException("Unable to put this message in exception routing service name " + message.getServiceName()); |
57 | |
} |
58 | |
} |