| 1 | |
|
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | |
|
| 17 | |
package org.kuali.rice.kew.messaging; |
| 18 | |
|
| 19 | |
import javax.xml.namespace.QName; |
| 20 | |
|
| 21 | |
import org.apache.commons.lang.StringUtils; |
| 22 | |
import org.kuali.rice.kew.actionrequest.service.DocumentRequeuerService; |
| 23 | |
import org.kuali.rice.kew.actions.asyncservices.ActionInvocationService; |
| 24 | |
import org.kuali.rice.kew.actions.asyncservices.BlanketApproveProcessorService; |
| 25 | |
import org.kuali.rice.kew.actions.asyncservices.MoveDocumentService; |
| 26 | |
import org.kuali.rice.kew.api.document.attribute.DocumentAttributeIndexingQueue; |
| 27 | |
import org.kuali.rice.kew.mail.service.ActionListImmediateEmailReminderService; |
| 28 | |
import org.kuali.rice.kew.routeheader.DocumentRouteHeaderValue; |
| 29 | |
import org.kuali.rice.kew.rule.service.RuleCacheProcessor; |
| 30 | |
import org.kuali.rice.ksb.api.KsbApiServiceLocator; |
| 31 | |
import org.kuali.rice.ksb.messaging.service.KSBXMLService; |
| 32 | |
|
| 33 | |
|
| 34 | |
|
| 35 | |
|
| 36 | |
|
| 37 | |
|
| 38 | |
|
| 39 | 0 | public class MessageServiceNames { |
| 40 | |
|
| 41 | |
public static final String DOCUMENT_ROUTING_SERVICE = "DocumentRoutingService"; |
| 42 | |
|
| 43 | |
public static final String ACTION_LIST_IMMEDIATE_REMINDER_SERVICE = "ImmediateEmailService"; |
| 44 | |
|
| 45 | |
public static final String BLANKET_APPROVE_PROCESSING_SERVICE = "BlanketApproveProcessorService"; |
| 46 | |
|
| 47 | |
public static final String DOCUMENT_REQUEUE_PROCESSING_SERVICE = "DocumentRequeueProcessorService"; |
| 48 | |
|
| 49 | |
public static final String WORKGROUP_MEMBERSHIP_CHANGE_SERVICE = "WorkgroupMembershipChangeService"; |
| 50 | |
|
| 51 | |
public static final String SERVICE_REMOVER_SERVICE = "RemoteClassRemoverService"; |
| 52 | |
|
| 53 | |
public static final String RULE_CACHE_PROCESSOR_SERVICE = "RuleCacheProcessorService"; |
| 54 | |
|
| 55 | |
public static final String ROLE_POKER = "RolePokerProcessorService"; |
| 56 | |
|
| 57 | |
public static final String MOVE_DOCUMENT_PROCESSOR = "MoveDocumentProcessor"; |
| 58 | |
|
| 59 | |
public static final String ACTION_INVOCATION_PROCESSOR = "ActionInvocationProcessor"; |
| 60 | |
|
| 61 | |
public static final String RESPONSIBILITY_CHANGE_SERVICE = "ResponsibilityChangeService"; |
| 62 | |
|
| 63 | |
private static QName getQName(String baseServiceName, DocumentRouteHeaderValue document) { |
| 64 | 0 | if (document != null) { |
| 65 | 0 | return new QName(document.getDocumentType().getApplicationId(), baseServiceName); |
| 66 | |
} |
| 67 | 0 | return new QName(baseServiceName); |
| 68 | |
} |
| 69 | |
|
| 70 | |
private static QName getQName(String baseServiceName, String applicationId) { |
| 71 | 0 | if (!StringUtils.isEmpty(applicationId)) { |
| 72 | 0 | return new QName(applicationId, baseServiceName); |
| 73 | |
} |
| 74 | 0 | return new QName(baseServiceName); |
| 75 | |
} |
| 76 | |
|
| 77 | |
public static KSBXMLService getRouteDocumentMessageService(DocumentRouteHeaderValue document) { |
| 78 | 0 | return (KSBXMLService) getServiceAsynchronously(getQName(DOCUMENT_ROUTING_SERVICE, document), document); |
| 79 | |
} |
| 80 | |
|
| 81 | |
public static MoveDocumentService getMoveDocumentProcessorService(DocumentRouteHeaderValue document) { |
| 82 | 0 | return (MoveDocumentService) getServiceAsynchronously(getQName(MOVE_DOCUMENT_PROCESSOR, document), document); |
| 83 | |
} |
| 84 | |
|
| 85 | |
public static ActionInvocationService getActionInvocationProcessorService(DocumentRouteHeaderValue document) { |
| 86 | 0 | return (ActionInvocationService) getServiceAsynchronously(getQName(ACTION_INVOCATION_PROCESSOR, document), document); |
| 87 | |
} |
| 88 | |
|
| 89 | |
public static BlanketApproveProcessorService getBlanketApproveProcessorService(DocumentRouteHeaderValue document) { |
| 90 | 0 | return (BlanketApproveProcessorService) getServiceAsynchronously(getQName(BLANKET_APPROVE_PROCESSING_SERVICE, document), document); |
| 91 | |
} |
| 92 | |
|
| 93 | |
public static ActionListImmediateEmailReminderService getImmediateEmailService() { |
| 94 | 0 | return (ActionListImmediateEmailReminderService) getServiceAsynchronously(getQName(ACTION_LIST_IMMEDIATE_REMINDER_SERVICE, (DocumentRouteHeaderValue) null), (String)null); |
| 95 | |
} |
| 96 | |
|
| 97 | |
public static RuleCacheProcessor getRuleCacheProcessor() { |
| 98 | 0 | return (RuleCacheProcessor) getServiceAsynchronously(new QName(MessageServiceNames.RULE_CACHE_PROCESSOR_SERVICE), (String)null); |
| 99 | |
} |
| 100 | |
|
| 101 | |
public static DocumentRequeuerService getDocumentRequeuerService(String applicationId, String documentId, long waitTime) { |
| 102 | 0 | QName serviceName = getQName(DOCUMENT_REQUEUE_PROCESSING_SERVICE, applicationId); |
| 103 | 0 | if (waitTime > 0) { |
| 104 | 0 | return (DocumentRequeuerService) getDelayedServiceAsynchronously(serviceName, documentId, waitTime); |
| 105 | |
} |
| 106 | 0 | return (DocumentRequeuerService) getServiceAsynchronously(serviceName, documentId); |
| 107 | |
} |
| 108 | |
|
| 109 | |
public static Object getServiceAsynchronously(QName serviceName, DocumentRouteHeaderValue document) { |
| 110 | 0 | return getServiceAsynchronously(serviceName, getDocId(document)); |
| 111 | |
} |
| 112 | |
|
| 113 | |
public static Object getServiceAsynchronously(QName serviceName, String documentId) { |
| 114 | 0 | return KsbApiServiceLocator.getMessageHelper().getServiceAsynchronously(serviceName, null, null, (documentId == null ? null : documentId.toString()), null); |
| 115 | |
} |
| 116 | |
|
| 117 | |
public static Object getDelayedServiceAsynchronously(QName serviceName, DocumentRouteHeaderValue document, long waitTime) { |
| 118 | 0 | return getDelayedServiceAsynchronously(serviceName, getDocId(document), waitTime); |
| 119 | |
} |
| 120 | |
|
| 121 | |
public static Object getDelayedServiceAsynchronously(QName serviceName, String documentId, long waitTime) { |
| 122 | 0 | return KsbApiServiceLocator.getMessageHelper().getServiceAsynchronously(serviceName, null, (documentId == null ? null : documentId.toString()), null, waitTime); |
| 123 | |
} |
| 124 | |
|
| 125 | |
private static String getDocId(DocumentRouteHeaderValue document) { |
| 126 | 0 | return (document == null ? null : document.getDocumentId()); |
| 127 | |
} |
| 128 | |
|
| 129 | |
} |