[CSTPER-221] Handle Providers enhanced for Communities and Collections

This commit is contained in:
Alessandro Martelli
2020-10-27 16:39:26 +01:00
parent 36e6a44000
commit b27d2ba322
4 changed files with 70 additions and 20 deletions

View File

@@ -37,6 +37,8 @@ import org.dspace.core.LogManager;
import org.dspace.eperson.Group;
import org.dspace.eperson.service.GroupService;
import org.dspace.event.Event;
import org.dspace.identifier.IdentifierException;
import org.dspace.identifier.service.IdentifierService;
import org.springframework.beans.factory.annotation.Autowired;
/**
@@ -69,6 +71,8 @@ public class CommunityServiceImpl extends DSpaceObjectServiceImpl<Community> imp
protected BitstreamService bitstreamService;
@Autowired(required = true)
protected SiteService siteService;
@Autowired(required = true)
protected IdentifierService identifierService;
protected CommunityServiceImpl() {
super();
@@ -92,13 +96,12 @@ public class CommunityServiceImpl extends DSpaceObjectServiceImpl<Community> imp
try {
if (handle == null) {
handleService.createHandle(context, newCommunity);
identifierService.register(context, newCommunity);
} else {
handleService.createHandle(context, newCommunity, handle);
identifierService.register(context, newCommunity, handle);
}
} catch (IllegalStateException ie) {
//If an IllegalStateException is thrown, then an existing object is already using this handle
throw ie;
} catch (IdentifierException e) {
throw new RuntimeException("Can't create an Identifier!");
}
if (parent != null) {