All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.yaoqiang.bpmn.engine.operation.FlowNodeEnd Maven / Gradle / Ivy

There is a newer version: 2.2.18
Show newest version
package org.yaoqiang.bpmn.engine.operation;

import java.util.Collections;
import java.util.List;

import org.yaoqiang.bpmn.engine.runtime.Execution;
import org.yaoqiang.bpmn.model.elements.core.common.FlowNode;
import org.yaoqiang.bpmn.model.elements.core.common.SequenceFlow;

/**
 * FlowNodeEnd
 * 
 * @author Shi Yaoqiang([email protected])
 */
public class FlowNodeEnd implements ExecutionOperation {

	public void execute(Execution execution) {
		if (execution.isProcessInstance()) {
			execution.performOperation(PROCESS_END);
		} else if (execution.isConcurrent()) {
			execution.remove();
		} else {
			FlowNode flowNode = execution.getFlowNode();
			FlowNode parentFlowNode = (FlowNode) flowNode.getParent().getParent();
			execution.setFlowNode(parentFlowNode);
			List outgoingSequenceFlows = parentFlowNode.getOutgoingSequenceFlows();
			if (outgoingSequenceFlows.isEmpty()) {
				execution.end();
			} else {
				execution.takeAll(outgoingSequenceFlows, Collections. emptyList());
			}
		}
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy