jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r1368923 - in /jackrabbit/oak/trunk: oak-core/src/main/java/org/apache/jackrabbit/oak/api/PropertyState.java oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeDelegate.java
Date Fri, 03 Aug 2012 12:47:23 GMT
Author: angela
Date: Fri Aug  3 12:47:22 2012
New Revision: 1368923

URL: http://svn.apache.org/viewvc?rev=1368923&view=rev
Log:
OAK-232 : Hardcoded "childOrder" in NodeDelegate

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/PropertyState.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeDelegate.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/PropertyState.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/PropertyState.java?rev=1368923&r1=1368922&r2=1368923&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/PropertyState.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/PropertyState.java
Fri Aug  3 12:47:22 2012
@@ -36,6 +36,18 @@ import javax.annotation.Nonnull;
 public interface PropertyState {
 
     /**
+     * If a JCR node is orderable the OAK API will expose an "{@code oak:childOrder}"
+     * property state indicating the order of child nodes.
+     *
+     * NOTE: this is an temporary solution (OAK-232) until we reach consensus (see also OAK-182)
+     *
+     * // TODO: Use a proper namespace for this property?
+     * // TODO: Expose this a API method on the Tree interface (see http://markmail.org/message/kzt7csiz2bd5n3ww)
?
+     * // TODO: Define if/how this internal property is exposed on the JCR API
+     */
+    public static final String OAK_CHILD_ORDER = "childOrder";
+
+    /**
      * @return the name of this property state
      */
     @Nonnull

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeDelegate.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeDelegate.java?rev=1368923&r1=1368922&r2=1368923&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeDelegate.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeDelegate.java
Fri Aug  3 12:47:22 2012
@@ -177,7 +177,7 @@ public class NodeDelegate extends ItemDe
 
     /**
      * Returns an iterator for traversing all the children of this node.
-     * If the node is orderable (there is an "{@code oak:childOrder}"
+     * If the node is orderable (there is an {@link PropertyState#OAK_CHILD_ORDER}
      * property) then the iterator will return child nodes in the specified
      * order. Otherwise the ordering of the iterator is undefined.
      *
@@ -200,8 +200,7 @@ public class NodeDelegate extends ItemDe
                 return Collections.<NodeDelegate>emptySet().iterator();
             }
         } else {
-            // TODO: Use a proper namespace for this property?
-            PropertyState order = tree.getProperty("childOrder");
+            PropertyState order = tree.getProperty(PropertyState.OAK_CHILD_ORDER);
             if (order == null || !order.isArray()) {
                 // No specified ordering
                 return nodeDelegateIterator(tree.getChildren().iterator());
@@ -255,7 +254,7 @@ public class NodeDelegate extends ItemDe
             CoreValueFactory factory =
                     sessionDelegate.getContentSession().getCoreValueFactory();
 
-            PropertyState property = tree.getProperty("childOrder");
+            PropertyState property = tree.getProperty(PropertyState.OAK_CHILD_ORDER);
             if (property != null) {
                 for (CoreValue value : property.getValues()) {
                     String name = value.getString();
@@ -278,7 +277,7 @@ public class NodeDelegate extends ItemDe
                 order.add(factory.createValue(source));
             }
 
-            tree.setProperty("childOrder", order);
+            tree.setProperty(PropertyState.OAK_CHILD_ORDER, order);
         }
     }
 



Mime
View raw message