jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject svn commit: r774303 - in /jackrabbit/trunk: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/ jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/
Date Wed, 13 May 2009 12:50:28 GMT
Author: stefan
Date: Wed May 13 12:50:27 2009
New Revision: 774303

URL: http://svn.apache.org/viewvc?rev=774303&view=rev
Log:
JCR-1591: JSR 283: NodeType Management
JCR-2091: Searchability settings in PropertyDefinition

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeDef.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeDefinitionImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/PropDef.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/PropDefImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/PropertyDefinitionImpl.java
    jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/NodeTypeTemplateImpl.java
    jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/PropertyDefinitionTemplateImpl.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeDef.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeDef.java?rev=774303&r1=774302&r2=774303&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeDef.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeDef.java
Wed May 13 12:50:27 2009
@@ -43,6 +43,7 @@
 
     private boolean mixin;
     private boolean orderableChildNodes;
+    private boolean queryable;
 
     private boolean abstractStatus;
     private Name primaryItemName;
@@ -64,6 +65,7 @@
         mixin = false;
         orderableChildNodes = false;
         abstractStatus = false;
+        queryable = true;
     }
 
     /**
@@ -181,6 +183,15 @@
     }
 
     /**
+     * Sets the 'queryable' flag.
+     *
+     * @param queryable flag
+     */
+    public void setQueryable(boolean queryable) {
+        this.queryable = queryable;
+    }
+
+    /**
      * Sets the name of the primary item (one of the child items of the node's
      * of this node type)
      *
@@ -269,6 +280,15 @@
     }
 
     /**
+     * Returns the value of the 'queryable' flag.
+     *
+     * @return true if this node type is queryable; false otherwise.
+     */
+    public boolean isQueryable() {
+        return queryable;
+    }
+
+    /**
      * Returns the name of the primary item (one of the child items of the
      * node's of this node type) or <code>null</code> if not set.
      *
@@ -315,6 +335,7 @@
         clone.mixin = mixin;
         clone.orderableChildNodes = orderableChildNodes;
         clone.abstractStatus = abstractStatus;
+        clone.queryable = queryable;
         clone.nodeDefs = (HashSet) nodeDefs.clone();
         clone.propDefs = (HashSet) propDefs.clone();
         return clone;
@@ -332,6 +353,7 @@
                     && mixin == other.mixin
                     && orderableChildNodes == other.orderableChildNodes
                     && abstractStatus == other.abstractStatus
+                    && queryable == other.queryable
                     && propDefs.equals(other.propDefs)
                     && nodeDefs.equals(other.nodeDefs);
         }

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeDefinitionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeDefinitionImpl.java?rev=774303&r1=774302&r2=774303&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeDefinitionImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeDefinitionImpl.java
Wed May 13 12:50:27 2009
@@ -110,17 +110,30 @@
     }
 
     /**
+     * Returns <code>true</code> if the node type is queryable, meaning that
+     * the available-query-operators, full-text-searchable
+     * and query-orderable attributes of its property definitions take effect. See
+     * {@link javax.jcr.nodetype.PropertyDefinition#getAvailableQueryOperators()},
+     * {@link javax.jcr.nodetype.PropertyDefinition#isFullTextSearchable()} and
+     * {@link javax.jcr.nodetype.PropertyDefinition#isQueryOrderable()}.
+     * <p>
+     * If a node type is declared non-queryable then these attributes of its property
+     * definitions have no effect.
+     *
+     * @since JCR 2.0
+     * @return a <code>boolean</code>
+     */
+    public boolean isQueryable() {
+        return ntd.isQueryable();
+    }
+
+    /**
      * {@inheritDoc}
      */
     public boolean isMixin() {
         return ntd.isMixin();
     }
 
-    public boolean isQueryable() {
-        // TODO 
-        throw new RuntimeException("Not implemented yet, see JCR-1591");
-    }
-
     /**
      * {@inheritDoc}
      */

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeImpl.java?rev=774303&r1=774302&r2=774303&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeImpl.java
Wed May 13 12:50:27 2009
@@ -298,8 +298,7 @@
     }
 
     public boolean isQueryable() {
-        // TODO 
-        throw new RuntimeException("Not implemented yet, see JCR-1591");
+        return ntd.isQueryable();
     }
 
     /**

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/PropDef.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/PropDef.java?rev=774303&r1=774302&r2=774303&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/PropDef.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/PropDef.java
Wed May 13 12:50:27 2009
@@ -63,4 +63,26 @@
      * @return the 'multiple' flag.
      */
     boolean isMultiple();
+
+    /**
+     * Returns the array of available query operators.
+     *
+     * @return the array of query operators.
+     */
+    String[] getAvailableQueryOperators();
+
+    /**
+     * Reports whether this property is full-text searchable.
+     *
+     * @return the 'fullTextSearchable' flag.
+     */
+    boolean isFullTextSearchable();
+
+    /**
+     * Reports whether this property is query-orderable.
+     *
+     * @return the 'queryOrderable' flag.
+     */
+    boolean isQueryOrderable();
+
 }

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/PropDefImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/PropDefImpl.java?rev=774303&r1=774302&r2=774303&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/PropDefImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/PropDefImpl.java
Wed May 13 12:50:27 2009
@@ -20,6 +20,7 @@
 import org.apache.jackrabbit.spi.Name;
 
 import javax.jcr.PropertyType;
+import javax.jcr.query.qom.QueryObjectModelConstants;
 import java.util.Arrays;
 
 /**
@@ -55,6 +56,30 @@
      */
     private PropDefId id = null;
 
+    /*
+     * The 'fulltext searchable' flag.
+     */
+    private boolean fullTextSearchable = true;
+
+    /*
+     * The 'query orderable' flag.
+     */
+    private boolean queryOrderable = true;
+
+    /*
+     * The 'query operators.
+     */
+    private String[] queryOperators = new String[]{
+            QueryObjectModelConstants.JCR_OPERATOR_EQUAL_TO,
+            QueryObjectModelConstants.JCR_OPERATOR_GREATER_THAN,
+            QueryObjectModelConstants.JCR_OPERATOR_GREATER_THAN_OR_EQUAL_TO,
+            QueryObjectModelConstants.JCR_OPERATOR_LESS_THAN,
+            QueryObjectModelConstants.JCR_OPERATOR_LESS_THAN_OR_EQUAL_TO,
+            QueryObjectModelConstants.JCR_OPERATOR_LIKE,
+            QueryObjectModelConstants.JCR_OPERATOR_NOT_EQUAL_TO
+    };
+
+
     /**
      * Default constructor.
      */
@@ -113,6 +138,43 @@
         this.multiple = multiple;
     }
 
+    /**
+     * Sets the 'fulltext searchable' flag.
+     *
+     * @param fullTextSearchable
+     */
+    public void setFullTextSearchable(boolean fullTextSearchable) {
+        // reset id field in order to force lazy recomputation of identifier
+        id = null;
+        this.fullTextSearchable = fullTextSearchable;
+    }
+
+    /**
+     * Sets the 'fulltext searchable' flag.
+     *
+     * @param queryOrderable
+     */
+    public void setQueryOrderable(boolean queryOrderable) {
+        // reset id field in order to force lazy recomputation of identifier
+        id = null;
+        this.queryOrderable = queryOrderable;
+    }
+
+    /**
+     * Sets the 'available' query operators.
+     *
+     * @param queryOperators
+     */
+    public void setAvailableQueryOperators(String[] queryOperators) {
+        // reset id field in order to force lazy recomputation of identifier
+        id = null;
+        if (queryOperators != null) {
+            this.queryOperators = queryOperators;
+        } else {
+            this.queryOperators = new String[0];
+        }
+    }
+
     //------------------------------------------------< ItemDefImpl overrides >
     /**
      * {@inheritDoc}
@@ -221,6 +283,27 @@
         return false;
     }
 
+    /**
+     * {@inheritDoc}
+     */
+    public String[] getAvailableQueryOperators() {
+        return queryOperators;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isFullTextSearchable() {
+        return fullTextSearchable;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isQueryOrderable() {
+        return queryOrderable;
+    }
+
     //-------------------------------------------< java.lang.Object overrides >
     /**
      * Compares two property definitions for equality. Returns <code>true</code>
@@ -242,7 +325,10 @@
                     && requiredType == other.requiredType
                     && Arrays.equals(valueConstraints, other.valueConstraints)
                     && Arrays.equals(defaultValues, other.defaultValues)
-                    && multiple == other.multiple;
+                    && multiple == other.multiple
+                    && Arrays.equals(queryOperators, other.queryOperators)
+                    && queryOrderable == other.queryOrderable
+                    && fullTextSearchable == other.fullTextSearchable;
         }
         return false;
     }

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/PropertyDefinitionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/PropertyDefinitionImpl.java?rev=774303&r1=774302&r2=774303&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/PropertyDefinitionImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/PropertyDefinitionImpl.java
Wed May 13 12:50:27 2009
@@ -23,7 +23,6 @@
 
 import org.apache.jackrabbit.core.value.InternalValue;
 import org.apache.jackrabbit.spi.commons.conversion.NamePathResolver;
-import org.apache.jackrabbit.spi.commons.query.qom.Operator;
 import org.apache.jackrabbit.spi.commons.value.ValueFormat;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -121,17 +120,24 @@
         return ((PropDef) itemDef).isMultiple();
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public String[] getAvailableQueryOperators() {
-        // TODO: JCR-2091
-        return Operator.getAllQueryOperators();
+        return ((PropDef) itemDef).getAvailableQueryOperators();
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean isFullTextSearchable() {
-        return true; // TODO: JCR-2091
+        return ((PropDef) itemDef).isFullTextSearchable();
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean isQueryOrderable() {
-        return true; // TODO: JCR-2091
+        return ((PropDef) itemDef).isQueryOrderable();
     }
-
 }

Modified: jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/NodeTypeTemplateImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/NodeTypeTemplateImpl.java?rev=774303&r1=774302&r2=774303&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/NodeTypeTemplateImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/NodeTypeTemplateImpl.java
Wed May 13 12:50:27 2009
@@ -37,6 +37,7 @@
     private String[] superTypeNames;
     private String primaryItemName;
     private boolean abstractStatus;
+    private boolean queryable;
     private boolean mixin;
     private boolean orderableChildNodes;
     private List nodeDefinitionTemplates;
@@ -46,6 +47,7 @@
      * Package private constructor
      */
     NodeTypeTemplateImpl() {
+        queryable = true;
     }
 
     /**
@@ -59,6 +61,7 @@
         primaryItemName = def.getPrimaryItemName();
         abstractStatus = def.isAbstract();
         mixin = def.isMixin();
+        queryable = def.isQueryable();
         orderableChildNodes = def.hasOrderableChildNodes();
         NodeDefinition[] nodeDefs = def.getDeclaredChildNodeDefinitions();
         if (nodeDefs != null) {
@@ -145,8 +148,7 @@
      * {@inheritDoc}
      */
     public void setQueryable(boolean queryable) {
-        // TODO
-        throw new RuntimeException("Not implemented yet, see JCR-1591");
+        this.queryable = queryable;
     }
 
     //---------------------------------------------------< NodeTypeDefinition >
@@ -179,8 +181,7 @@
     }
 
     public boolean isQueryable() {
-        // TODO 
-        throw new RuntimeException("Not implemented yet, see JCR-1591");
+        return queryable;
     }
 
     /**

Modified: jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/PropertyDefinitionTemplateImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/PropertyDefinitionTemplateImpl.java?rev=774303&r1=774302&r2=774303&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/PropertyDefinitionTemplateImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/PropertyDefinitionTemplateImpl.java
Wed May 13 12:50:27 2009
@@ -18,6 +18,7 @@
 
 import javax.jcr.PropertyType;
 import javax.jcr.Value;
+import javax.jcr.query.qom.QueryObjectModelConstants;
 import javax.jcr.nodetype.PropertyDefinition;
 import javax.jcr.nodetype.PropertyDefinitionTemplate;
 
@@ -32,12 +33,26 @@
     private String[] constraints;
     private Value[] defaultValues;
     private boolean multiple;
+    private boolean fullTextSearchable;
+    private boolean queryOrderable;
+    private String[] queryOperators;
 
     /**
      * Package private constructor
      */
     PropertyDefinitionTemplateImpl() {
         type = PropertyType.STRING;
+        fullTextSearchable = true;
+        queryOrderable = true;
+        queryOperators = new String[]{
+                QueryObjectModelConstants.JCR_OPERATOR_EQUAL_TO,
+                QueryObjectModelConstants.JCR_OPERATOR_GREATER_THAN,
+                QueryObjectModelConstants.JCR_OPERATOR_GREATER_THAN_OR_EQUAL_TO,
+                QueryObjectModelConstants.JCR_OPERATOR_LESS_THAN,
+                QueryObjectModelConstants.JCR_OPERATOR_LESS_THAN_OR_EQUAL_TO,
+                QueryObjectModelConstants.JCR_OPERATOR_LIKE,
+                QueryObjectModelConstants.JCR_OPERATOR_NOT_EQUAL_TO
+        };
     }
 
     /**
@@ -51,6 +66,9 @@
         constraints = def.getValueConstraints();
         defaultValues = def.getDefaultValues();
         multiple = def.isMultiple();
+        fullTextSearchable = def.isFullTextSearchable();
+        queryOrderable = def.isQueryOrderable();
+        queryOperators = def.getAvailableQueryOperators();
     }
 
     //-------------------------------------------< PropertyDefinitionTemplate >
@@ -86,24 +104,21 @@
      * {@inheritDoc}
      */
     public void setAvailablrQueryOperators(String[] operators) {
-        // TODO
-        throw new UnsupportedOperationException("Not implemented yet, see JCR-1591");
+        queryOperators = operators;
     }
 
     /**
      * {@inheritDoc}
      */
     public void setFullTextSearchable(boolean searchable) {
-        // TODO
-        throw new UnsupportedOperationException("Not implemented yet, see JCR-1591");
+        fullTextSearchable = searchable;
     }
 
     /**
      * {@inheritDoc}
      */
     public void setQueryOrderable(boolean orderable) {
-        // TODO
-        throw new UnsupportedOperationException("Not implemented yet, see JCR-1591");
+        queryOrderable = orderable;
     }
 
     //---------------------------------------------------< PropertyDefinition >
@@ -139,23 +154,20 @@
      * {@inheritDoc}
      */
     public String[] getAvailableQueryOperators() {
-        // TODO
-        throw new UnsupportedOperationException("Not implemented yet, see JCR-1591");
+        return queryOperators;
     }
 
     /**
      * {@inheritDoc}
      */
     public boolean isFullTextSearchable() {
-        // TODO
-        throw new UnsupportedOperationException("Not implemented yet, see JCR-1591");
+        return fullTextSearchable;
     }
 
     /**
      * {@inheritDoc}
      */
     public boolean isQueryOrderable() {
-        // TODO
-        throw new UnsupportedOperationException("Not implemented yet, see JCR-1591");
+        return queryOrderable;
     }
 }



Mime
View raw message