} else if ("conditionalEventDefinition".equals(nodeName)) { StateNode stateNode = new StateNode(); stateNode.setId(node.getId()); stateNode.setName(node.getName()); stateNode.setMetaData("UniqueId", node.getMetaData().get("UniqueId")); node = stateNode;
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 writeNode(Node node, StringBuilder xmlDump, int metaDataType) { StateNode stateNode = (StateNode) node; String condition = (String) stateNode.getMetaData("Condition"); writeNode("intermediateCatchEvent", stateNode, xmlDump, metaDataType); xmlDump.append(">" + EOL); writeExtensionElements(node, xmlDump); xmlDump.append(" <conditionalEventDefinition>" + EOL); xmlDump.append(" <condition xsi:type=\"tFormalExpression\" language=\"" + XmlBPMNProcessDumper.RULE_LANGUAGE + "\">" + XmlDumper.replaceIllegalChars(condition) + "</condition>" + EOL); xmlDump.append(" </conditionalEventDefinition>" + EOL); endNode("intermediateCatchEvent", xmlDump); }
private String createStateRule(Process process, StateNode state, ConnectionRef key, Constraint constraint) { if (constraint.getConstraint() == null || constraint.getConstraint().trim().length() == 0) { return ""; } else { return "rule \"RuleFlowStateNode-" + process.getId() + "-" + state.getUniqueId() + "-" + key.getNodeId() + "-" + key.getToType() + "\" @Propagation(EAGER) \n" + " ruleflow-group \"DROOLS_SYSTEM\" \n" + " when \n" + " " + state.getConstraints().get(key).getConstraint() + "\n" + " then \n" + "end \n\n"; } }
StateNode stateNode = new StateNode(); stateNode.setName("state"); stateNode.setMetaData("x", 1); stateNode.setMetaData("y", 2); stateNode.setMetaData("width", 3); stateNode.setMetaData("height", 4); timer = new Timer(); timer.setDelay("100"); timer.setPeriod("100"); action = new DroolsConsequenceAction("dialect", "consequence"); stateNode.addTimer(timer, action); timer = new Timer(); timer.setDelay("200"); timer.setPeriod("200"); action = new DroolsConsequenceAction("dialect", "consequence"); stateNode.addTimer(timer, action); actions = new ArrayList<DroolsAction>(); action1 = new DroolsConsequenceAction("java", "System.out.println(\"action1\");"); action2 = new DroolsConsequenceAction("java", "System.out.println(\"action2\");"); actions.add(action2); stateNode.setActions(ExtendedNodeImpl.EVENT_NODE_ENTER, actions); stateNode.setActions(ExtendedNodeImpl.EVENT_NODE_EXIT, actions); new ConnectionImpl(compositeNode, Node.CONNECTION_DEFAULT_TYPE, stateNode, Node.CONNECTION_DEFAULT_TYPE); connection = new ConnectionImpl(stateNode, Node.CONNECTION_DEFAULT_TYPE, join, Node.CONNECTION_DEFAULT_TYPE); constraint.setType("type1"); constraint.setConstraint("constraint-text1 %&<>"); stateNode.setConstraint(connection, constraint);
String condition = (String) stateNode.getMetaData("Condition"); Constraint constraint = new ConstraintImpl(); constraint.setConstraint(condition); constraint.setType("rule"); for (org.kie.api.definition.process.Connection connection: stateNode.getDefaultOutgoingConnections()) { stateNode.setConstraint(connection, constraint);
Connection selected = null; int priority = Integer.MAX_VALUE; for (Connection connection: stateNode.getOutgoingConnections(NodeImpl.CONNECTION_DEFAULT_TYPE)) { Constraint constraint = stateNode.getConstraint(connection); if (constraint != null && constraint.getPriority() < priority) { String rule = "RuleFlowStateNode-" + getProcessInstance().getProcessId() + "-" + getStateNode().getUniqueId() + "-" + connection.getTo().getId() + "-" + connection.getToType();
protected Node createNode() { return new StateNode(); }
private String getActivationEventType() { return "RuleFlowStateNode-" + getProcessInstance().getProcessId() + "-" + getStateNode().getUniqueId(); }
protected void handleStateNode(final Node node, final Element element, final String uri, final String localName, final ExtensibleXmlParser parser) throws SAXException { super.handleNode(node, element, uri, localName, parser); StateNode stateNode = (StateNode) node; org.w3c.dom.Node xmlNode = element.getFirstChild(); while (xmlNode != null) { String nodeName = xmlNode.getNodeName(); if ("conditionalEventDefinition".equals(nodeName)) { org.w3c.dom.Node subNode = xmlNode.getFirstChild(); while (subNode != null) { String subnodeName = subNode.getNodeName(); if ("condition".equals(subnodeName)) { stateNode.setMetaData("Condition", xmlNode.getTextContent()); break; } subNode = subNode.getNextSibling(); } } xmlNode = xmlNode.getNextSibling(); } }
String condition = (String) stateNode.getMetaData("Condition"); Constraint constraint = new ConstraintImpl(); constraint.setConstraint(condition); constraint.setType("rule"); for (org.kie.api.definition.process.Connection connection : stateNode.getDefaultOutgoingConnections()) { stateNode.setConstraint(connection, constraint);
Connection selected = null; int priority = Integer.MAX_VALUE; for (Connection connection: stateNode.getOutgoingConnections(NodeImpl.CONNECTION_DEFAULT_TYPE)) { Constraint constraint = stateNode.getConstraint(connection); if (constraint != null && constraint.getPriority() < priority) { String rule = "RuleFlowStateNode-" + getProcessInstance().getProcessId() + "-" + getStateNode().getUniqueId() + "-" + connection.getTo().getId() + "-" + connection.getToType();
process.addNode(new EventNode()); process.addNode(new FaultNode()); process.addNode(new StateNode()); process.addNode(new DynamicNode());
private String createStateRule(Process process, StateNode state, ConnectionRef key, Constraint constraint) { if (constraint.getConstraint() == null || constraint.getConstraint().trim().length() == 0) { return ""; } else { return "rule \"RuleFlowStateNode-" + process.getId() + "-" + state.getUniqueId() + "-" + key.getNodeId() + "-" + key.getToType() + "\" @Propagation(EAGER) \n" + " ruleflow-group \"DROOLS_SYSTEM\" \n" + " when \n" + " " + state.getConstraints().get(key).getConstraint() + "\n" + " then \n" + "end \n\n"; } }
private String getActivationEventType() { return "RuleFlowStateNode-" + getProcessInstance().getProcessId() + "-" + getStateNode().getUniqueId(); }
protected void handleStateNode(final Node node, final Element element, final String uri, final String localName, final ExtensibleXmlParser parser) throws SAXException { super.handleNode(node, element, uri, localName, parser); StateNode stateNode = (StateNode) node; org.w3c.dom.Node xmlNode = element.getFirstChild(); while (xmlNode != null) { String nodeName = xmlNode.getNodeName(); if ("conditionalEventDefinition".equals(nodeName)) { org.w3c.dom.Node subNode = xmlNode.getFirstChild(); while (subNode != null) { String subnodeName = subNode.getNodeName(); if ("condition".equals(subnodeName)) { stateNode.setMetaData("Condition", xmlNode.getTextContent()); break; } subNode = subNode.getNextSibling(); } } xmlNode = xmlNode.getNextSibling(); } }
String condition = (String) stateNode.getMetaData("Condition"); Constraint constraint = new ConstraintImpl(); constraint.setConstraint(condition); constraint.setType("rule"); for (org.kie.api.definition.process.Connection connection: stateNode.getDefaultOutgoingConnections()) { stateNode.setConstraint(connection, constraint);
} else if ("conditionalEventDefinition".equals(nodeName)) { StateNode stateNode = new StateNode(); stateNode.setId(node.getId()); stateNode.setName(node.getName()); stateNode.setMetaData("UniqueId", node.getMetaData().get("UniqueId")); node = stateNode;
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); }
protected Node createNode() { return new StateNode(); }