public static Collection<TransitionNode> getTransitions( final PageRequestResponse rRequest, final WorkitemBean workitem) { final ArrayList<TransitionNode> al = new ArrayList<TransitionNode>(); final String[] transitions = StringUtils.split(rRequest.getParameter("transitions")); final ActivityComplete activityComplete = WorkitemComplete.get(workitem).getActivityComplete(); // 通过手动方式选取的路由 if (transitions != null && transitions.length > 0) { for (final String id : transitions) { final TransitionNode transition = activityComplete.getTransitionById(id); if (TransitionUtils.isTransitionManual(transition)) { al.add(transition); } } } else { al.addAll(activityComplete.getTransitions()); } return al; }
public static void doWorkitemComplete( final ComponentParameter cParameter, final WorkitemBean workitem) throws IOException { final KVMap kv = new KVMap(); try { final WorkitemComplete workitemComplete = WorkitemComplete.get(workitem); // 绑定变量 final IWorkflowForm workflowForm = (IWorkflowForm) workitemComplete.getWorkflowForm(); if (workflowForm != null) { workflowForm.bindVariables(workitemComplete.getVariables()); } final IWorkitemCompleteHandler hdl = (IWorkitemCompleteHandler) cParameter.getComponentHandler(); if (!workitemComplete.isAllCompleted()) { hdl.complete(cParameter, workitemComplete); } else { // 是否有手动情况 final ActivityComplete activityComplete = workitemComplete.getActivityComplete(); final boolean transitionManual = activityComplete.isTransitionManual(); final boolean participantManual = activityComplete.isParticipantManual(); if (transitionManual || participantManual) { kv.add( "responseText", UrlForward.getResponseText( cParameter, ComponentUtils.getResourceHomePath(WorkitemCompleteBean.class) + "/jsp/workitem_complete_route.jsp")); kv.add("transitionManual", transitionManual); kv.add("participantManual", participantManual); } else { hdl.complete(cParameter, workitemComplete); } } } catch (final Throwable ex) { kv.add("exception", AjaxRequestUtils.createException(ex)); } final Writer out = cParameter.getResponseWriter(); out.write(kv.toJSON()); out.flush(); }