Search in sources :

Example 1 with ActionInvocationQueue

use of org.kuali.kfs.kew.api.action.ActionInvocationQueue in project cu-kfs by CU-CommunityApps.

the class DocumentOperationAction method queueActionInvocation.

public ActionForward queueActionInvocation(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
    try {
        DocumentOperationForm docForm = (DocumentOperationForm) form;
        String principalId = KEWServiceLocator.getIdentityHelperService().getIdForPrincipalName(docForm.getActionInvocationUser());
        ActionInvocation invocation = ActionInvocation.create(ActionType.fromCode(docForm.getActionInvocationActionCode()), docForm.getActionInvocationActionItemId());
        DocumentRouteHeaderValue document = docForm.getRouteHeader();
        ActionInvocationQueue actionInvocationQueue = KewApiServiceLocator.getActionInvocationProcessorService(document.getDocumentId());
        actionInvocationQueue.invokeAction(principalId, docForm.getRouteHeader().getDocumentId(), invocation);
        ActionMessages messages = new ActionMessages();
        messages.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("general.message", "Action Invocation Processor was successfully scheduled"));
        saveMessages(request, messages);
        return mapping.findForward("basic");
    } catch (Exception e) {
        throw new WorkflowRuntimeException(e);
    }
}
Also used : ActionMessages(org.apache.struts.action.ActionMessages) ActionInvocation(org.kuali.kfs.kew.api.action.ActionInvocation) ActionInvocationQueue(org.kuali.kfs.kew.api.action.ActionInvocationQueue) ActionMessage(org.apache.struts.action.ActionMessage) WorkflowRuntimeException(org.kuali.kfs.kew.api.WorkflowRuntimeException) DocumentRouteHeaderValue(org.kuali.kfs.kew.routeheader.DocumentRouteHeaderValue) ServletException(javax.servlet.ServletException) WorkflowRuntimeException(org.kuali.kfs.kew.api.WorkflowRuntimeException) ParseException(java.text.ParseException) WorkflowServiceErrorException(org.kuali.kfs.kew.exception.WorkflowServiceErrorException) IOException(java.io.IOException)

Aggregations

IOException (java.io.IOException)1 ParseException (java.text.ParseException)1 ServletException (javax.servlet.ServletException)1 ActionMessage (org.apache.struts.action.ActionMessage)1 ActionMessages (org.apache.struts.action.ActionMessages)1 WorkflowRuntimeException (org.kuali.kfs.kew.api.WorkflowRuntimeException)1 ActionInvocation (org.kuali.kfs.kew.api.action.ActionInvocation)1 ActionInvocationQueue (org.kuali.kfs.kew.api.action.ActionInvocationQueue)1 WorkflowServiceErrorException (org.kuali.kfs.kew.exception.WorkflowServiceErrorException)1 DocumentRouteHeaderValue (org.kuali.kfs.kew.routeheader.DocumentRouteHeaderValue)1