mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-07 18:14:26 +00:00
Merge pull request #2153 from Georgetown-University-Libraries/ds3856m
DS-3856 - foreignkey-constraint community2community_child_comm_id_fkey (for master)
This commit is contained in:
@@ -452,9 +452,6 @@ public class CommunityServiceImpl extends DSpaceObjectServiceImpl<Community> imp
|
|||||||
|
|
||||||
rawDelete(context, childCommunity);
|
rawDelete(context, childCommunity);
|
||||||
|
|
||||||
childCommunity.removeParentCommunity(parentCommunity);
|
|
||||||
parentCommunity.removeSubCommunity(childCommunity);
|
|
||||||
|
|
||||||
log.info(LogManager.getHeader(context, "remove_subcommunity",
|
log.info(LogManager.getHeader(context, "remove_subcommunity",
|
||||||
"parent_comm_id=" + parentCommunity.getID() + ",child_comm_id=" + childCommunity
|
"parent_comm_id=" + parentCommunity.getID() + ",child_comm_id=" + childCommunity
|
||||||
.getID()));
|
.getID()));
|
||||||
@@ -553,6 +550,13 @@ public class CommunityServiceImpl extends DSpaceObjectServiceImpl<Community> imp
|
|||||||
// Remove any Handle
|
// Remove any Handle
|
||||||
handleService.unbindHandle(context, community);
|
handleService.unbindHandle(context, community);
|
||||||
|
|
||||||
|
// Remove the parent-child relationship for the community we want to delete
|
||||||
|
Community parent = (Community) getParentObject(context, community);
|
||||||
|
if (parent != null) {
|
||||||
|
community.removeParentCommunity(parent);
|
||||||
|
parent.removeSubCommunity(community);
|
||||||
|
}
|
||||||
|
|
||||||
Group g = community.getAdministrators();
|
Group g = community.getAdministrators();
|
||||||
|
|
||||||
// Delete community row
|
// Delete community row
|
||||||
|
@@ -209,6 +209,7 @@ public class ITCommunityCollection extends AbstractIntegrationTest {
|
|||||||
// Create a hierachy of sub-Communities and Collections and Items.
|
// Create a hierachy of sub-Communities and Collections and Items.
|
||||||
Community child = communityService.createSubcommunity(context, parentCom);
|
Community child = communityService.createSubcommunity(context, parentCom);
|
||||||
Community child2 = communityService.createSubcommunity(context, parentCom);
|
Community child2 = communityService.createSubcommunity(context, parentCom);
|
||||||
|
Community child3 = communityService.createSubcommunity(context, parentCom);
|
||||||
Community grandchild = communityService.createSubcommunity(context, child);
|
Community grandchild = communityService.createSubcommunity(context, child);
|
||||||
Collection childCol = collectionService.create(context, child);
|
Collection childCol = collectionService.create(context, child);
|
||||||
Collection grandchildCol = collectionService.create(context, grandchild);
|
Collection grandchildCol = collectionService.create(context, grandchild);
|
||||||
@@ -252,6 +253,13 @@ public class ITCommunityCollection extends AbstractIntegrationTest {
|
|||||||
assertThat("Community Admin unable to delete sub-Community",
|
assertThat("Community Admin unable to delete sub-Community",
|
||||||
communityService.find(context, commId), nullValue());
|
communityService.find(context, commId), nullValue());
|
||||||
|
|
||||||
|
// Test deletion of single Sub-Community with own admin group
|
||||||
|
communityService.createAdministrators(context, child3);
|
||||||
|
commId = child3.getID();
|
||||||
|
communityService.delete(context, child3);
|
||||||
|
assertThat("Community Admin unable to delete sub-Community",
|
||||||
|
communityService.find(context, commId), nullValue());
|
||||||
|
|
||||||
// Test deletion of Sub-Community Hierarchy as a Community Admin
|
// Test deletion of Sub-Community Hierarchy as a Community Admin
|
||||||
commId = child.getID();
|
commId = child.getID();
|
||||||
collId = childCol.getID();
|
collId = childCol.getID();
|
||||||
|
Reference in New Issue
Block a user