Author: sergiykarpenko
Date: 2009-11-23 12:05:27 -0500 (Mon, 23 Nov 2009)
New Revision: 813
Modified:
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnection.java
Log:
EXOJCR-246: JBossCacheStorageConnection remove references 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-23
15:07:10 UTC (rev 812)
+++
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnection.java 2009-11-23
17:05:27 UTC (rev 813)
@@ -371,29 +371,44 @@
for (String refNodeUUID : remNodes)
{
// remove property from referencedNode in $REFS map
+ Node<Serializable, Object> refParent =
refsRoot.getChild(makeNodeFqn(refNodeUUID));
- Node<Serializable, Object> refParent =
refsRoot.getChild(makeNodeFqn(refNodeUUID));
if (refParent != null)
{
- if (!refParent.removeChild(propUUID))
+ if (refParent.hasChild(propUUID))
{
- throw new RepositoryException("FATAL Reference property was not
removed from REFS table of node "
- + refNodeUUID);
+ // do we need remove node record also
+ boolean removeParent = (refParent.getChildrenNames().size() == 1);
- }
- // check is there is no more references
- if (refParent.getChildrenNames().size() == 0)
- {
- if (!refsRoot.removeChild(makeNodeFqn(refNodeUUID)))
+ if (!refParent.removeChild(propUUID))
{
- throw new RepositoryException("FATAL Node record was node
removed from REFS table " + refNodeUUID);
+ throw new RepositoryException("FATAL Reference property was not
removed from REFS table of node "
+ + refNodeUUID);
}
+
+ if (removeParent)
+ {
+ if (!refsRoot.removeChild(makeNodeFqn(refNodeUUID)))
+ {
+ throw new RepositoryException("FATAL Node record was node
removed from REFS table "
+ + refNodeUUID);
+ }
+ }
}
+ else
+ {
+ LOG.warn("Property reference " + data.getIdentifier() +
" to node " + refNodeUUID
+ + " was already removed.");
+ }
}
+ else
+ {
+ LOG.warn("Reference record of node " + refNodeUUID + " was
already removed.");
+ }
}
}
- // remove from parent's properties attr
+ // remove from parent's properties attributes
// TODO validate does deleted
if (parent.remove(data.getQPath().getName().getAsString()) == null)
{
@@ -1059,6 +1074,11 @@
}
}
+ private void removePropertyReferenceToNode(String nodeId, Fqn propFqn)
+ {
+
+ }
+
/**
* @see
org.exoplatform.services.jcr.storage.WorkspaceStorageConnection#getLockData(java.lang.String)
*/
Show replies by date