public void removeIncomingConnection(String type, Connection connection) { super.removeIncomingConnection(type, connection); CompositeNode.NodeAndType nodeAndType = internalGetLinkedIncomingNode(type); if (nodeAndType != null) { for (Connection inConnection: nodeAndType.getNode().getIncomingConnections(nodeAndType.getType())) { if (((CompositeNodeStart) inConnection.getFrom()).getInNodeId() == connection.getFrom().getId()) { Node compositeNodeStart = inConnection.getFrom(); ((ConnectionImpl) inConnection).terminate(); internalRemoveNode(compositeNodeStart); return; } } throw new IllegalArgumentException( "Could not find internal incoming 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"); } }
if (connection.getTo() instanceof CompositeNodeEnd) { removeNode(connection.getTo()); ((ConnectionImpl) connection).terminate();
if (connection.getFrom() instanceof CompositeNodeStart) { removeNode(connection.getFrom()); ((ConnectionImpl) connection).terminate();
private static void insertNodeInBetween(RuleFlowProcess process, long startNodeId, long endNodeId, NodeImpl node) { if (process == null) { throw new IllegalArgumentException("Process may not be null"); } NodeImpl selectedNode = (NodeImpl) process.getNode(startNodeId); if (selectedNode == null) { throw new IllegalArgumentException("Node " + startNodeId + " not found in process " + process.getId()); } for (Connection connection: selectedNode.getDefaultOutgoingConnections()) { if (connection.getTo().getId() == endNodeId) { process.addNode(node); NodeImpl endNode = (NodeImpl) connection.getTo(); ((ConnectionImpl) connection).terminate(); new ConnectionImpl(selectedNode, NodeImpl.CONNECTION_DEFAULT_TYPE, node, NodeImpl.CONNECTION_DEFAULT_TYPE); new ConnectionImpl(node, NodeImpl.CONNECTION_DEFAULT_TYPE, endNode, NodeImpl.CONNECTION_DEFAULT_TYPE); return; } } throw new IllegalArgumentException("Connection to node " + endNodeId + " not found in process " + process.getId()); }
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 removeIncomingConnection(String type, Connection connection) { super.removeIncomingConnection(type, connection); CompositeNode.NodeAndType nodeAndType = internalGetLinkedIncomingNode(type); if (nodeAndType != null) { for (Connection inConnection: nodeAndType.getNode().getIncomingConnections(nodeAndType.getType())) { if (((CompositeNodeStart) inConnection.getFrom()).getInNodeId() == connection.getFrom().getId()) { Node compositeNodeStart = inConnection.getFrom(); ((ConnectionImpl) inConnection).terminate(); internalRemoveNode(compositeNodeStart); return; } } throw new IllegalArgumentException( "Could not find internal incoming connection for node"); } }
if (connection.getTo() instanceof CompositeNodeEnd) { removeNode(connection.getTo()); ((ConnectionImpl) connection).terminate();
if (connection.getFrom() instanceof CompositeNodeStart) { removeNode(connection.getFrom()); ((ConnectionImpl) connection).terminate();
private static void insertNodeInBetween(RuleFlowProcess process, long startNodeId, long endNodeId, NodeImpl node) { if (process == null) { throw new IllegalArgumentException("Process may not be null"); } NodeImpl selectedNode = (NodeImpl) process.getNode(startNodeId); if (selectedNode == null) { throw new IllegalArgumentException("Node " + startNodeId + " not found in process " + process.getId()); } for (Connection connection: selectedNode.getDefaultOutgoingConnections()) { if (connection.getTo().getId() == endNodeId) { process.addNode(node); NodeImpl endNode = (NodeImpl) connection.getTo(); ((ConnectionImpl) connection).terminate(); new ConnectionImpl(selectedNode, NodeImpl.CONNECTION_DEFAULT_TYPE, node, NodeImpl.CONNECTION_DEFAULT_TYPE); new ConnectionImpl(node, NodeImpl.CONNECTION_DEFAULT_TYPE, endNode, NodeImpl.CONNECTION_DEFAULT_TYPE); return; } } throw new IllegalArgumentException("Connection to node " + endNodeId + " not found in process " + process.getId()); }