Author: tolusha
Date: 2009-11-16 08:33:32 -0500 (Mon, 16 Nov 2009)
New Revision: 681
Modified:
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/SessionChangesLog.java
Log:
EXOJCR-221: SessionChangesLog improvement
Modified:
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/SessionChangesLog.java
===================================================================
---
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/SessionChangesLog.java 2009-11-16
10:38:24 UTC (rev 680)
+++
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/SessionChangesLog.java 2009-11-16
13:33:32 UTC (rev 681)
@@ -61,6 +61,9 @@
protected Map<String, Map<String, ItemState>> lastChildPropertyStates =
new HashMap<String, Map<String, ItemState>>();
+ /**
+ * Stores persisted child nodes count.
+ */
protected Map<String, int[]> childNodesCount = new HashMap<String,
int[]>();
/**
@@ -146,23 +149,21 @@
index.remove(item.getData().getQPath());
index.remove(new ParentIDQPathBasedKey(item));
index.remove(new IDStateBasedKey(item.getData().getIdentifier(),
item.getState()));
+ childNodesCount.remove(item.getData().getIdentifier());
+ lastChildNodeStates.remove(item.getData().getIdentifier());
+ lastChildPropertyStates.remove(item.getData().getIdentifier());
if (item.isNode() && item.isPersisted())
{
int childCount[] =
childNodesCount.get(item.getData().getParentIdentifier());
if (childCount != null)
{
- childNodesCount.remove(item.getData().getIdentifier());
-
if (item.isDeleted())
- childCount[0]++;
+ ++childCount[0];
else if (item.isAdded())
- childCount[0]--;
+ --childCount[0];
- if (childCount[0] == 0)
- childNodesCount.remove(item.getData().getParentIdentifier());
- else
- childNodesCount.put(item.getData().getParentIdentifier(),
childCount);
+ childNodesCount.put(item.getData().getParentIdentifier(), childCount);
}
}
@@ -170,21 +171,13 @@
{
Map<String, ItemState> children =
lastChildNodeStates.get(item.getData().getParentIdentifier());
if (children != null)
- {
children.remove(item.getData().getIdentifier());
- if (children.size() == 0)
- lastChildNodeStates.remove(item.getData().getParentIdentifier());
- }
}
else
{
Map<String, ItemState> children =
lastChildPropertyStates.get(item.getData().getParentIdentifier());
if (children != null)
- {
children.remove(item.getData().getIdentifier());
- if (children.size() == 0)
- lastChildNodeStates.remove(item.getData().getParentIdentifier());
- }
}
}
}
@@ -632,9 +625,9 @@
childCount = new int[1];
if (item.isDeleted())
- childCount[0] -= 1;
+ --childCount[0];
else if (item.isAdded())
- childCount[0] += 1;
+ ++childCount[0];
childNodesCount.put(item.getData().getParentIdentifier(), childCount);
}
Show replies by date