@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;
	}
@ 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 ; }
/* (non-Javadoc)
@see nz.co.senanque.workflow.WorkflowManager#launch(java.lang.String, java.lang.Object, java.lang.String, java.lang.String)