Merge branch 'main' into CST-4509-assignAnEntityTypeToCollection

This commit is contained in:
Mykhaylo
2021-10-07 19:19:02 +02:00
39 changed files with 1139 additions and 221 deletions

View File

@@ -129,12 +129,23 @@ public class CollectionServiceImpl extends DSpaceObjectServiceImpl<Collection> i
@Override
public Collection create(Context context, Community community, String handle)
throws SQLException, AuthorizeException {
throws SQLException, AuthorizeException {
return create(context, community, handle, null);
}
@Override
public Collection create(Context context, Community community,
String handle, UUID uuid) throws SQLException, AuthorizeException {
if (community == null) {
throw new IllegalArgumentException("Community cannot be null when creating a new collection.");
}
Collection newCollection = collectionDAO.create(context, new Collection());
Collection newCollection;
if (uuid != null) {
newCollection = collectionDAO.create(context, new Collection(uuid));
} else {
newCollection = collectionDAO.create(context, new Collection());
}
//Add our newly created collection to our community, authorization checks occur in THIS method
communityService.addCollection(context, community, newCollection);
@@ -146,9 +157,10 @@ public class CollectionServiceImpl extends DSpaceObjectServiceImpl<Collection> i
authorizeService.createResourcePolicy(context, newCollection, anonymousGroup, null, Constants.READ, null);
// now create the default policies for submitted items
authorizeService
.createResourcePolicy(context, newCollection, anonymousGroup, null, Constants.DEFAULT_ITEM_READ, null);
.createResourcePolicy(context, newCollection, anonymousGroup, null, Constants.DEFAULT_ITEM_READ, null);
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);
@@ -164,12 +176,12 @@ public class CollectionServiceImpl extends DSpaceObjectServiceImpl<Collection> i
}
context.addEvent(new Event(Event.CREATE, Constants.COLLECTION,
newCollection.getID(), newCollection.getHandle(),
getIdentifiers(context, newCollection)));
newCollection.getID(), newCollection.getHandle(),
getIdentifiers(context, newCollection)));
log.info(LogHelper.getHeader(context, "create_collection",
"collection_id=" + newCollection.getID())
+ ",handle=" + newCollection.getHandle());
"collection_id=" + newCollection.getID())
+ ",handle=" + newCollection.getHandle());
return newCollection;
}
@@ -951,7 +963,7 @@ public class CollectionServiceImpl extends DSpaceObjectServiceImpl<Collection> i
* Finds all Indexed Collections where the current user has submit rights. If the user is an Admin,
* this is all Indexed Collections. Otherwise, it includes those collections where
* an indexed "submit" policy lists either the eperson or one of the eperson's groups
*
*
* @param context DSpace context
* @param discoverQuery
* @param entityType limit the returned collection to those related to given entity type