Here you can find the source of hasActivityChildNodeWithCreateInstanceSet(Node node)
public static boolean hasActivityChildNodeWithCreateInstanceSet(Node node)
//package com.java2s; //License from project: Open Source License import java.util.Collection; import java.util.HashSet; import org.w3c.dom.Node; import org.w3c.dom.Text; public class Main { public static final Collection<String> BPEL_ACTIVITIES = new HashSet<String>() { private static final long serialVersionUID = -1626491688586809929L; {/*from w w w . j av a 2s.c o m*/ add("invoke"); add("receive"); add("reply"); add("wait"); add("exit"); add("empty"); add("throw"); add("rethrow"); add("validate"); add("assign"); add("compensate"); add("compensatescope"); add("pick"); add("onmessage"); add("onalarm"); add("sequence"); add("while"); add("repeatuntil"); add("foreach"); add("flow"); add("scope"); } }; public static boolean hasActivityChildNodeWithCreateInstanceSet(Node node) { boolean result = false; for (Node child : getAllActivityChildNodesRecursively(node)) { if (isCreateInstanceSet(child)) result = true; } return result; } /** * Get all child nodes that represent BPEL activities. This function * recursively iterates over all child nodes of the given node. * * @param node * @return */ public static Collection<Node> getAllActivityChildNodesRecursively(Node node) { Collection<Node> returnNodes = new HashSet<Node>(); if (node == null) return returnNodes; for (Node child = node.getFirstChild(); child != null; child = child.getNextSibling()) { if (!(child instanceof Text)) { if (BPEL_ACTIVITIES.contains(child.getNodeName())) { returnNodes.add(child); returnNodes.addAll(getAllActivityChildNodesRecursively(child)); } } } return returnNodes; } /** * Checks whether the optional attribute createInstance is set for * a specific node. That relates to receive and pick activities. * * @param node * @return whether the attribute createInstance is set */ public static boolean isCreateInstanceSet(Node node) { boolean createInstance = false; if (node.getAttributes().getNamedItem("createInstance") != null) { if (node.getAttributes().getNamedItem("createInstance").getNodeValue().equalsIgnoreCase("yes")) createInstance = true; } return createInstance; } }