You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by st...@apache.org on 2006/01/27 12:12:47 UTC

svn commit: r372816 - in /incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core: ItemImpl.java nodetype/EffectiveNodeType.java nodetype/NodeTypeImpl.java

Author: stefan
Date: Fri Jan 27 03:12:33 2006
New Revision: 372816

URL: http://svn.apache.org/viewcvs?rev=372816&view=rev
Log:
- removed redundant methods
- some javadoc improvements/fixes

Modified:
    incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/ItemImpl.java
    incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/nodetype/EffectiveNodeType.java
    incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeImpl.java

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/ItemImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/ItemImpl.java?rev=372816&r1=372815&r2=372816&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/ItemImpl.java (original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/ItemImpl.java Fri Jan 27 03:12:33 2006
@@ -576,7 +576,8 @@
                     if (constraints != null) {
                         InternalValue[] values = propState.getValues();
                         try {
-                            NodeTypeImpl.checkSetPropertyValueConstraints(def, values);
+                            EffectiveNodeType.checkSetPropertyValueConstraints(
+                                    def.unwrap(), values);
                         } catch (RepositoryException e) {
                             // repack exception for providing verboser error message
                             String msg = prop.safeGetJCRPath() + ": " + e.getMessage();

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/nodetype/EffectiveNodeType.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/nodetype/EffectiveNodeType.java?rev=372816&r1=372815&r2=372816&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/nodetype/EffectiveNodeType.java (original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/nodetype/EffectiveNodeType.java Fri Jan 27 03:12:33 2006
@@ -580,9 +580,12 @@
      * type conversions are attempted if the type of the given values does not
      * match the required type as specified in the given definition.
      *
-     * @param pd
-     * @param values
-     * @throws ConstraintViolationException
+     * @param pd     The definiton of the property
+     * @param values An array of <code>InternalValue</code> objects.
+     * @throws ConstraintViolationException if the value constraints defined in
+     *                                      the property definition are satisfied
+     *                                      by the the specified values
+     * @throws RepositoryException          if another error occurs
      */
     public static void checkSetPropertyValueConstraints(PropDef pd,
                                                         InternalValue[] values)
@@ -655,7 +658,8 @@
 
     /**
      * Returns the applicable child node definition for a child node with the
-     * specified name and node type.
+     * specified name and node type. If there are multiple applicable definitions
+     * named definitions will take precedence over residual definitions.
      *
      * @param name
      * @param nodeTypeName
@@ -728,8 +732,8 @@
 
     /**
      * Returns the applicable property definition for a property with the
-     * specified name, type and multiValued characteristic. If there more than
-     * one applicable definitions then the following rules are applied:
+     * specified name, type and multiValued characteristic. If there are
+     * multiple applicable definitions the following rules will be applied:
      * <ul>
      * <li>named definitions are preferred to residual definitions</li>
      * <li>definitions with specific required type are preferred to definitions

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeImpl.java?rev=372816&r1=372815&r2=372816&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeImpl.java (original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeImpl.java Fri Jan 27 03:12:33 2006
@@ -77,56 +77,6 @@
     }
 
     /**
-     * Returns the applicable child node definition for a child node with the
-     * specified name.
-     *
-     * @param nodeName
-     * @return
-     * @throws RepositoryException if no applicable child node definition
-     *                             could be found
-     */
-    public NodeDefinitionImpl getApplicableChildNodeDefinition(QName nodeName)
-            throws RepositoryException {
-        return getApplicableChildNodeDefinition(nodeName, null);
-    }
-
-    /**
-     * Returns the applicable child node definition for a child node with the
-     * specified name and node type.
-     *
-     * @param nodeName
-     * @param nodeTypeName
-     * @return
-     * @throws RepositoryException if no applicable child node definition
-     *                             could be found
-     */
-    public NodeDefinitionImpl getApplicableChildNodeDefinition(QName nodeName,
-                                                               QName nodeTypeName)
-            throws RepositoryException {
-        return ntMgr.getNodeDefinition(
-                ent.getApplicableChildNodeDef(nodeName, nodeTypeName).getId());
-    }
-
-    /**
-     * Returns the applicable property definition for a property with the
-     * specified name and type.
-     *
-     * @param propertyName
-     * @param type
-     * @param multiValued
-     * @return
-     * @throws RepositoryException if no applicable property definition
-     *                             could be found
-     */
-    public PropertyDefinitionImpl getApplicablePropertyDefinition(QName propertyName,
-                                                                  int type,
-                                                                  boolean multiValued)
-            throws RepositoryException {
-        return ntMgr.getPropertyDefinition(
-                ent.getApplicablePropertyDef(propertyName, type, multiValued).getId());
-    }
-
-    /**
      * Checks if this node type is directly or indirectly derived from the
      * specified node type.
      *
@@ -227,25 +177,6 @@
     }
 
     /**
-     * Tests if the value constraints defined in the property definition
-     * <code>def</code> are satisfied by the the specified <code>values</code>.
-     * <p/>
-     * Note that the <i>protected</i> flag is not checked. Also note that no
-     * type conversions are attempted if the type of the given values does not
-     * match the required type as specified in the given definition.
-     *
-     * @param def    The definiton of the property
-     * @param values An array of <code>InternalValue</code> objects.
-     * @throws ConstraintViolationException
-     * @throws RepositoryException
-     */
-    public static void checkSetPropertyValueConstraints(PropertyDefinitionImpl def,
-                                                        InternalValue[] values)
-            throws ConstraintViolationException, RepositoryException {
-        EffectiveNodeType.checkSetPropertyValueConstraints(def.unwrap(), values);
-    }
-
-    /**
      * Returns the 'internal', i.e. the fully qualified name.
      *
      * @return the qualified name
@@ -433,13 +364,13 @@
         }
         try {
             QName name = QName.fromJCRName(propertyName, nsResolver);
-            PropertyDefinitionImpl def;
+            PropDef def;
             try {
                 // try to get definition that matches the given value type
-                def = getApplicablePropertyDefinition(name, value.getType(), false);
+                def = ent.getApplicablePropertyDef(name, value.getType(), false);
             } catch (ConstraintViolationException cve) {
                 // fallback: ignore type
-                def = getApplicablePropertyDefinition(name, PropertyType.UNDEFINED, false);
+                def = ent.getApplicablePropertyDef(name, PropertyType.UNDEFINED, false);
             }
             if (def.isProtected()) {
                 return false;
@@ -460,7 +391,8 @@
             // type conversion as necessary
             InternalValue internalValue = InternalValue.create(value, targetType,
                     nsResolver);
-            checkSetPropertyValueConstraints(def, new InternalValue[]{internalValue});
+            EffectiveNodeType.checkSetPropertyValueConstraints(
+                    def, new InternalValue[]{internalValue});
             return true;
         } catch (BaseException be) {
             // implementation specific exception, fall through
@@ -494,13 +426,13 @@
                     return false;
                 }
             }
-            PropertyDefinitionImpl def;
+            PropDef def;
             try {
                 // try to get definition that matches the given value type
-                def = getApplicablePropertyDefinition(name, type, true);
+                def = ent.getApplicablePropertyDef(name, type, true);
             } catch (ConstraintViolationException cve) {
                 // fallback: ignore type
-                def = getApplicablePropertyDefinition(name, PropertyType.UNDEFINED, true);
+                def = ent.getApplicablePropertyDef(name, PropertyType.UNDEFINED, true);
             }
 
             if (def.isProtected()) {
@@ -534,7 +466,7 @@
             }
             InternalValue[] internalValues =
                     (InternalValue[]) list.toArray(new InternalValue[list.size()]);
-            checkSetPropertyValueConstraints(def, internalValues);
+            EffectiveNodeType.checkSetPropertyValueConstraints(def, internalValues);
             return true;
         } catch (BaseException be) {
             // implementation specific exception, fall through