Package org.jbpm.simulation.handler

Source Code of org.jbpm.simulation.handler.AdHocSubProcessElementHandler

package org.jbpm.simulation.handler;

import java.util.List;

import org.eclipse.bpmn2.Activity;
import org.eclipse.bpmn2.AdHocSubProcess;
import org.eclipse.bpmn2.FlowElement;
import org.eclipse.bpmn2.SequenceFlow;
import org.jbpm.simulation.PathContextManager;

public class AdHocSubProcessElementHandler extends MainElementHandler {

    @Override
    public boolean handle(FlowElement element, PathContextManager manager) {
        AdHocSubProcess adHoc = (AdHocSubProcess) element;
       
        List<FlowElement> flowElements = adHoc.getFlowElements();
       
        for (FlowElement fElement : flowElements) {
            if (fElement instanceof Activity) {
                if (((Activity) fElement).getIncoming().size() == 0) {
                   
                    manager.cloneGiven(manager.getContextFromStack());
                    boolean canBeFinsihed = manager.getContextFromStack().isCanBeFinished();
                    manager.getContextFromStack().setCanBeFinished(false);
                   
                    super.handle(fElement, manager);
                    manager.getContextFromStack().setCanBeFinished(canBeFinsihed);
                    List<SequenceFlow> out = getOutgoing(element);
                    for (SequenceFlow flow : out) {
                        manager.addToPath(flow, manager.getContextFromStack());
                        super.handle(flow.getTargetRef(), manager);
                    }
                   
                }
            }
        }
      
      
        return true;
    }

}
TOP

Related Classes of org.jbpm.simulation.handler.AdHocSubProcessElementHandler

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.