Simulate a remove event at the site on deletion of a top level community

Fixes DS-1966
This commit is contained in:
Pascal-Nicolas Becker
2014-04-09 18:52:35 +02:00
parent fb61ed0597
commit fe16267d8f

View File

@@ -1091,8 +1091,15 @@ public class Community extends DSpaceObject
// will call rawDelete() before removing the linkage
Community parent = getParentCommunity();
if (parent != null)
if (parent == null)
{
// if removing a top level Community, simulate a REMOVE event at the Site.
if (getParentCommunity() == null)
{
ourContext.addEvent(new Event(Event.REMOVE, Constants.SITE, Site.SITE_ID,
Constants.COMMUNITY, getID(), getHandle()));
}
} else {
// remove the subcommunities first
Community[] subcommunities = getSubcommunities();
for (int i = 0; i < subcommunities.length; i++)