public void validateAddOutgoingConnection(final String type, final Connection connection) { CompositeNode.NodeAndType nodeAndType = internalGetLinkedOutgoingNode(type); if (connection.getTo().getNodeContainer() == this) { if (nodeAndType != null) { throw new IllegalArgumentException("Cannot link outgoing connection type more than once: " + type); } } else { if (nodeAndType != null) { NodeImpl node = (NodeImpl) nodeAndType.getNode(); if (node != null) { ((NodeImpl) nodeAndType.getNode()).validateAddOutgoingConnection(nodeAndType.getType(), connection); } } } }
public void validateRemoveOutgoingConnection(final String type, final Connection connection) { CompositeNode.NodeAndType nodeAndType = internalGetLinkedOutgoingNode(type); if (nodeAndType != null) { for (Connection outConnection: nodeAndType.getNode().getOutgoingConnections(nodeAndType.getType())) { if (((CompositeNodeEnd) outConnection.getTo()).getOutNodeId() == connection.getTo().getId()) { ((NodeImpl) nodeAndType.getNode()).validateRemoveOutgoingConnection(nodeAndType.getType(), outConnection); return; } } throw new IllegalArgumentException( "Could not find internal outgoing connection for node"); } }
public void removeOutgoingConnection(String type, Connection connection) { super.removeOutgoingConnection(type, connection); CompositeNode.NodeAndType nodeAndType = internalGetLinkedOutgoingNode(type); if (nodeAndType != null) { for (Connection outConnection: nodeAndType.getNode().getOutgoingConnections(nodeAndType.getType())) { if (((CompositeNodeEnd) outConnection.getTo()).getOutNodeId() == connection.getTo().getId()) { Node compositeNodeEnd = outConnection.getTo(); ((ConnectionImpl) outConnection).terminate(); internalRemoveNode(compositeNodeEnd); return; } } throw new IllegalArgumentException( "Could not find internal outgoing connection for node"); } }
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) { CompositeNode.NodeAndType nodeAndType = internalGetLinkedOutgoingNode(type); if (connection.getTo().getNodeContainer() == this) { if (nodeAndType != null) { throw new IllegalArgumentException("Cannot link outgoing connection type more than once: " + type); } } else { if (nodeAndType != null) { NodeImpl node = (NodeImpl) nodeAndType.getNode(); if (node != null) { ((NodeImpl) nodeAndType.getNode()).validateAddOutgoingConnection(nodeAndType.getType(), connection); } } } }
public void validateRemoveOutgoingConnection(final String type, final Connection connection) { CompositeNode.NodeAndType nodeAndType = internalGetLinkedOutgoingNode(type); if (nodeAndType != null) { for (Connection outConnection: nodeAndType.getNode().getOutgoingConnections(nodeAndType.getType())) { if (((CompositeNodeEnd) outConnection.getTo()).getOutNodeId() == connection.getTo().getId()) { ((NodeImpl) nodeAndType.getNode()).validateRemoveOutgoingConnection(nodeAndType.getType(), outConnection); return; } } throw new IllegalArgumentException( "Could not find internal outgoing connection for node"); } }
public void removeOutgoingConnection(String type, Connection connection) { super.removeOutgoingConnection(type, connection); CompositeNode.NodeAndType nodeAndType = internalGetLinkedOutgoingNode(type); if (nodeAndType != null) { for (Connection outConnection: nodeAndType.getNode().getOutgoingConnections(nodeAndType.getType())) { if (((CompositeNodeEnd) outConnection.getTo()).getOutNodeId() == connection.getTo().getId()) { Node compositeNodeEnd = outConnection.getTo(); ((ConnectionImpl) outConnection).terminate(); internalRemoveNode(compositeNodeEnd); return; } } throw new IllegalArgumentException( "Could not find internal outgoing connection for node"); } }
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); } } } }