startprocessinstancecommand.java

来自「workflow first jbpm」· Java 代码 · 共 48 行

JAVA
48
字号
package org.jbpm.command;

import org.jbpm.JbpmContext;
import org.jbpm.graph.exe.ProcessInstance;

/**
 * Graph command to start a new process and signal it immidiatly.
 * The transition named in <code>startTransitionName</code> is used (or the default transition if it is null).
 * 
 * The result of this command, if requested, is a {@link Long} value containing
 * the process instance id.
 * 
 * @author Jim Rigsbee, Tom Baeyens, Bernd Ruecker
 */
public class StartProcessInstanceCommand extends NewProcessInstanceCommand
		implements Command {

	private static final long serialVersionUID = -2428234069404269048L;

	/**
	 * this transition name is used for signalling (if null, the default
	 * transition is used)
	 */
	private String startTransitionName = null;

	public Object execute(JbpmContext jbpmContext) throws Exception {
		Object object = super.execute(jbpmContext);
		if (object instanceof ProcessInstance) {
			ProcessInstance processInstance = (ProcessInstance) object;
			if (startTransitionName == null
					|| startTransitionName.length() == 0)
				processInstance.signal();
			else
				processInstance.signal(startTransitionName);
		}
		return object;
	}

	public String getStartTransitionName() {
		return startTransitionName;
	}

	public void setStartTransitionName(String startTransitionName) {
		this.startTransitionName = startTransitionName;
	}

}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?