@Override public ProcessInstance launch(String processName, Object o, String comment, String bundleName) { ProcessDefinition processDefinition = getProcessDefinition(processName); if (processDefinition == null) { throw new WorkflowException("Failed to find process definition named "+processName); } ProcessInstance processInstance = new ProcessInstance(); processInstance.setComment(comment); processInstance.setBundleName(bundleName); return processInstance; }
public boolean execute(ProcessInstance processInstance) { log.debug("{}",this); for (ProcessDefinition subProcess:m_subProcess) { ProcessInstance subprocessInstance = new ProcessInstance(); subprocessInstance.setBundleName(processInstance.getBundleName()); subProcess.startProcess(subprocessInstance); processInstance.getChildProcesses().add(subprocessInstance); subprocessInstance.setObjectInstance(processInstance.getObjectInstance()); subprocessInstance.setParentProcess(processInstance); log.debug("subprocess launched: {}",subprocessInstance.getProcessDefinitionName()); } ProcessInstanceUtils.clearQueue(processInstance); processInstance.setWaitCount(m_subProcess.size()); log.debug("{} subprocesses launched for: {} {}",processInstance.getWaitCount(),processInstance.getProcessDefinitionName(),processInstance.getId()); return false; }
protected void launchOneCyclicSubprocess(ProcessInstance processInstance) { ProcessInstance subProcess = new ProcessInstance(); subProcess.setBundleName(processInstance.getBundleName()); getSubProcess().startProcess(subProcess); processInstance.getChildProcesses().add(subProcess); subProcess.setObjectInstance(processInstance.getObjectInstance()); subProcess.setParentProcess(processInstance); log.debug("subprocess launched: {}",subProcess.getProcessDefinitionName()); ProcessInstanceUtils.clearQueue(processInstance); processInstance.setWaitCount(1); log.debug("subprocess launched for: {} {}",processInstance.getProcessDefinitionName(),processInstance.getId()); }
public boolean execute(ProcessInstance processInstance) { log.debug("{}",this); WorkflowManager workflowManager = getOwnerProcess().getWorkflowManager(); List<?> list = (List<?>)workflowManager.getField(processInstance, getFd()); if (!list.isEmpty()) { for (Object o:list) { ProcessInstance subProcess = new ProcessInstance(); subProcess.setBundleName(processInstance.getBundleName()); getSubProcess().startProcess(subProcess); processInstance.getChildProcesses().add(subProcess); subProcess.setObjectInstance(workflowManager.createContextDescriptor(o)); subProcess.setParentProcess(processInstance); log.debug("subprocess launched: {}",subProcess.getProcessDefinitionName()); } ProcessInstanceUtils.clearQueue(processInstance); processInstance.setWaitCount(list.size()); log.debug("{} subprocesses launched for: {} {}",processInstance.getWaitCount(),processInstance.getProcessDefinitionName(),processInstance.getId()); } return false; } }
@Transactional public ProcessInstance launch(String processName, Object context, String comment, String bundleName, ProcessInstance processInstance) { ProcessDefinition processDefinition = getProcessDefinition(processName); if (processDefinition == null) { throw new WorkflowException("Failed to find process definition named "+processName); } Object mergedContext = getContextDAO().mergeContext(context); processInstance.setComment(comment==null?" ":comment); processInstance.setBundleName(bundleName); processInstance.setObjectInstance(getContextDAO().createContextDescriptor(mergedContext)); if (!ContextUtils.getContextClass(processInstance.getObjectInstance()).equals(mergedContext.getClass())) { throw new WorkflowException("Context object does not match process context in "+processName); } processDefinition.startProcess(processInstance); ProcessInstance processInstanceRet = getWorkflowDAO().mergeProcessInstance(processInstance); getWorkflowDAO().flush(); return processInstanceRet; }
final ProcessDefinition processDefinition = pdh.getProcessDefinition(); final WorkflowForm form = m_workflowClient.getLaunchForm(processDefinition.getName()); form.getProcessInstance().setBundleName(processDefinition.getVersion()); form.bind(); ((VerticalLayout)form).addListener(new Listener(){