@Override public long getId() { return node.getId(); }
public NodeAndType(Node node, String type) { if (node == null || type == null) { throw new IllegalArgumentException( "Node or type may not be null!"); } this.nodeId = node.getId(); this.node = node; this.type = type; }
protected void validateRemoveNode(Node node) { if (node == null) { throw new IllegalArgumentException("Node is null"); } if (this.nodes.get(node.getId()) == null) { throw new IllegalArgumentException("Unknown node: " + node); } }
public void addNode(final Node node) { validateAddNode(node); if (!this.nodes.containsValue(node)) { this.nodes.put(new Long(node.getId()), node); } }
public void removeNode(final Node node) { validateRemoveNode(node); this.nodes.remove(new Long(node.getId())); }
private void decreaseAllTriggers() { // decrease trigger count for all incoming connections for (final Connection connection: getJoin().getDefaultIncomingConnections()) { final Integer count = (Integer) this.triggers.get( connection.getFrom().getId() ); if ( count.intValue() == 1 ) { this.triggers.remove( connection.getFrom().getId() ); } else { this.triggers.put( connection.getFrom().getId(), count.intValue() - 1 ); } } }
protected void addErrorMessage(RuleFlowProcess process, Node node, List<ProcessValidationError> errors, String message) { String error = String.format("Node '%s' [%d] " + message, node.getName(), node.getId()); errors.add(new ProcessValidationErrorImpl(process, error)); } }
public CompositeNodeEnd(CompositeNode parentNode, Node outNode, String outType) { setName("Composite node end"); this.outNodeId = outNode.getId(); this.outNode = outNode; this.outType = outType; this.parentNode = parentNode; setMetaData("hidden", true); }
public CompositeNodeStart(CompositeNode parentNode, Node outNode, String outType) { setName("Composite node start"); this.inNodeId = outNode.getId(); this.inNode = outNode; this.inType = outType; this.parentNode = parentNode; setMetaData("hidden", true); }
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 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 Constraint getConstraint(final Connection connection) { if ( connection == null ) { throw new IllegalArgumentException( "connection is null" ); } if ( this.type == TYPE_OR || this.type == TYPE_XOR ) { ConnectionRef ref = new ConnectionRef((String)connection.getMetaData().get("UniqueId"), connection.getTo().getId(), connection.getToType()); return this.constraints.get(ref); } throw new UnsupportedOperationException( "Constraints are " + "only supported with XOR or OR split types, not with: " + getType() ); }
private boolean checkAllActivated() { // check whether all parent nodes have been triggered for (final Connection connection: getJoin().getDefaultIncomingConnections()) { if ( this.triggers.get( connection.getFrom().getId() ) == null ) { return false; } } return true; }
public void setConstraint(final Connection connection, final Constraint constraint) { if (connection == null) { throw new IllegalArgumentException("connection is null"); } if (!getDefaultOutgoingConnections().contains(connection)) { throw new IllegalArgumentException("connection is unknown:" + connection); } addConstraint(new ConnectionRef((String)connection.getMetaData().get("UniqueId"), connection.getTo().getId(), connection.getToType()), constraint); }
public void setConstraint(final Connection connection, final Constraint constraint) { if ( connection == null ) { throw new IllegalArgumentException( "connection is null" ); } if (!getDefaultOutgoingConnections().contains(connection)) { throw new IllegalArgumentException("connection is unknown:" + connection); } addConstraint( new ConnectionRef((String)connection.getMetaData().get("UniqueId"), connection.getTo().getId(), connection.getToType()), constraint); }
public static String getUniqueNodeId(Node node) { String result = (String) node.getMetaData().get("UniqueId"); if (result != null) { return result; } result = node.getId() + ""; NodeContainer nodeContainer = node.getNodeContainer(); while (nodeContainer instanceof CompositeNode) { CompositeNode composite = (CompositeNode) nodeContainer; result = composite.getId() + "-" + result; nodeContainer = composite.getNodeContainer(); } return "_" + result; }
public void removeConstraint(Connection connection) { ConnectionRef ref = new ConnectionRef((String)connection.getMetaData().get("UniqueId"), connection.getTo().getId(), connection.getToType()); internalRemoveConstraint(ref); }
public void validateRemoveIncomingConnection(final String type, final Connection 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()) { ((NodeImpl) nodeAndType.getNode()).validateRemoveIncomingConnection(nodeAndType.getType(), inConnection); return; } } throw new IllegalArgumentException( "Could not find internal incoming connection for node"); } }
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"); } }