[exo-jcr-commits] exo-jcr SVN: r788 - jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache.

do-not-reply at jboss.org do-not-reply at jboss.org
Fri Nov 20 07:27:00 EST 2009


Author: sergiykarpenko
Date: 2009-11-20 07:27:00 -0500 (Fri, 20 Nov 2009)
New Revision: 788

Modified:
   jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnection.java
Log:
EXOJCR-246: reference delete property fixed

Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnection.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnection.java	2009-11-20 11:36:15 UTC (rev 787)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnection.java	2009-11-20 12:27:00 UTC (rev 788)
@@ -18,14 +18,12 @@
  */
 package org.exoplatform.services.jcr.impl.storage.jbosscache;
 
-import org.exoplatform.services.jcr.datamodel.InternalQName;
 import org.exoplatform.services.jcr.datamodel.ItemData;
 import org.exoplatform.services.jcr.datamodel.NodeData;
 import org.exoplatform.services.jcr.datamodel.PropertyData;
 import org.exoplatform.services.jcr.datamodel.QPath;
 import org.exoplatform.services.jcr.datamodel.QPathEntry;
 import org.exoplatform.services.jcr.datamodel.ValueData;
-import org.exoplatform.services.jcr.impl.Constants;
 import org.exoplatform.services.jcr.impl.core.lock.LockData;
 import org.exoplatform.services.jcr.impl.dataflow.TransientNodeData;
 import org.exoplatform.services.jcr.impl.dataflow.ValueDataConvertor;
@@ -197,7 +195,7 @@
 
       if (data.getType() == PropertyType.REFERENCE)
       {
-         Fqn propUUID = makeNodeFqn(data.getIdentifier());
+         Fqn propIdentifier = Fqn.fromElements(data.getIdentifier());
 
          for (ValueData value : data.getValues())
          {
@@ -227,7 +225,7 @@
                refParent = refsRoot.addChild(refNode);
             }
 
-            refParent.addChild(propUUID);
+            refParent.addChild(propIdentifier);
          }
 
       }
@@ -256,22 +254,25 @@
    {
       startBatch();
 
-      for (InternalQName mixin : data.getMixinTypeNames())
-      {
-         if (mixin.equals(Constants.MIX_REFERENCEABLE))
-         {
-            // check and release references
-            Node<Serializable, Object> node = refsRoot.addChild(Fqn.fromElements(data.getIdentifier()));
-            if (node != null)
-            {
-               if (node.getChildrenNames().size() != 0)
-               {
-                  throw new RepositoryException("Referenceable node removed but still have live references.");
-               }
-            }
-            break;
-         }
-      }
+      // TODO remove this check
+      //      for (InternalQName mixin : data.getMixinTypeNames())
+      //      {
+      //
+      //
+      //         if (mixin.equals(Constants.MIX_REFERENCEABLE))
+      //         {
+      //            // check and release references
+      //            Node<Serializable, Object> node = refsRoot.addChild(Fqn.fromElements(data.getIdentifier()));
+      //            if (node != null)
+      //            {
+      //               if (node.getChildrenNames().size() != 0)
+      //               {
+      //                  throw new RepositoryException("Referenceable node removed but still have live references.");
+      //               }
+      //            }
+      //            break;
+      //         }
+      //      }
 
       if (data.getParentIdentifier() != null)
       {
@@ -312,11 +313,20 @@
 
       if (data.getType() == PropertyType.REFERENCE)
       {
+         // get values from cahce
+
          Fqn propUUID = makeNodeFqn(data.getIdentifier());
 
-         for (ValueData value : data.getValues())
+         Node<Serializable, Object> prop = propsRoot.getChild(propUUID);
+         PropertyData oldData = (PropertyData)prop.get(ITEM_DATA);
+         if (oldData == null)
          {
+            throw new RepositoryException("FATAL PropertyData already empty " + data.getQPath().getAsString());
+         }
 
+         for (ValueData value : oldData.getValues())
+         {
+
             String refNodeUUID;
             try
             {



More information about the exo-jcr-commits mailing list