Search in sources :

Example 1 with Lane

use of org.jbpm.bpmn2.core.Lane in project jbpm by kiegroup.

the class ProcessHandler method assignLanes.

private void assignLanes(RuleFlowProcess process, List<Lane> lanes) {
    List<String> laneNames = new ArrayList<String>();
    Map<String, String> laneMapping = new HashMap<String, String>();
    if (lanes != null) {
        for (Lane lane : lanes) {
            String name = lane.getName();
            if (name != null) {
                Swimlane swimlane = new Swimlane();
                swimlane.setName(name);
                process.getSwimlaneContext().addSwimlane(swimlane);
                laneNames.add(name);
                for (String flowElementRef : lane.getFlowElements()) {
                    laneMapping.put(flowElementRef, name);
                }
            }
        }
    }
    assignLanes(process, laneMapping);
}
Also used : Swimlane(org.jbpm.process.core.context.swimlane.Swimlane) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Lane(org.jbpm.bpmn2.core.Lane)

Example 2 with Lane

use of org.jbpm.bpmn2.core.Lane in project jbpm by kiegroup.

the class LaneHandler method start.

@SuppressWarnings("unchecked")
public Object start(final String uri, final String localName, final Attributes attrs, final ExtensibleXmlParser parser) throws SAXException {
    parser.startElementBuilder(localName, attrs);
    String id = attrs.getValue("id");
    String name = attrs.getValue("name");
    WorkflowProcess process = (WorkflowProcess) parser.getParent();
    List<Lane> lanes = (List<Lane>) ((RuleFlowProcess) process).getMetaData(LaneHandler.LANES);
    if (lanes == null) {
        lanes = new ArrayList<Lane>();
        ((RuleFlowProcess) process).setMetaData(LaneHandler.LANES, lanes);
    }
    Lane lane = new Lane(id);
    lane.setName(name);
    lanes.add(lane);
    return lane;
}
Also used : RuleFlowProcess(org.jbpm.ruleflow.core.RuleFlowProcess) Lane(org.jbpm.bpmn2.core.Lane) ArrayList(java.util.ArrayList) List(java.util.List) WorkflowProcess(org.kie.api.definition.process.WorkflowProcess)

Example 3 with Lane

use of org.jbpm.bpmn2.core.Lane in project jbpm by kiegroup.

the class LaneHandler method end.

public Object end(final String uri, final String localName, final ExtensibleXmlParser parser) throws SAXException {
    final Element element = parser.endElementBuilder();
    Lane lane = (Lane) parser.getCurrent();
    org.w3c.dom.Node xmlNode = element.getFirstChild();
    while (xmlNode != null) {
        String nodeName = xmlNode.getNodeName();
        if ("flowNodeRef".equals(nodeName)) {
            String flowElementRef = xmlNode.getTextContent();
            lane.addFlowElement(flowElementRef);
        }
        xmlNode = xmlNode.getNextSibling();
    }
    return lane;
}
Also used : Element(org.w3c.dom.Element) Lane(org.jbpm.bpmn2.core.Lane)

Example 4 with Lane

use of org.jbpm.bpmn2.core.Lane in project jbpm by kiegroup.

the class ProcessHandler method end.

@SuppressWarnings("unchecked")
public Object end(final String uri, final String localName, final ExtensibleXmlParser parser) throws SAXException {
    parser.endElementBuilder();
    RuleFlowProcess process = (RuleFlowProcess) parser.getCurrent();
    List<IntermediateLink> throwLinks = (List<IntermediateLink>) process.getMetaData(LINKS);
    linkIntermediateLinks(process, throwLinks);
    List<SequenceFlow> connections = (List<SequenceFlow>) process.getMetaData(CONNECTIONS);
    linkConnections(process, connections);
    linkBoundaryEvents(process);
    // This must be done *after* linkConnections(process, connections)
    // because it adds hidden connections for compensations
    List<Association> associations = (List<Association>) process.getMetaData(ASSOCIATIONS);
    linkAssociations((Definitions) process.getMetaData("Definitions"), process, associations);
    List<Lane> lanes = (List<Lane>) process.getMetaData(LaneHandler.LANES);
    assignLanes(process, lanes);
    postProcessNodes(process, process);
    return process;
}
Also used : RuleFlowProcess(org.jbpm.ruleflow.core.RuleFlowProcess) Association(org.jbpm.bpmn2.core.Association) SequenceFlow(org.jbpm.bpmn2.core.SequenceFlow) Lane(org.jbpm.bpmn2.core.Lane) List(java.util.List) ArrayList(java.util.ArrayList) IntermediateLink(org.jbpm.bpmn2.core.IntermediateLink)

Aggregations

Lane (org.jbpm.bpmn2.core.Lane)4 ArrayList (java.util.ArrayList)3 List (java.util.List)2 RuleFlowProcess (org.jbpm.ruleflow.core.RuleFlowProcess)2 HashMap (java.util.HashMap)1 Association (org.jbpm.bpmn2.core.Association)1 IntermediateLink (org.jbpm.bpmn2.core.IntermediateLink)1 SequenceFlow (org.jbpm.bpmn2.core.SequenceFlow)1 Swimlane (org.jbpm.process.core.context.swimlane.Swimlane)1 WorkflowProcess (org.kie.api.definition.process.WorkflowProcess)1 Element (org.w3c.dom.Element)1