protected void handleScript(final ExtendedNodeImpl node, final Element element, String type) { NodeList nodeList = element.getChildNodes(); for (int i = 0; i < nodeList.getLength(); i++) { if (nodeList.item(i) instanceof Element) { Element xmlNode = (Element) nodeList.item(i); String nodeName = xmlNode.getNodeName(); if (nodeName.equals("extensionElements")) { NodeList subNodeList = xmlNode.getChildNodes(); for (int j = 0; j < subNodeList.getLength(); j++) { org.w3c.dom.Node subXmlNode = subNodeList.item(j); if(subXmlNode.getNodeName().contains(type + "-script")) { List<DroolsAction> actions = node.getActions(type); if (actions == null) { actions = new ArrayList<DroolsAction>(); node.setActions(type, actions); } DroolsAction action = extractScript((Element) subXmlNode); actions.add(action); } } } } } }
protected void handleIntermediateOrEndThrowCompensationEvent(ExtendedNodeImpl throwEventNode) { if (throwEventNode.getMetaData("compensation-activityRef") != null) { String activityRef = (String) throwEventNode.getMetaData().remove("compensation-activityRef"); NodeContainer nodeParent = (NodeContainer) throwEventNode.getNodeContainer(); if (nodeParent instanceof EventSubProcessNode) { boolean compensationEventSubProcess = false;
protected boolean containsExtensionElements(Node node) { if (!getMetaData(node).isEmpty()) { return true; } if (node instanceof ExtendedNodeImpl && ((ExtendedNodeImpl) node).containsActions()) { return true; } return false; }
public void build(Process process, ProcessDescr processDescr, ProcessBuildContext context, Node node) { ExtendedNodeImpl extendedNode = ( ExtendedNodeImpl ) node; for (String type: extendedNode.getActionTypes()) { List<DroolsAction> actions = extendedNode.getActions(type); if (actions != null) { for (DroolsAction droolsAction: actions) { buildAction(droolsAction, context, (NodeImpl) node); } } } }
protected void writeExtensionElements(Node node, final StringBuilder xmlDump) { if (containsExtensionElements(node)) { xmlDump.append(" <extensionElements>" + EOL); if (node instanceof ExtendedNodeImpl) { writeScripts("onEntry", ((ExtendedNodeImpl) node).getActions("onEntry"), xmlDump); writeScripts("onExit", ((ExtendedNodeImpl) node).getActions("onExit"), xmlDump); } writeMetaData(node, xmlDump); xmlDump.append(" </extensionElements>" + EOL); } }
public void validateAddIncomingConnection(final String type, final Connection connection) { super.validateAddIncomingConnection(type, connection); if (!org.jbpm.workflow.core.Node.CONNECTION_DEFAULT_TYPE.equals(type)) { throw new IllegalArgumentException( "This type of node [" + connection.getTo().getMetaData().get("UniqueId") + ", " + connection.getTo().getName() + "] only accepts default incoming connection type!"); } if (getFrom() != null && !"true".equals(System.getProperty("jbpm.enable.multi.con"))) { throw new IllegalArgumentException( "This type of node [" + connection.getTo().getMetaData().get("UniqueId") + ", " + connection.getTo().getName() + "] cannot have more than one incoming connection!"); } }
public void validateAddOutgoingConnection(final String type, final Connection connection) { super.validateAddOutgoingConnection(type, connection); if (!org.jbpm.workflow.core.Node.CONNECTION_DEFAULT_TYPE.equals(type)) { throw new IllegalArgumentException( "A start node [" + this.getMetaData("UniqueId") + ", " + this.getName() + "] only accepts default outgoing connection type!"); } if (getTo() != null && !"true".equals(System.getProperty("jbpm.enable.multi.con"))) { throw new IllegalArgumentException( "A start node [" + this.getMetaData("UniqueId") + ", " + this.getName() + "] cannot have more than one outgoing connection!"); } }
protected void handleAction(final ExtendedNodeImpl node, final Element element, String type) { NodeList nodeList = element.getChildNodes(); for (int i = 0; i < nodeList.getLength(); i++) { org.w3c.dom.Node xmlNode = nodeList.item(i); String nodeName = xmlNode.getNodeName(); if (nodeName.equals(type)) { List<DroolsAction> actions = new ArrayList<DroolsAction>(); NodeList subNodeList = xmlNode.getChildNodes(); for (int j = 0; j < subNodeList.getLength(); j++) { Element subXmlNode = (Element) subNodeList.item(j); DroolsAction action = extractAction(subXmlNode); actions.add(action); } node.setActions(type, actions); return; } } }
protected void triggerEvent(String type) { ExtendedNodeImpl extendedNode = getExtendedNode(); if (extendedNode == null) { return; } List<DroolsAction> actions = extendedNode.getActions(type); if (actions != null) { for (DroolsAction droolsAction: actions) { Action action = (Action) droolsAction.getMetaData("Action"); executeAction(action); } } }
public void build(Process process, ProcessDescr processDescr, ProcessBuildContext context, Node node) { ExtendedNodeImpl extendedNode = ( ExtendedNodeImpl ) node; for (String type: extendedNode.getActionTypes()) { List<DroolsAction> actions = extendedNode.getActions(type); if (actions != null) { for (DroolsAction droolsAction: actions) { buildAction(droolsAction, context, (NodeImpl) node); } } } }
public void validateAddIncomingConnection(final String type, final Connection connection) { super.validateAddIncomingConnection(type, connection); if (!org.jbpm.workflow.core.Node.CONNECTION_DEFAULT_TYPE.equals(type)) { throw new IllegalArgumentException( "This type of node [" + connection.getTo().getMetaData().get("UniqueId") + ", " + connection.getTo().getName() + "] only accepts default incoming connection type!"); } if (getFrom() != null && !"true".equals(System.getProperty("jbpm.enable.multi.con"))) { throw new IllegalArgumentException( "This type of node [" + connection.getTo().getMetaData().get("UniqueId") + ", " + connection.getTo().getName() + "] cannot have more than one incoming connection!"); } }
public void validateAddOutgoingConnection(final String type, final Connection connection) { super.validateAddOutgoingConnection(type, connection); if (!org.jbpm.workflow.core.Node.CONNECTION_DEFAULT_TYPE.equals(type)) { throw new IllegalArgumentException( "This type of node [" + connection.getFrom().getMetaData().get("UniqueId") + ", " + connection.getFrom().getName() + "] only accepts default outgoing connection type!"); } if (getTo() != null && !"true".equals(System.getProperty("jbpm.enable.multi.con"))) { throw new IllegalArgumentException( "This type of node [" + connection.getFrom().getMetaData().get("UniqueId") + ", " + connection.getFrom().getName() + "] cannot have more than one outgoing connection!"); } }
protected void handleAction(final ExtendedNodeImpl node, final Element element, String type) { NodeList nodeList = element.getChildNodes(); for (int i = 0; i < nodeList.getLength(); i++) { org.w3c.dom.Node xmlNode = nodeList.item(i); String nodeName = xmlNode.getNodeName(); if (nodeName.equals(type)) { List<DroolsAction> actions = new ArrayList<DroolsAction>(); NodeList subNodeList = xmlNode.getChildNodes(); for (int j = 0; j < subNodeList.getLength(); j++) { Element subXmlNode = (Element) subNodeList.item(j); DroolsAction action = extractAction(subXmlNode); actions.add(action); } node.setActions(type, actions); return; } } }
protected void handleIntermediateOrEndThrowCompensationEvent(ExtendedNodeImpl throwEventNode ) { if( throwEventNode.getMetaData("compensation-activityRef") != null ) { String activityRef = (String) throwEventNode.getMetaData().remove("compensation-activityRef"); NodeContainer nodeParent = (NodeContainer) throwEventNode.getNodeContainer(); if( nodeParent instanceof EventSubProcessNode ) { boolean compensationEventSubProcess = false;
protected void handleScript(final ExtendedNodeImpl node, final Element element, String type) { NodeList nodeList = element.getChildNodes(); for (int i = 0; i < nodeList.getLength(); i++) { if (nodeList.item(i) instanceof Element) { Element xmlNode = (Element) nodeList.item(i); String nodeName = xmlNode.getNodeName(); if (nodeName.equals("extensionElements")) { NodeList subNodeList = xmlNode.getChildNodes(); for (int j = 0; j < subNodeList.getLength(); j++) { org.w3c.dom.Node subXmlNode = subNodeList.item(j); if(subXmlNode.getNodeName().contains(type + "-script")) { List<DroolsAction> actions = node.getActions(type); if (actions == null) { actions = new ArrayList<DroolsAction>(); node.setActions(type, actions); } DroolsAction action = extractScript((Element) subXmlNode); actions.add(action); } } } } } }
protected void writeExtensionElements(Node node, final StringBuilder xmlDump) { if (containsExtensionElements(node)) { xmlDump.append(" <extensionElements>" + EOL); if (node instanceof ExtendedNodeImpl) { writeScripts("onEntry", ((ExtendedNodeImpl) node).getActions("onEntry"), xmlDump); writeScripts("onExit", ((ExtendedNodeImpl) node).getActions("onExit"), xmlDump); } writeMetaData(node, xmlDump); xmlDump.append(" </extensionElements>" + EOL); } }
public void validateAddIncomingConnection(final String type, final Connection connection) { super.validateAddIncomingConnection(type, connection); if (!org.jbpm.workflow.core.Node.CONNECTION_DEFAULT_TYPE.equals(type)) { throw new IllegalArgumentException( "This type of node [" + connection.getTo().getMetaData().get("UniqueId") + ", " + connection.getTo().getName() + "] only accepts default incoming connection type!"); } if (getFrom() != null && !"true".equals(System.getProperty("jbpm.enable.multi.con"))) { throw new IllegalArgumentException( "This type of node [" + connection.getTo().getMetaData().get("UniqueId") + ", " + connection.getTo().getName() + "] cannot have more than one incoming connection!"); } }
public void validateAddOutgoingConnection(final String type, final Connection connection) { super.validateAddOutgoingConnection(type, connection); if (!org.jbpm.workflow.core.Node.CONNECTION_DEFAULT_TYPE.equals(type)) { throw new IllegalArgumentException( "This type of node [" + connection.getFrom().getMetaData().get("UniqueId") + ", " + connection.getFrom().getName() + "] only accepts default outgoing connection type!"); } if (getTo() != null && !"true".equals(System.getProperty("jbpm.enable.multi.con"))) { throw new IllegalArgumentException( "This type of node [" + connection.getFrom().getMetaData().get("UniqueId") + ", " + connection.getFrom().getName() + "] cannot have more than one outgoing connection!"); } }
protected boolean containsExtensionElements(Node node) { if (!getMetaData(node).isEmpty()) { return true; } if (node instanceof ExtendedNodeImpl && ((ExtendedNodeImpl) node).containsActions()) { return true; } return false; }
protected void handleIntermediateOrEndThrowCompensationEvent(ExtendedNodeImpl throwEventNode) { if (throwEventNode.getMetaData("compensation-activityRef") != null) { String activityRef = (String) throwEventNode.getMetaData().remove("compensation-activityRef"); NodeContainer nodeParent = (NodeContainer) throwEventNode.getNodeContainer(); if (nodeParent instanceof EventSubProcessNode) { boolean compensationEventSubProcess = false;