ProcessHandler.addCompensationScope((RuleFlowProcess) parser.getParent(RuleFlowProcess.class), eventNode, parentContainer, attachedTo);
@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; }
for (SequenceFlow connection: connections) { String sourceRef = connection.getSourceRef(); Node source = findNodeByIdOrUniqueIdInMetadata(nodeContainer, sourceRef, "Could not find source node for connection:" + sourceRef); Node target = findNodeByIdOrUniqueIdInMetadata(nodeContainer, targetRef, "Could not find target node for connection:" + targetRef); Constraint constraint = buildConstraint(connection, nodeImpl); if (constraint != null) { nodeImpl.addConstraint(new ConnectionRef(connection.getId(), target.getId(), NodeImpl.CONNECTION_DEFAULT_TYPE), Constraint constraint = buildConstraint(connection, split); split.addConstraint( new ConnectionRef(connection.getId(), target.getId(), NodeImpl.CONNECTION_DEFAULT_TYPE),
for( EventFilter filter : ((EventNode) node).getEventFilters() ) { String type = ((EventTypeFilter) filter).getType(); Node attachedNode = findNodeByIdOrUniqueIdInMetadata(nodeContainer, attachedTo, "Could not find node to attach to: " + attachedTo); linkBoundaryEscalationEvent(nodeContainer, node, attachedTo, attachedNode); } else if (type.startsWith("Error-")) { linkBoundaryErrorEvent(nodeContainer, node, attachedTo, attachedNode); } else if (type.startsWith("Timer-")) { linkBoundaryTimerEvent(nodeContainer, node, attachedTo, attachedNode); } else if (type.equals("Compensation")) { linkBoundaryCompensationEvent(nodeContainer, node, attachedTo, attachedNode); } else if (node.getMetaData().get("SignalName") != null || type.startsWith("Message-")) { linkBoundarySignalEvent(nodeContainer, node, attachedTo, attachedNode); } else if (type.startsWith("Condition-")) { linkBoundaryConditionEvent(nodeContainer, node, attachedTo, attachedNode);
ProcessHandler.linkIntermediateLinks(compositeNode, throwLinks); ProcessHandler.linkConnections(compositeNode, connections); ProcessHandler.linkBoundaryEvents(compositeNode); ProcessHandler.linkAssociations((Definitions) compositeNode.getMetaData("Definitions"), compositeNode, associations);
ProcessHandler.linkConnections(forEachNode, connections); ProcessHandler.linkBoundaryEvents(forEachNode); ProcessHandler.linkAssociations((Definitions) forEachNode.getMetaData("Definitions"), forEachNode, associations); applyAsync(node, isAsync);
addCompensationScope(process, eventSubProcessNode, parentSubProcess, compensationHandlerId); postProcessNodes(process, (NodeContainer) node); } else if( node instanceof EndNode ) { handleIntermediateOrEndThrowCompensationEvent((EndNode) node); } else if( node instanceof ActionNode ) { handleIntermediateOrEndThrowCompensationEvent((ActionNode) node); } else if( node instanceof EventNode ) { final EventNode eventNode = (EventNode) node;
Object source = null; try { source = findNodeOrDataStoreByUniqueId(definitions, nodeContainer, sourceRef, "Could not find source [" + sourceRef + "] for association " + association.getId() + "]" ); } catch (IllegalArgumentException e) { Object target = null; try { target = findNodeOrDataStoreByUniqueId(definitions, nodeContainer, targetRef, "Could not find target [" + targetRef + "] for association [" + association.getId() + "]" ); } catch (IllegalArgumentException e) { EventNode sourceNode = (EventNode) source; Node targetNode = (Node) target; checkBoundaryEventCompensationHandler(association, sourceNode, targetNode);
private static Node findNodeByIdOrUniqueIdInMetadata( NodeContainer nodeContainer, String targetRef) { return findNodeByIdOrUniqueIdInMetadata(nodeContainer, targetRef, "Could not find target node for connection:" + targetRef); }
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); }
addHandler("process", new ProcessHandler());
@Override public Object end(String uri, String localName, ExtensibleXmlParser parser) throws SAXException { repositoryHelper.clear(); return super.end(uri, localName, parser); } }
for( EventFilter filter : ((EventNode) node).getEventFilters() ) { String type = ((EventTypeFilter) filter).getType(); Node attachedNode = findNodeByIdOrUniqueIdInMetadata(nodeContainer, attachedTo, "Could not find node to attach to: " + attachedTo); linkBoundaryEscalationEvent(nodeContainer, node, attachedTo, attachedNode); } else if (type.startsWith("Error-")) { linkBoundaryErrorEvent(nodeContainer, node, attachedTo, attachedNode); } else if (type.startsWith("Timer-")) { linkBoundaryTimerEvent(nodeContainer, node, attachedTo, attachedNode); } else if (type.equals("Compensation")) { linkBoundaryCompensationEvent(nodeContainer, node, attachedTo, attachedNode); } else if (node.getMetaData().get("SignalName") != null || type.startsWith("Message-")) { linkBoundarySignalEvent(nodeContainer, node, attachedTo, attachedNode); } else if (type.startsWith("Condition-")) { linkBoundaryConditionEvent(nodeContainer, node, attachedTo, attachedNode);
ProcessHandler.linkIntermediateLinks(compositeNode, throwLinks); ProcessHandler.linkConnections(compositeNode, connections); ProcessHandler.linkBoundaryEvents(compositeNode); ProcessHandler.linkAssociations((Definitions) compositeNode.getMetaData("Definitions"), compositeNode, associations);
ProcessHandler.linkConnections(forEachNode, connections); ProcessHandler.linkBoundaryEvents(forEachNode); ProcessHandler.linkAssociations((Definitions) forEachNode.getMetaData("Definitions"), forEachNode, associations); applyAsync(node, isAsync);
addCompensationScope(process, eventSubProcessNode, parentSubProcess, compensationHandlerId); postProcessNodes(process, (NodeContainer) node); } else if( node instanceof EndNode ) { handleIntermediateOrEndThrowCompensationEvent((EndNode) node); } else if( node instanceof ActionNode ) { handleIntermediateOrEndThrowCompensationEvent((ActionNode) node); } else if( node instanceof EventNode ) { final EventNode eventNode = (EventNode) node;
Object source = null; try { source = findNodeOrDataStoreByUniqueId(definitions, nodeContainer, sourceRef, "Could not find source [" + sourceRef + "] for association " + association.getId() + "]" ); } catch (IllegalArgumentException e) { Object target = null; try { target = findNodeOrDataStoreByUniqueId(definitions, nodeContainer, targetRef, "Could not find target [" + targetRef + "] for association [" + association.getId() + "]" ); } catch (IllegalArgumentException e) { EventNode sourceNode = (EventNode) source; Node targetNode = (Node) target; checkBoundaryEventCompensationHandler(association, sourceNode, targetNode);
private static Object findNodeOrDataStoreByUniqueId(Definitions definitions, NodeContainer nodeContainer, final String nodeRef, String errorMsg) { if( definitions != null ) { List<DataStore> dataStores = definitions.getDataStores(); if( dataStores != null ) { for( DataStore dataStore : dataStores ) { if( nodeRef.equals(dataStore.getId()) ) { return dataStore; } } } } return findNodeByIdOrUniqueIdInMetadata(nodeContainer, nodeRef, errorMsg); }
private void assignLanes(NodeContainer nodeContainer, Map<String, String> laneMapping) { for (Node node: nodeContainer.getNodes()) { String lane = null; String uniqueId = (String) node.getMetaData().get("UniqueId"); if (uniqueId != null) { lane = laneMapping.get(uniqueId); } else { lane = laneMapping.get(XmlBPMNProcessDumper.getUniqueNodeId(node)); } if (lane != null) { ((NodeImpl) node).setMetaData("Lane", lane); if (node instanceof HumanTaskNode) { ((HumanTaskNode) node).setSwimlane(lane); } } if (node instanceof NodeContainer) { assignLanes((NodeContainer) node, laneMapping); } } }
addHandler("process", new ProcessHandler());