From fe16267d8f5549b0f1c72c4d1cc109d3de5d2b7b Mon Sep 17 00:00:00 2001 From: Pascal-Nicolas Becker Date: Wed, 9 Apr 2014 18:52:35 +0200 Subject: [PATCH] Simulate a remove event at the site on deletion of a top level community Fixes DS-1966 --- .../src/main/java/org/dspace/content/Community.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/dspace-api/src/main/java/org/dspace/content/Community.java b/dspace-api/src/main/java/org/dspace/content/Community.java index ed632e7e7f..0857c3260b 100644 --- a/dspace-api/src/main/java/org/dspace/content/Community.java +++ b/dspace-api/src/main/java/org/dspace/content/Community.java @@ -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++)