mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-15 22:13:08 +00:00
Merge branch 'main' of https://github.com/DSpace/DSpace into CST-11298
This commit is contained in:
@@ -31,6 +31,8 @@ import org.dspace.authorize.AuthorizeException;
|
||||
import org.dspace.authorize.ResourcePolicy;
|
||||
import org.dspace.authorize.service.AuthorizeService;
|
||||
import org.dspace.authorize.service.ResourcePolicyService;
|
||||
import org.dspace.browse.ItemCountException;
|
||||
import org.dspace.browse.ItemCounter;
|
||||
import org.dspace.content.dao.CollectionDAO;
|
||||
import org.dspace.content.service.BitstreamService;
|
||||
import org.dspace.content.service.CollectionService;
|
||||
@@ -43,6 +45,7 @@ import org.dspace.core.I18nUtil;
|
||||
import org.dspace.core.LogHelper;
|
||||
import org.dspace.core.service.LicenseService;
|
||||
import org.dspace.discovery.DiscoverQuery;
|
||||
import org.dspace.discovery.DiscoverQuery.SORT_ORDER;
|
||||
import org.dspace.discovery.DiscoverResult;
|
||||
import org.dspace.discovery.IndexableObject;
|
||||
import org.dspace.discovery.SearchService;
|
||||
@@ -735,7 +738,7 @@ public class CollectionServiceImpl extends DSpaceObjectServiceImpl<Collection> i
|
||||
collection.getID(), collection.getHandle(), getIdentifiers(context, collection)));
|
||||
|
||||
// remove subscriptions - hmm, should this be in Subscription.java?
|
||||
subscribeService.deleteByCollection(context, collection);
|
||||
subscribeService.deleteByDspaceObject(context, collection);
|
||||
|
||||
// Remove Template Item
|
||||
removeTemplateItem(context, collection);
|
||||
@@ -946,6 +949,7 @@ public class CollectionServiceImpl extends DSpaceObjectServiceImpl<Collection> i
|
||||
discoverQuery.setDSpaceObjectFilter(IndexableCollection.TYPE);
|
||||
discoverQuery.setStart(offset);
|
||||
discoverQuery.setMaxResults(limit);
|
||||
discoverQuery.setSortField(SOLR_SORT_FIELD, SORT_ORDER.asc);
|
||||
DiscoverResult resp = retrieveCollectionsWithSubmit(context, discoverQuery, null, community, q);
|
||||
for (IndexableObject solrCollections : resp.getIndexableObjects()) {
|
||||
Collection c = ((IndexableCollection) solrCollections).getIndexedObject();
|
||||
@@ -1080,6 +1084,7 @@ public class CollectionServiceImpl extends DSpaceObjectServiceImpl<Collection> i
|
||||
discoverQuery.setDSpaceObjectFilter(IndexableCollection.TYPE);
|
||||
discoverQuery.setStart(offset);
|
||||
discoverQuery.setMaxResults(limit);
|
||||
discoverQuery.setSortField(SOLR_SORT_FIELD, SORT_ORDER.asc);
|
||||
DiscoverResult resp = retrieveCollectionsWithSubmit(context, discoverQuery,
|
||||
entityType, community, q);
|
||||
for (IndexableObject solrCollections : resp.getIndexableObjects()) {
|
||||
@@ -1099,4 +1104,35 @@ public class CollectionServiceImpl extends DSpaceObjectServiceImpl<Collection> i
|
||||
return (int) resp.getTotalSearchResults();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("rawtypes")
|
||||
public List<Collection> findAllCollectionsByEntityType(Context context, String entityType)
|
||||
throws SearchServiceException {
|
||||
List<Collection> collectionList = new ArrayList<>();
|
||||
|
||||
DiscoverQuery discoverQuery = new DiscoverQuery();
|
||||
discoverQuery.setDSpaceObjectFilter(IndexableCollection.TYPE);
|
||||
discoverQuery.addFilterQueries("dspace.entity.type:" + entityType);
|
||||
|
||||
DiscoverResult discoverResult = searchService.search(context, discoverQuery);
|
||||
List<IndexableObject> solrIndexableObjects = discoverResult.getIndexableObjects();
|
||||
|
||||
for (IndexableObject solrCollection : solrIndexableObjects) {
|
||||
Collection c = ((IndexableCollection) solrCollection).getIndexedObject();
|
||||
collectionList.add(c);
|
||||
}
|
||||
return collectionList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns total collection archived items
|
||||
*
|
||||
* @param collection Collection
|
||||
* @return total collection archived items
|
||||
* @throws ItemCountException
|
||||
*/
|
||||
@Override
|
||||
public int countArchivedItems(Collection collection) throws ItemCountException {
|
||||
return ItemCounter.getInstance().getCount(collection);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user