Refine search
protected Node createNode(Attributes attrs) { final String type = attrs.getValue("gatewayDirection"); if ("Diverging".equals(type)) { Split split = new Split(); split.setType(Split.TYPE_XAND); split.setMetaData("EventBased", "true"); return split; } else { throw new IllegalArgumentException( "Unknown gateway direction: " + type); } }
if ( nodes[i] instanceof Split ) { Split split = (Split) nodes[i]; if ( split.getType() == Split.TYPE_XOR || split.getType() == Split.TYPE_OR ) { for ( Connection connection : split.getDefaultOutgoingConnections() ) { Constraint constraint = split.getConstraint( connection ); if ( constraint != null && "rule".equals( constraint.getType() ) ) { builder.append( createSplitRule( process, connection, split.getConstraint( connection ).getConstraint() ) ); EventNode state = (EventNode) nodes[i]; builder.append( createEventStateRule(process, state) ); } else if (nodes[i].getMetaData().get("customActivationExpression") != null) { builder.append( createActivationRule( process, nodes[i] ) );
public void setConstraint(final Connection connection, final Constraint constraint) { if ( this.type == TYPE_OR || this.type == TYPE_XOR ) { 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); } else { throw new UnsupportedOperationException( "Constraints are " + "only supported with XOR or OR split types, not with type:" + getType() ); } }
protected Node createNode(Attributes attrs) { final String type = attrs.getValue("gatewayDirection"); if ("Converging".equals(type)) { Join join = new Join(); join.setType(Join.TYPE_AND); return join; } else if ("Diverging".equals(type)) { Split split = new Split(); split.setType(Split.TYPE_AND); return split; } else { throw new IllegalArgumentException( "Unknown gateway direction: " + type); } }
switch ( split.getType() ) { case Split.TYPE_AND : triggerCompleted(org.jbpm.workflow.core.Node.CONNECTION_DEFAULT_TYPE, true); break; case Split.TYPE_XOR : List<Connection> outgoing = split.getDefaultOutgoingConnections(); int priority = Integer.MAX_VALUE; Connection selected = null; for ( final Iterator<Connection> iterator = outgoing.iterator(); iterator.hasNext(); ) { final Connection connection = (Connection) iterator.next(); ConstraintEvaluator constraint = (ConstraintEvaluator) split.getConstraint( connection ); if ( constraint != null && constraint.getPriority() < priority && !constraint.isDefault()) { try { "Exception when trying to evaluate constraint " + constraint.getName() + " in split " + split.getName(), e); for ( final Iterator<Connection> iterator = outgoing.iterator(); iterator.hasNext(); ) { final Connection connection = (Connection) iterator.next(); if (split.isDefault(connection)) { selected = connection; break; throw new IllegalArgumentException( "XOR split could not find at least one valid outgoing connection for split " + getSplit().getName() ); case Split.TYPE_OR : ((NodeInstanceContainer) getNodeInstanceContainer()).removeNodeInstance(this); outgoing = split.getDefaultOutgoingConnections();
Split splitNode = ( Split ) node; if ( splitNode.getType() != Split.TYPE_XOR && splitNode.getType() != Split.TYPE_OR ) { Map<ConnectionRef, Constraint> map = new HashMap<ConnectionRef, Constraint>( splitNode.getConstraints() ); for ( Iterator<Map.Entry<ConnectionRef, Constraint>> it = map.entrySet().iterator(); it.hasNext(); ) { Map.Entry<ConnectionRef, Constraint> entry = it.next(); ConstraintImpl constraint = (ConstraintImpl) entry.getValue(); Connection outgoingConnection = null; for (Connection out: splitNode.getDefaultOutgoingConnections()) { if (out.getToType().equals(connection.getToType()) && out.getTo().getId() == connection.getNodeId()) { outgoingConnection = out; throw new IllegalArgumentException("Could not find outgoing connection"); if (constraint == null && splitNode.isDefault(outgoingConnection)) { ruleConstraint.setType(constraint.getType()); ruleConstraint.setConstraint(constraint.getConstraint()); splitNode.setConstraint( outgoingConnection, ruleConstraint ); } else if (constraint != null && "code".equals( constraint.getType() ) ) { ReturnValueConstraintEvaluator returnValueConstraint = new ReturnValueConstraintEvaluator(); returnValueConstraint.setType(constraint.getType()); returnValueConstraint.setConstraint(constraint.getConstraint()); splitNode.setConstraint( outgoingConnection, returnValueConstraint );
currentNode = ((AsyncEventNode) currentNode).getActualNode(); List<Connection> connections = currentNode.getOutgoingConnections(org.jbpm.workflow.core.Node.CONNECTION_DEFAULT_TYPE); if (currentNode instanceof Split && ((Split) currentNode).getType() == Split.TYPE_XOR) { if (vistedNodes.contains(startAt.getId())) { return false; continue; } else { xorCopy.add(nextNode.getId()); if (nextNode.getId() != lookFor.getId()) {
private boolean processNodes(String name, Node currentNode, String testCode, Map<String, String> cases, Map<String, String> ongoingCases) { if (currentNode instanceof Split) { Split split = (Split) currentNode; switch (split.getType()) { case Split.TYPE_AND: boolean done = false; String startTestCode = testCode; int counter = 1; for (Connection c: split.getDefaultOutgoingConnections()) { if (processNodes(name + counter++, c.getTo(), startTestCode, cases, ongoingCases)) { done = true; int i = 1; done = true; for (Connection c: split.getDefaultOutgoingConnections()) { String newTestCode = testCode + " // please make sure that the following constraint is selected to node " + c.getTo().getName() + ":\n" + " // " + split.getConstraint(c).getConstraint() + "\n"; if (!processNodes(name + "Constraint" + i++, c.getTo(), newTestCode, cases, ongoingCases)) { done = false; throw new IllegalArgumentException("Unknown split type " + split.getType());
Constraint constraint = buildConstraint(connection, nodeImpl); if (constraint != null) { nodeImpl.addConstraint(new ConnectionRef(connection.getId(), target.getId(), NodeImpl.CONNECTION_DEFAULT_TYPE), constraint); Split split = (Split) source; Constraint constraint = buildConstraint(connection, split); split.addConstraint( new ConnectionRef(target.getId(), NodeImpl.CONNECTION_DEFAULT_TYPE), constraint);
if (split.getType() == Split.TYPE_UNDEFINED) { addErrorMessage(process, node, "Split has no type."); if (split.getFrom() == null && !acceptsNoIncomingConnections(node)) { addErrorMessage(process, node, "Split has no incoming connection."); if (split.getDefaultOutgoingConnections().size() < 2) { addErrorMessage(process, node, errors, "Split does not have more than one outgoing connection: " + split.getOutgoingConnections().size() + "."); if (split.getType() == Split.TYPE_XOR || split.getType() == Split.TYPE_OR) { for (final Iterator<Connection> it = split.getDefaultOutgoingConnections().iterator(); it.hasNext(); ) { final Connection connection = it.next(); if (split.getConstraint(connection) == null && !split.isDefault(connection) || (!split.isDefault(connection) && (split.getConstraint(connection).getConstraint() == null || split.getConstraint(connection).getConstraint().trim().length() == 0))) { addErrorMessage(process, node,
process.addNode(faultNode); Split split = new Split(); split.setName("split"); split.setMetaData("x", 1); split.setMetaData("y", 2); split.setMetaData("width", 3); split.setMetaData("height", 4); split.setType(Split.TYPE_XOR); Connection connection = new ConnectionImpl(split, Node.CONNECTION_DEFAULT_TYPE, actionNode, Node.CONNECTION_DEFAULT_TYPE); Constraint constraint = new ConstraintImpl(); constraint.setType("type1"); constraint.setConstraint("constraint-text1"); split.setConstraint(connection, constraint); connection = new ConnectionImpl(split, Node.CONNECTION_DEFAULT_TYPE, ruleSetNode, Node.CONNECTION_DEFAULT_TYPE); constraint = new ConstraintImpl(); constraint.setType("type2"); constraint.setConstraint("constraint-text2"); split.setConstraint(connection, constraint); process.addNode(split); new ConnectionImpl(startNode, Node.CONNECTION_DEFAULT_TYPE, split, Node.CONNECTION_DEFAULT_TYPE);
public boolean isDefault(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()); Constraint constraint = this.constraints.get(ref); String defaultConnection = (String) getMetaData().get("Default"); String connectionId = (String) connection.getMetaData().get("UniqueId"); if (constraint != null) { return constraint.isDefault(); } else if (constraint == null && connectionId.equals(defaultConnection)) { return true; } else { return false; } } throw new UnsupportedOperationException( "Constraints are " + "only supported with XOR or OR split types, not with: " + getType() ); }
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() ); }
protected Node createNode() { return new Split(); }
public void writeNode(Node node, StringBuilder xmlDump, boolean includeMeta) { Split splitNode = (Split) node; writeNode("split", splitNode, xmlDump, includeMeta); int type = splitNode.getType(); if (type != 0) { xmlDump.append("type=\"" + type + "\" "); if (splitNode.getConstraints().isEmpty()) { endNode(xmlDump); } else { for (Map.Entry<ConnectionRef, Constraint> entry: splitNode.getConstraints().entrySet()) { ConnectionRef connection = entry.getKey(); Constraint constraint = entry.getValue();
if (split.getType() == Split.TYPE_XOR || split.getType() == Split.TYPE_OR) { Constraint constraint = split.getConstraint(connection); if (constraint == null) { xmlDump.append(">" + EOL +
Split column1 = new Split(); column1.setRowLayout(false); Split row = new Split(); Split column2 = new Split(); column2.setRowLayout(false); column2.setChildren(new Leaf("middle.top"), new Divider(), new Leaf( "middle"), new Divider(), new Leaf("middle.bottom")); row.setChildren(new Leaf("left"), new Divider(), column2, new Divider(), new Leaf("right")); column1.setChildren(row, new Divider(), new Leaf("bottom")); // Once the layout is done, the code is easy JXMultiSplitPane msp = new JXMultiSplitPane(); MultiSplitLayout layout = new MultiSplitLayout(column1); msp.setLayout(layout); msp.add(new JButton("bottom"), "bottom"); msp.add(new JButton("left"), "left"); msp.add(new JButton("right"), "right"); msp.add(new JButton("middle.bottom"), "middle.bottom"); msp.add(new JButton("middle"), "middle"); msp.add(new JButton("middle.top"), "middle.top");
JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Split horizontal = new Split(); Split left = getVerticalSplit(LEFT, 0.5, 0.5); left.setWeight(0.2); Split center = getVerticalSplit(CENTER, 0.8, 0.2); center.setWeight(0.6); Split right = getVerticalSplit(RIGHT, 0.5, 0.5); right.setWeight(0.2); horizontal.setChildren(left, new Divider(), center, new Divider(), right); MultiSplitLayout layout = new MultiSplitLayout(horizontal); JXMultiSplitPane splitPane = new JXMultiSplitPane(layout); Split split = new Split(); split.setRowLayout(false); Leaf top = new Leaf(name + TOP); top.setWeight(topWeight); Leaf bottom = new Leaf(name + BOTTOM); bottom.setWeight(bottomWeight); split.setChildren(top, new Divider(), bottom); return split;
public void handleNode(final Node node, final Element element, final String uri, final String localName, final ExtensibleXmlParser parser) throws SAXException { super.handleNode(node, element, uri, localName, parser); Split splitNode = (Split) node; String type = element.getAttribute("type"); if (type != null && type.length() != 0 ) { splitNode.setType(new Integer(type)); } }