Refine search
public Object start(final String uri, final String localName, final Attributes attrs, final ExtensibleXmlParser parser) throws SAXException { parser.startElementBuilder(localName, attrs); final Node node = createNode(attrs); String id = attrs.getValue("id"); node.setMetaData("UniqueId", id); final String name = attrs.getValue("name"); node.setName(name); AtomicInteger idGen = (AtomicInteger) parser.getMetaData().get("idGen"); node.setId(idGen.getAndIncrement()); return node; }
protected void handleLinkNode(Element element, Node node, org.w3c.dom.Node xmlLinkNode, ExtensibleXmlParser parser) { node.setName(element.getAttribute("name")); NamedNodeMap linkAttr = xmlLinkNode.getAttributes(); String name = linkAttr.getNamedItem("name").getNodeValue(); String id = element.getAttribute("id"); node.setMetaData("UniqueId", id); node.setMetaData(LINK_NAME, name); org.w3c.dom.Node xmlNode = xmlLinkNode.getFirstChild(); NodeContainer nodeContainer = (NodeContainer) parser.getParent(); String target = xmlNode.getTextContent(); node.setMetaData(LINK_TARGET, target); String source = xmlNode.getTextContent(); ArrayList<String> sources = (ArrayList<String>) node .getMetaData().get(LINK_SOURCE); node.setMetaData(LINK_SOURCE, sources); xmlNode = xmlNode.getNextSibling();
timerNode.setId(node.getId()); timerNode.setName(node.getName()); timerNode.setMetaData("UniqueId", node.getMetaData().get("UniqueId")); node = timerNode; handleTimerNode(node, element, uri, localName, parser); stateNode.setId(node.getId()); stateNode.setName(node.getName()); stateNode.setMetaData("UniqueId", node.getMetaData().get("UniqueId")); node = stateNode; handleStateNode(node, element, uri, localName, parser); } else if ("linkEventDefinition".equals(nodeName)) { CatchLinkNode linkNode = new CatchLinkNode(); linkNode.setId(node.getId()); node = linkNode; handleLinkNode(element, node, xmlNode, parser); break; xmlNode = xmlNode.getNextSibling(); NodeContainer nodeContainer = (NodeContainer) parser.getParent(); nodeContainer.addNode(node); ((ProcessBuildData) parser.getData()).addNode(node);
protected void writeNode(final String name, final Node node, final StringBuilder xmlDump, final boolean includeMeta) { xmlDump.append(" <" + name + " id=\"" + node.getId() + "\" "); if (node.getName() != null) { xmlDump.append("name=\"" + XmlDumper.replaceIllegalChars(node.getName()) + "\" "); } if (includeMeta) { Integer x = (Integer) node.getMetaData().get("x"); Integer y = (Integer) node.getMetaData().get("y"); Integer width = (Integer) node.getMetaData().get("width"); Integer height = (Integer) node.getMetaData().get("height"); Integer color = (Integer) node.getMetaData().get("color"); if (x != null && x != 0) { xmlDump.append("x=\"" + x + "\" "); } if (y != null && y != 0) { xmlDump.append("y=\"" + y + "\" "); } if (width != null && width != -1) { xmlDump.append("width=\"" + width + "\" "); } if (height != null && height != -1) { xmlDump.append("height=\"" + height + "\" "); } if (color != null && color != 0) { xmlDump.append("color=\"" + color + "\" "); } } }
public Object start(final String uri, final String localName, final Attributes attrs, final ExtensibleXmlParser parser) throws SAXException { parser.startElementBuilder( localName, attrs ); NodeContainer nodeContainer = (NodeContainer) parser.getParent(); final Node node = createNode(); final String id = attrs.getValue("id"); node.setId(new Long(id)); final String name = attrs.getValue("name"); node.setName(name); nodeContainer.addNode(node); return node; }
super.handleNode(node, element, uri, localName, parser); ActionNode actionNode = (ActionNode) node; node.setMetaData("NodeType", "ScriptTask"); DroolsConsequenceAction action = (DroolsConsequenceAction) actionNode.getAction(); if (action == null) { actionNode.setAction(action); String language = element.getAttribute("scriptFormat"); if (XmlBPMNProcessDumper.JAVA_LANGUAGE.equals(language)) { action.setDialect(JavaDialect.ID); org.w3c.dom.Node xmlNode = element.getFirstChild(); while (xmlNode != null) { if (xmlNode instanceof Element && "script".equals(xmlNode.getNodeName())) { action.setConsequence(xmlNode.getTextContent()); xmlNode = xmlNode.getNextSibling(); String compensation = element.getAttribute("isForCompensation"); if( compensation != null ) { boolean isForCompensation = Boolean.parseBoolean(compensation);
protected void handleThrowCompensationEventNode(final Node node, final Element element, final String uri, final String localName, final ExtensibleXmlParser parser) { org.w3c.dom.Node xmlNode = element.getFirstChild(); assert node instanceof ActionNode || node instanceof EndNode : "Node is neither an ActionNode nor an EndNode but a " + node.getClass().getSimpleName(); while (xmlNode != null) { if ("compensateEventDefinition".equals(xmlNode.getNodeName())) { String activityRef = ((Element) xmlNode).getAttribute("activityRef"); if (activityRef == null ) { activityRef = ""; node.setMetaData("compensation-activityRef", activityRef); String nodeId = (String) node.getMetaData().get("UniqueId"); String waitForCompletionString = ((Element) xmlNode).getAttribute("waitForCompletion"); boolean waitForCompletion = true; if( waitForCompletionString != null && waitForCompletionString.length() > 0 ) { throw new IllegalArgumentException("Asynchronous compensation [" + nodeId + ", " + node.getName() + "] is not yet supported!"); xmlNode = xmlNode.getNextSibling();
protected void handleNode(final Node node, final Element element, final String uri, final String localName, final ExtensibleXmlParser parser) throws SAXException { final String x = element.getAttribute("x"); if (x != null && x.length() != 0) { try { node.setMetaData("x", Integer.parseInt(x)); } catch (NumberFormatException exc) { throw new SAXParseException("<" + localName + "> requires an Integer 'x' attribute", parser.getLocator()); final String y = element.getAttribute("y"); if (y != null && y.length() != 0) { try { node.setMetaData("y", new Integer(y)); } catch (NumberFormatException exc) { throw new SAXParseException("<" + localName + "> requires an Integer 'y' attribute", parser.getLocator()); final String width = element.getAttribute("width"); if (width != null && width.length() != 0) { try { node.setMetaData("width", new Integer(width)); } catch (NumberFormatException exc) { throw new SAXParseException("<" + localName + "> requires an Integer 'width' attribute", parser.getLocator()); if (height != null && height.length() != 0) { try { node.setMetaData("height", new Integer(height)); } catch (NumberFormatException exc) { throw new SAXParseException("<" + localName + "> requires an Integer 'height' attribute", parser.getLocator());
public Object end(final String uri, final String localName, final ExtensibleXmlParser parser) throws SAXException { final Element element = parser.endElementBuilder(); Node node = (Node) parser.getCurrent(); ProcessBuildData buildData = (ProcessBuildData) parser.getData(); Map<String, PlanItem> planItems = (Map<String, PlanItem>) buildData.getMetaData("PlanItems"); PlanItem planItem = planItems.get(node.getMetaData().get("UniqueId")); if (planItem != null && planItem.getEntryCriterion() != null) { if ("autostart".equalsIgnoreCase(planItem.getEntryCriterion().getExpression())) { node.setMetaData("customAutoStart", "true"); } else { node.setMetaData("customActivationExpression", planItem.getEntryCriterion().getExpression()); node.setMetaData("customActivationFragmentName", node.getName()); } } handleNode(node, element, uri, localName, parser); NodeContainer nodeContainer = (NodeContainer) parser.getParent(); nodeContainer.addNode(node); ((ProcessBuildData) parser.getData()).addNode(node); return node; }
public SubProcessNodeFactory name(String name) { getNode().setName(name); return this; }
public Object getValue() { return node.getMetaData().get(name); } public void setValue(Object value) {
protected NodeFactory(RuleFlowNodeContainerFactory nodeContainerFactory, NodeContainer nodeContainer, long id) { this.nodeContainerFactory = nodeContainerFactory; this.nodeContainer = nodeContainer; this.node = createNode(); this.node.setId(id); }
public void setValue(Object value) { node.setMetaData(name, value); } public DataType getType() {
public void addNode(Node node) { // TODO find a more elegant solution for this // preferrable remove id setting from this class // and delegate to GUI command that drops node if (node.getId() <= 0) { long id = 0; for (Node n: nodeContainer.getNodes()) { if (n.getId() > id) { id = n.getId(); } } ((org.jbpm.workflow.core.Node) node).setId(++id); } nodeContainer.addNode(node); ((org.jbpm.workflow.core.Node) node).setNodeContainer(this); }
protected void writeNode(final String name, final Node node, final StringBuilder xmlDump, int metaDataType) { xmlDump.append(" <" + name + " "); xmlDump.append("id=\"" + XmlBPMNProcessDumper.getUniqueNodeId(node) + "\" "); if (node.getName() != null) { xmlDump.append("name=\"" + XmlBPMNProcessDumper.replaceIllegalCharsAttribute(node.getName()) + "\" "); } if (metaDataType == XmlBPMNProcessDumper.META_DATA_AS_NODE_PROPERTY) { Integer x = (Integer) node.getMetaData().get("x"); Integer y = (Integer) node.getMetaData().get("y"); Integer width = (Integer) node.getMetaData().get("width"); Integer height = (Integer) node.getMetaData().get("height"); if (x != null && x != 0) { xmlDump.append("g:x=\"" + x + "\" "); } if (y != null && y != 0) { xmlDump.append("g:y=\"" + y + "\" "); } if (width != null && width != -1) { xmlDump.append("g:width=\"" + width + "\" "); } if (height != null && height != -1) { xmlDump.append("g:height=\"" + height + "\" "); } } }
@Test public void testAddErrorMessage() throws Exception { when(node.getName()).thenReturn("nodeName"); when(node.getId()).thenReturn(Long.MAX_VALUE); validator.addErrorMessage(process, node, errors, "any message"); assertEquals(1, errors.size()); assertEquals("Node 'nodeName' [" + Long.MAX_VALUE + "] any message", errors.get(0).getMessage()); }
private String createSplitRule(Process process, Connection connection, String constraint) { return "rule \"RuleFlow-Split-" + process.getId() + "-" + ((org.jbpm.workflow.core.Node) connection.getFrom()).getUniqueId() + "-" + ((org.jbpm.workflow.core.Node) connection.getTo()).getUniqueId() + "-" + connection.getToType() + "\" @Propagation(EAGER) \n" + " ruleflow-group \"DROOLS_SYSTEM\" \n" + " when \n" + " " + constraint + "\n" + " then \n" + "end \n\n"; }
public boolean addNode(Node node) { onNode(node); return( this.nodes.put( node.getId(), node ) != null ); }
protected void handleLinkNode(Element element, Node node, org.w3c.dom.Node xmlLinkNode, ExtensibleXmlParser parser) { NodeContainer nodeContainer = (NodeContainer) parser.getParent(); node.setName(element.getAttribute("name")); NamedNodeMap linkAttr = xmlLinkNode.getAttributes(); String name = linkAttr.getNamedItem("name").getNodeValue(); String id = element.getAttribute("id"); node.setMetaData("UniqueId", id); node.setMetaData(LINK_NAME, name); org.w3c.dom.Node xmlNode = xmlLinkNode.getFirstChild(); if ("target".equals(nodeName)) { String target = xmlNode.getTextContent(); node.setMetaData("target", target); aLink.setTarget(target); String source = xmlNode.getTextContent(); node.setMetaData("source", source); aLink.addSource(source);