Improve ACR
[lgpl/argeo-commons.git] / org.argeo.api.acr / src / org / argeo / api / acr / search / ContentFilter.java
index 45f2d848c4183754c3935e73bdc77d0c1f5d4590..55ed21531348373a686344374cebdd8252976157 100644 (file)
@@ -74,10 +74,18 @@ public abstract class ContentFilter<COMPOSITION extends Composition> implements
        }
 
        public COMPOSITION eq(QNamed attr, Object value) {
-               addConstraint(new Eq(attr.qName(), value));
+               return eq(attr.qName(), value);
+       }
+
+       public COMPOSITION isDefined(QName attr) {
+               addConstraint(new IsDefined(attr));
                return composition;
        }
 
+       public COMPOSITION isDefined(QNamed attr) {
+               return isDefined(attr.qName());
+       }
+
        /*
         * UTILITIES
         */
@@ -148,6 +156,19 @@ public abstract class ContentFilter<COMPOSITION extends Composition> implements
 
        }
 
+       public static class IsDefined implements Constraint {
+               final QName prop;
+
+               public IsDefined(QName prop) {
+                       super();
+                       this.prop = prop;
+               }
+
+               public QName getProp() {
+                       return prop;
+               }
+       }
+
        public static class IsContentClass implements Constraint {
                final QName[] contentClasses;