jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r916295 - in /jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex: ItemInfoJSONHandler.java NodeInfoImpl.java
Date Thu, 25 Feb 2010 14:27:46 GMT
Author: mduerig
Date: Thu Feb 25 14:27:46 2010
New Revision: 916295

URL: http://svn.apache.org/viewvc?rev=916295&view=rev
Log:
JCR-2518: Make ItemIds more stable

Modified:
    jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/ItemInfoJSONHandler.java
    jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/NodeInfoImpl.java

Modified: jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/ItemInfoJSONHandler.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/ItemInfoJSONHandler.java?rev=916295&r1=916294&r2=916295&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/ItemInfoJSONHandler.java
(original)
+++ jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/ItemInfoJSONHandler.java
Thu Feb 25 14:27:46 2010
@@ -16,9 +16,20 @@
  */
 package org.apache.jackrabbit.spi2davex;
 
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Stack;
+
+import javax.jcr.PropertyType;
+import javax.jcr.RepositoryException;
+
 import org.apache.jackrabbit.commons.json.JsonHandler;
 import org.apache.jackrabbit.spi.ChildInfo;
 import org.apache.jackrabbit.spi.IdFactory;
+import org.apache.jackrabbit.spi.ItemInfo;
 import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.spi.NodeId;
 import org.apache.jackrabbit.spi.NodeInfo;
@@ -26,21 +37,11 @@
 import org.apache.jackrabbit.spi.PathFactory;
 import org.apache.jackrabbit.spi.PropertyId;
 import org.apache.jackrabbit.spi.QValue;
-import org.apache.jackrabbit.spi.ItemInfo;
 import org.apache.jackrabbit.spi.commons.conversion.NamePathResolver;
 import org.apache.jackrabbit.util.Text;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import javax.jcr.PropertyType;
-import javax.jcr.RepositoryException;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Stack;
-
 /**
  * <code>ItemInfoJSONHandler</code>...
  */
@@ -102,6 +103,7 @@
     public void endObject() throws IOException {
         try {
             NodeInfoImpl nInfo = (NodeInfoImpl) nodeInfos.pop();
+            nInfo.resolveUUID(idFactory);
             NodeInfo parent = getCurrentNodeInfo();
             if (parent != null) {
                 if (nInfo.getPath().getAncestor(1).equals(parent.getPath())) {

Modified: jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/NodeInfoImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/NodeInfoImpl.java?rev=916295&r1=916294&r2=916295&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/NodeInfoImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/NodeInfoImpl.java
Thu Feb 25 14:27:46 2010
@@ -16,6 +16,15 @@
  */
 package org.apache.jackrabbit.spi2davex;
 
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Set;
+
+import javax.jcr.RepositoryException;
+
 import org.apache.jackrabbit.spi.ChildInfo;
 import org.apache.jackrabbit.spi.IdFactory;
 import org.apache.jackrabbit.spi.Name;
@@ -27,14 +36,6 @@
 import org.apache.jackrabbit.spi.QValue;
 import org.apache.jackrabbit.spi.commons.name.NameConstants;
 
-import javax.jcr.RepositoryException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-import java.util.LinkedHashSet;
-
 /**
  * <code>NodeInfoImpl</code>...
  */
@@ -101,7 +102,6 @@
         if (NameConstants.JCR_UUID.equals(pn)) {
             uniqueID = propInfo.getValues()[0].getString();
             id = idFactory.createNodeId(uniqueID);
-            propInfo.setId(idFactory.createPropertyId(id, propInfo.getName()));
         } else if (NameConstants.JCR_PRIMARYTYPE.equals(pn)) {
             primaryNodeTypeName = propInfo.getValues()[0].getName();
         } else if (NameConstants.JCR_MIXINTYPES.equals(pn)) {
@@ -114,6 +114,15 @@
         }
     }
 
+    void resolveUUID(IdFactory idFactory) {
+        if (uniqueID != null) {
+            for (Object o : propertyInfos) {
+                PropertyInfoImpl propInfo = (PropertyInfoImpl) o;
+                propInfo.setId(idFactory.createPropertyId(id, propInfo.getName()));
+            }
+        }
+    }
+
     void addChildInfo(ChildInfo childInfo) {
         if (childInfos == null) {
             childInfos = new LinkedHashSet<ChildInfo>();



Mime
View raw message