mods.setPreapprovedAddParent(null);
Boolean allow = null;
// See if this removal is prerejected as part of removing a higher level tree
RepositoryItemMetadata prerejected = mods.getPrerejectedRemoveParent();
if (prerejected != null)
{
if (item.isChildOf(prerejected))
{
allow = Boolean.FALSE;
}
else
{
// Clean up
mods.setPrerejectedRemoveParent(null);
}
}
else
{
// Removal wasn't prerejected. See if it was preapproved as part
// of approving removing a higher level tree
ContentModification preapprovedRemove = mods.peekPreapprovedRemoveParent();
while (preapprovedRemove != null)
{
if (item.isChildOf(preapprovedRemove.getItem()))
{
// approved
allow = Boolean.TRUE;
break;
}
else
{
// We're done with children of preapproved parent so add the cached
// modification to the overall list. This will cause it to
// get executed *after* its children
// (i.e. remove parent after removing children)
mods.addModification(mods.popPreapprovedRemoveParent());
// Start checking grandparent
preapprovedRemove = mods.peekPreapprovedRemoveParent();
}
}
}
if (allow == null)
{
// Check with our policy
if (merge)
{
allow = Boolean.valueOf(policy.acceptMergeRemoval(item, null));
}
else
{
// See if the base version of the remote node was aware of the
// item being removed
RepositoryItemMetadata baseRemoteItem = getBaseRemoteItem(rootName, item);
allow = Boolean.valueOf(policy.acceptJoinRemoval(item, baseRemoteItem));
}
}
if (allow)