Merge branch 'main' of github.com:mwoodiupui/DSpace into 3061

This commit is contained in:
Mark H. Wood
2020-11-25 16:55:08 -05:00
69 changed files with 2183 additions and 11423 deletions

View File

@@ -54,6 +54,8 @@ import org.dspace.eperson.service.SubscribeService;
import org.dspace.event.Event;
import org.dspace.harvest.HarvestedCollection;
import org.dspace.harvest.service.HarvestedCollectionService;
import org.dspace.identifier.IdentifierException;
import org.dspace.identifier.service.IdentifierService;
import org.dspace.services.ConfigurationService;
import org.dspace.workflow.factory.WorkflowServiceFactory;
import org.dspace.xmlworkflow.WorkflowConfigurationException;
@@ -92,6 +94,8 @@ public class CollectionServiceImpl extends DSpaceObjectServiceImpl<Collection> i
protected CommunityService communityService;
@Autowired(required = true)
protected GroupService groupService;
@Autowired(required = true)
protected IdentifierService identifierService;
@Autowired(required = true)
protected LicenseService licenseService;
@@ -134,13 +138,6 @@ public class CollectionServiceImpl extends DSpaceObjectServiceImpl<Collection> i
//Add our newly created collection to our community, authorization checks occur in THIS method
communityService.addCollection(context, community, newCollection);
//Update our community so we have a collection identifier
if (handle == null) {
handleService.createHandle(context, newCollection);
} else {
handleService.createHandle(context, newCollection, handle);
}
// create the default authorization policy for collections
// of 'anonymous' READ
Group anonymousGroup = groupService.findByName(context, Group.ANONYMOUS);
@@ -153,6 +150,18 @@ public class CollectionServiceImpl extends DSpaceObjectServiceImpl<Collection> i
authorizeService
.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,
newCollection.getID(), newCollection.getHandle(),
@@ -162,7 +171,6 @@ public class CollectionServiceImpl extends DSpaceObjectServiceImpl<Collection> i
"collection_id=" + newCollection.getID())
+ ",handle=" + newCollection.getHandle());
collectionDAO.save(context, newCollection);
return newCollection;
}