mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-12 12:33:18 +00:00
[CSTPER-221] Collection handle generation after creation
This commit is contained in:
@@ -135,17 +135,6 @@ public class CollectionServiceImpl extends DSpaceObjectServiceImpl<Collection> i
|
|||||||
//Add our newly created collection to our community, authorization checks occur in THIS method
|
//Add our newly created collection to our community, authorization checks occur in THIS method
|
||||||
communityService.addCollection(context, community, newCollection);
|
communityService.addCollection(context, community, newCollection);
|
||||||
|
|
||||||
//Update our collection so we have a collection identifier
|
|
||||||
try {
|
|
||||||
if (handle == null) {
|
|
||||||
identifierService.register(context, newCollection);
|
|
||||||
} else {
|
|
||||||
identifierService.register(context, newCollection, handle);
|
|
||||||
}
|
|
||||||
} catch (IllegalStateException | IdentifierException ex) {
|
|
||||||
throw new IllegalStateException(ex);
|
|
||||||
}
|
|
||||||
|
|
||||||
// create the default authorization policy for collections
|
// create the default authorization policy for collections
|
||||||
// of 'anonymous' READ
|
// of 'anonymous' READ
|
||||||
Group anonymousGroup = groupService.findByName(context, Group.ANONYMOUS);
|
Group anonymousGroup = groupService.findByName(context, Group.ANONYMOUS);
|
||||||
@@ -158,6 +147,18 @@ public class CollectionServiceImpl extends DSpaceObjectServiceImpl<Collection> i
|
|||||||
authorizeService
|
authorizeService
|
||||||
.createResourcePolicy(context, newCollection, anonymousGroup, null, Constants.DEFAULT_BITSTREAM_READ, null);
|
.createResourcePolicy(context, newCollection, anonymousGroup, null, Constants.DEFAULT_BITSTREAM_READ, null);
|
||||||
|
|
||||||
|
collectionDAO.save(context, newCollection);
|
||||||
|
|
||||||
|
//Update our collection so we have a collection identifier
|
||||||
|
try {
|
||||||
|
if (handle == null) {
|
||||||
|
identifierService.register(context, newCollection);
|
||||||
|
} else {
|
||||||
|
identifierService.register(context, newCollection, handle);
|
||||||
|
}
|
||||||
|
} catch (IllegalStateException | IdentifierException ex) {
|
||||||
|
throw new IllegalStateException(ex);
|
||||||
|
}
|
||||||
|
|
||||||
context.addEvent(new Event(Event.CREATE, Constants.COLLECTION,
|
context.addEvent(new Event(Event.CREATE, Constants.COLLECTION,
|
||||||
newCollection.getID(), newCollection.getHandle(),
|
newCollection.getID(), newCollection.getHandle(),
|
||||||
@@ -167,7 +168,6 @@ public class CollectionServiceImpl extends DSpaceObjectServiceImpl<Collection> i
|
|||||||
"collection_id=" + newCollection.getID())
|
"collection_id=" + newCollection.getID())
|
||||||
+ ",handle=" + newCollection.getHandle());
|
+ ",handle=" + newCollection.getHandle());
|
||||||
|
|
||||||
collectionDAO.save(context, newCollection);
|
|
||||||
return newCollection;
|
return newCollection;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -108,16 +108,6 @@ public class CommunityServiceImpl extends DSpaceObjectServiceImpl<Community> imp
|
|||||||
|
|
||||||
communityDAO.save(context, newCommunity);
|
communityDAO.save(context, newCommunity);
|
||||||
|
|
||||||
context.addEvent(new Event(Event.CREATE, Constants.COMMUNITY, newCommunity.getID(), newCommunity.getHandle(),
|
|
||||||
getIdentifiers(context, newCommunity)));
|
|
||||||
|
|
||||||
// if creating a top-level Community, simulate an ADD event at the Site.
|
|
||||||
if (parent == null) {
|
|
||||||
context.addEvent(new Event(Event.ADD, Constants.SITE, siteService.findSite(context).getID(),
|
|
||||||
Constants.COMMUNITY, newCommunity.getID(), newCommunity.getHandle(),
|
|
||||||
getIdentifiers(context, newCommunity)));
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (handle == null) {
|
if (handle == null) {
|
||||||
identifierService.register(context, newCommunity);
|
identifierService.register(context, newCommunity);
|
||||||
@@ -128,6 +118,16 @@ public class CommunityServiceImpl extends DSpaceObjectServiceImpl<Community> imp
|
|||||||
throw new IllegalStateException(ex);
|
throw new IllegalStateException(ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
context.addEvent(new Event(Event.CREATE, Constants.COMMUNITY, newCommunity.getID(), newCommunity.getHandle(),
|
||||||
|
getIdentifiers(context, newCommunity)));
|
||||||
|
|
||||||
|
// if creating a top-level Community, simulate an ADD event at the Site.
|
||||||
|
if (parent == null) {
|
||||||
|
context.addEvent(new Event(Event.ADD, Constants.SITE, siteService.findSite(context).getID(),
|
||||||
|
Constants.COMMUNITY, newCommunity.getID(), newCommunity.getHandle(),
|
||||||
|
getIdentifiers(context, newCommunity)));
|
||||||
|
}
|
||||||
|
|
||||||
log.info(LogManager.getHeader(context, "create_community",
|
log.info(LogManager.getHeader(context, "create_community",
|
||||||
"community_id=" + newCommunity.getID())
|
"community_id=" + newCommunity.getID())
|
||||||
+ ",handle=" + newCommunity.getHandle());
|
+ ",handle=" + newCommunity.getHandle());
|
||||||
|
Reference in New Issue
Block a user