/** * Given a [queriable] instance, tells wether this instance satisfies the * query. * This implementation delegates the work to the underlying [real] query. */ public boolean validate (final Object o) throws QueryException { //log.debug("validate() this is \n"+this.toString()); final QueryItem qi = fetch(); //log.debug("validate() fetch returned \n"+qi.toString()); return qi.validate(o); }
public boolean validate (final Object o) throws QueryException { if (getChildren() == null || getChildren().size() < 1) return false; final java.util.Iterator it = getChildren().iterator(); while (it.hasNext()) { final QueryItem qi = (QueryItem)it.next(); if ( ! qi.validate(o)) return false; } return true; }
public boolean validate (final Object o) throws QueryException { if (getChild() == null) return false; return ! getChild().validate(o); }
public boolean validate (final Object o) throws QueryException { //log.debug("validate()"); if (getChildren() == null || getChildren().size() < 1) { //log.debug("validate() no children : returning false"); return false; } final java.util.Iterator it = getChildren().iterator(); while (it.hasNext()) { final QueryItem qi = (QueryItem)it.next(); if (qi.validate(o)) return true; } //log.debug("validate() finally returning false"); return false; }
public static void main (String[] args) throws Exception { // // init query map //ApplicationContext con = new ApplicationContext(); java.util.Map params = new java.util.HashMap(); params.put ("queryConfigurationFile", "tst/query-config.xml"); XmlQueryMap queryMap = new XmlQueryMap(); queryMap.init("queryMap", null, params); QueryItem qi = queryMap.lookupQuery("tst/query-map.xml#Store.querystore#charly"); //log.debug("qi.class is "+qi.getClass().getName()); org.jdom.Element elt = new org.jdom.Element("toto"); elt.setAttribute("participantName", "role-bravo"); log.debug("validate returns "+qi.validate(elt)); }
if (queryItem.validate(item)) results.add(item);