List of usage examples for org.dom4j XPath booleanValueOf
boolean booleanValueOf(Object context);
From source file:itensil.workflow.activities.rules.XPathConditionEval.java
License:Open Source License
protected boolean evalCondition(Condition cond, Activity activity) throws EvalException { Document datDoc = getDefaultData(activity); if (cond.getParent().getParent() instanceof Switch) { Switch sw = (Switch) cond.getParent().getParent(); Ruleset rs = sw.selectOneChild(Ruleset.class); // Rule set mode if (rs != null && !Check.isEmpty(rs.getAttribute("src"))) { RulesEvaluator rulEval = (RulesEvaluator) rs.getRuleObj(); if (rulEval == null) { Document rdoc = getRuleDoc(rs.getAttribute("src"), activity); rulEval = new RulesEvaluator(rdoc); rs.setRuleObj(rulEval);/*from ww w . j av a2s. co m*/ } String res; String subRule = rs.getAttribute("rule"); if (Check.isEmpty(subRule)) { res = rulEval.match(datDoc.getRootElement()); } else { res = rulEval.match(subRule, datDoc.getRootElement()); } return res != null && res.equals(cond.getInnerText()); } } XPath xp = getXPath(cond.getInnerText(), datDoc, activity); this.contextNode = datDoc.getRootElement(); return xp.booleanValueOf(this.contextNode); }