1 23 24 package org.apache.slide.search.basic.expression; 25 26 import org.apache.slide.content.NodeProperty.NamespaceCache; 27 import org.apache.slide.search.InvalidQueryException; 28 import org.apache.slide.search.basic.ComparableResource; 29 import org.apache.slide.search.basic.ComparableResourcesPool; 30 import org.apache.slide.search.basic.Literals; 31 import org.jdom.Element; 32 33 38 public abstract class CheckResourceTypeExpression extends ComparePropertyExpression { 39 40 46 public CheckResourceTypeExpression (Element e, ComparableResourcesPool requestedResourcesPool) throws InvalidQueryException { 47 super(e, requestedResourcesPool, new ComparedProperty(Literals.RESOURCETYPE, NamespaceCache.DEFAULT_URI)); 48 } 49 50 58 protected boolean compare (ComparableResource item) { 59 String resourceTypeValue = 60 (String ) item.getThisValue (comparedProperty.getProperty(), 61 comparedProperty.getPropNamespace()); 62 63 int index = resourceTypeValue.indexOf (comparedProperty.getLiteral()); 64 65 return index > -1; 66 } 67 } 68 69 70 71 | Popular Tags |