public Constraint getConstraint(final Connection connection) { if (connection == null) { throw new IllegalArgumentException("connection is null"); } ConnectionRef ref = new ConnectionRef((String)connection.getMetaData().get("UniqueId"), connection.getTo().getId(), connection.getToType()); return this.constraints.get(ref); }
public void visitConnection(Connection connection, StringBuilder xmlDump, boolean includeMeta) { xmlDump.append(" <connection from=\"" + connection.getFrom().getId() + "\" "); if (!NodeImpl.CONNECTION_DEFAULT_TYPE.equals(connection.getFromType())) { xmlDump.append("fromType=\"" + connection.getFromType() + "\" "); } xmlDump.append("to=\"" + connection.getTo().getId() + "\" "); if (!NodeImpl.CONNECTION_DEFAULT_TYPE.equals(connection.getToType())) { xmlDump.append("toType=\"" + connection.getToType() + "\" "); } if (includeMeta) { String bendpoints = (String) connection.getMetaData().get("bendpoints"); if (bendpoints != null) { xmlDump.append("bendpoints=\"" + bendpoints + "\" "); } } xmlDump.append("/>" + EOL); }
private String createSplitRule(Process process, Connection connection, String constraint) { return "rule \"RuleFlow-Split-" + process.getId() + "-" + ((org.jbpm.workflow.core.Node) connection.getFrom()).getUniqueId() + "-" + ((org.jbpm.workflow.core.Node) connection.getTo()).getUniqueId() + "-" + connection.getToType() + "\" @Propagation(EAGER) \n" + " ruleflow-group \"DROOLS_SYSTEM\" \n" + " when \n" + " " + constraint + "\n" + " then \n" + "end \n\n"; }
public void addOutgoingConnection(String type, Connection connection) { if (connection.getTo().getNodeContainer() == this) { linkIncomingConnections( org.jbpm.workflow.core.Node.CONNECTION_DEFAULT_TYPE, connection.getTo().getId(), connection.getToType()); } else { super.addOutgoingConnection(type, connection); CompositeNode.NodeAndType outNode = internalGetLinkedOutgoingNode(type); if (outNode != null) { CompositeNodeEnd end = new CompositeNodeEnd(this, connection.getTo(), type); internalAddNode(end); NodeImpl node = (NodeImpl) outNode.getNode(); if (node != null) { new ConnectionImpl( outNode.getNode(), outNode.getType(), end, org.jbpm.workflow.core.Node.CONNECTION_DEFAULT_TYPE); } } } }
public void validateAddOutgoingConnection(final String type, final Connection connection) { super.validateAddOutgoingConnection(type, connection); if (!org.jbpm.workflow.core.Node.CONNECTION_DEFAULT_TYPE.equals(type)) { throw new IllegalArgumentException( "This type of node [" + connection.getFrom().getMetaData().get("UniqueId") + ", " + connection.getFrom().getName() + "] only accepts default outgoing connection type!"); } }
public void validateAddIncomingConnection(final String type, final Connection connection) { super.validateAddIncomingConnection(type, connection); if (!org.jbpm.workflow.core.Node.CONNECTION_DEFAULT_TYPE.equals(type)) { throw new IllegalArgumentException( "This type of node [" + connection.getTo().getMetaData().get("UniqueId") + ", " + connection.getTo().getName() + "] only accepts default incoming connection type!"); } if (getFrom() != null && !"true".equals(System.getProperty("jbpm.enable.multi.con"))) { throw new IllegalArgumentException( "This type of node [" + connection.getTo().getMetaData().get("UniqueId") + ", " + connection.getTo().getName() + "] cannot have more than one incoming connection!"); } }
String bendpoints = (String) connection.getMetaData().get("bendpoints"); xmlDump.append( " <bpmndi:BPMNEdge bpmnElement=\"" + getUniqueNodeId(connection.getFrom()) + "-" + getUniqueNodeId(connection.getTo()) + "\" >" + EOL); Integer x = (Integer) connection.getFrom().getMetaData().get("x"); if (x == null) { x = 0; Integer y = (Integer) connection.getFrom().getMetaData().get("y"); if (y == null) { y = 0; Integer width = (Integer) connection.getFrom().getMetaData().get("width"); if (width == null) { width = 40; Integer height = (Integer) connection.getFrom().getMetaData().get("height"); if (height == null) { height = 40; x = (Integer) connection.getTo().getMetaData().get("x"); if (x == null) { x = 0; y = (Integer) connection.getTo().getMetaData().get("y"); if (y == null) { y = 0; width = (Integer) connection.getTo().getMetaData().get("width");
private boolean isConnectionRepresentingLinkEvent(Connection connection) { boolean bValue = connection.getMetaData().get("linkNodeHidden") != null; return bValue; }
protected void triggerNodeInstance(org.jbpm.workflow.instance.NodeInstance nodeInstance, String type, boolean fireEvents) { boolean hidden = false; if (getNode().getMetaData().get("hidden") != null) { hidden = true; } InternalKnowledgeRuntime kruntime = getProcessInstance().getKnowledgeRuntime(); if (!hidden && fireEvents) { ((InternalProcessRuntime) kruntime.getProcessRuntime()) .getProcessEventSupport().fireBeforeNodeLeft(this, kruntime); } // trigger next node nodeInstance.trigger(this, type); Collection<Connection> outgoing = getNode().getOutgoingConnections(type); for (Connection conn : outgoing) { if (conn.getTo().getId() == nodeInstance.getNodeId()) { this.metaData.put("OutgoingConnection", conn.getMetaData().get("UniqueId")); break; } } if (!hidden && fireEvents) { ((InternalProcessRuntime) kruntime.getProcessRuntime()) .getProcessEventSupport().fireAfterNodeLeft(this, kruntime); } }
Collection<Connection> incoming = getNode().getIncomingConnections(type); for (Connection conn : incoming) { if (conn.getFrom().getId() == from.getNodeId()) { this.metaData.put("IncomingConnection", conn.getMetaData().get("UniqueId")); break;
public void addIncomingConnection(String type, Connection connection) { if (connection.getFrom().getNodeContainer() == this) { linkOutgoingConnections(connection.getFrom().getId(), connection.getFromType(), org.jbpm.workflow.core.Node.CONNECTION_DEFAULT_TYPE); } else { super.addIncomingConnection(type, connection); CompositeNode.NodeAndType inNode = internalGetLinkedIncomingNode(type); if (inNode != null) { CompositeNodeStart start = new CompositeNodeStart(this, connection.getFrom(), type); internalAddNode(start); NodeImpl node = (NodeImpl) inNode.getNode(); if (node != null) { new ConnectionImpl( start, org.jbpm.workflow.core.Node.CONNECTION_DEFAULT_TYPE, inNode.getNode(), inNode.getType()); } } } }
protected void triggerConnection(Connection connection) { triggerNodeInstance(followConnection(connection), connection.getToType()); }
public String getFromType() { return delegate.getFromType(); }
public boolean evaluate(NodeInstance instance, Connection connection, Constraint constraint) { WorkflowProcessInstance processInstance = instance.getProcessInstance(); InternalAgenda agenda = (InternalAgenda) ((ProcessInstance) processInstance).getKnowledgeRuntime().getAgenda(); String rule = "RuleFlow-Split-" + processInstance.getProcessId() + "-" + ((Node) instance.getNode()).getUniqueId() + "-" + ((Node) connection.getTo()).getUniqueId() + "-" + connection.getToType(); return agenda.isRuleActiveInRuleFlowGroup( "DROOLS_SYSTEM", rule, processInstance.getId() ); }
public void validateAddOutgoingConnection(final String type, final Connection connection) { super.validateAddOutgoingConnection(type, connection); if (!org.jbpm.workflow.core.Node.CONNECTION_DEFAULT_TYPE.equals(type)) { throw new IllegalArgumentException( "This type of node [" + connection.getFrom().getMetaData().get("UniqueId") + ", " + connection.getFrom().getName() + "] only accepts default outgoing connection type!"); } if (getTo() != null && !"true".equals(System.getProperty("jbpm.enable.multi.con"))) { throw new IllegalArgumentException( "This type of node [" + connection.getFrom().getMetaData().get("UniqueId") + ", " + connection.getFrom().getName() + "] cannot have more than one outgoing connection!"); } }
public void validateAddIncomingConnection(final String type, final Connection connection) { super.validateAddIncomingConnection(type, connection); if (!org.jbpm.workflow.core.Node.CONNECTION_DEFAULT_TYPE.equals(type)) { throw new IllegalArgumentException( "This type of node [" + connection.getTo().getMetaData().get("UniqueId") + ", " + connection.getTo().getName() + "] only accepts default incoming connection type!"); } if (getFrom() != null && !"true".equals(System.getProperty("jbpm.enable.multi.con"))) { throw new IllegalArgumentException( "This type of node [" + connection.getTo().getMetaData().get("UniqueId") + ", " + connection.getTo().getName() + "] cannot have more than one incoming connection!"); } }
getUniqueNodeId(connection.getFrom()) + "-" + getUniqueNodeId(connection.getTo()) + "\" sourceRef=\"" + getUniqueNodeId(connection.getFrom()) + "\" "); xmlDump.append("targetRef=\"" + getUniqueNodeId(connection.getTo()) + "\" "); if (metaDataType == META_DATA_AS_NODE_PROPERTY) { String bendpoints = (String) connection.getMetaData().get("bendpoints"); if (bendpoints != null) { xmlDump.append("g:bendpoints=\"" + bendpoints + "\" "); if (connection.getFrom() instanceof Split) { Split split = (Split) connection.getFrom(); if (split.getType() == Split.TYPE_XOR || split.getType() == Split.TYPE_OR) { Constraint constraint = split.getConstraint(connection);
private String createSplitRule(Process process, Connection connection, String constraint) { return "rule \"RuleFlow-Split-" + process.getId() + "-" + ((org.jbpm.workflow.core.Node) connection.getFrom()).getUniqueId() + "-" + ((org.jbpm.workflow.core.Node) connection.getTo()).getUniqueId() + "-" + connection.getToType() + "\" @Propagation(EAGER) \n" + " ruleflow-group \"DROOLS_SYSTEM\" \n" + " when \n" + " " + constraint + "\n" + " then \n" + "end \n\n"; }
private boolean processConnectionInfo(ConnectionInfo connectionInfo, Node[] nodes) { for (Node node: nodes) { for (List<Connection> connections: node.getOutgoingConnections().values()) { for (Connection connection: connections) { String id = (String) connection.getMetaData().get("UniqueId"); if (id != null && id.equals(connectionInfo.getElementRef())) { ((ConnectionImpl) connection).setMetaData( "bendpoints", connectionInfo.getBendpoints()); return true; } } } if (node instanceof NodeContainer) { boolean found = processConnectionInfo(connectionInfo, ((NodeContainer) node).getNodes()); if (found) { return true; } } } return false; }
protected void triggerNodeInstance(org.jbpm.workflow.instance.NodeInstance nodeInstance, String type, boolean fireEvents) { boolean hidden = false; if (getNode().getMetaData().get("hidden") != null) { hidden = true; } InternalKnowledgeRuntime kruntime = getProcessInstance().getKnowledgeRuntime(); if (!hidden && fireEvents) { ((InternalProcessRuntime) kruntime.getProcessRuntime()) .getProcessEventSupport().fireBeforeNodeLeft(this, kruntime); } // trigger next node nodeInstance.trigger(this, type); Collection<Connection> outgoing = getNode().getOutgoingConnections(type); for (Connection conn : outgoing) { if (conn.getTo().getId() == nodeInstance.getNodeId()) { this.metaData.put("OutgoingConnection", conn.getMetaData().get("UniqueId")); break; } } if (!hidden && fireEvents) { ((InternalProcessRuntime) kruntime.getProcessRuntime()) .getProcessEventSupport().fireAfterNodeLeft(this, kruntime); } }