if (data.equals(itemData))
{
rootAdded = true;
}
deletes.add(new ItemState(data, ItemState.DELETED, fireEvent, ancestorToSave, isInternall));
// if subnode contains JCR_VERSIONHISTORY property
// we should remove version storage manually
if (checkRemoveChildVersionStorages && !data.isNode()
&& Constants.JCR_VERSIONHISTORY.equals(data.getQPath().getName()))
{
try
{
PropertyData vhPropertyData = (PropertyData)getItemData(data.getIdentifier());
removeVersionHistory(new String(vhPropertyData.getValues().get(0).getAsByteArray()), null,
ancestorToSave);
}
catch (IllegalStateException e)
{
throw new RepositoryException(e.getLocalizedMessage(), e);
}
catch (IOException e)
{
throw new RepositoryException(e.getLocalizedMessage(), e);
}
}
ItemImpl pooled = itemsPool.remove(data.getIdentifier());
if (pooled != null)
{
pooled.invalidate(); // invalidate immediate
invalidated.add(pooled);
}
}
// 4 add item itself if not added
if (!rootAdded)
{
deletes.add(new ItemState(itemData, ItemState.DELETED, fireEvent, ancestorToSave, isInternall));
ItemImpl pooled = itemsPool.remove(itemData.getIdentifier());
if (pooled != null)
{
pooled.invalidate(); // invalidate immediate