Item counters added to Communities and Collections REST API

This commit is contained in:
damian
2023-05-11 20:08:32 +02:00
parent 2e6085802f
commit 0231af5867
12 changed files with 92 additions and 5 deletions

View File

@@ -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;
@@ -1047,4 +1049,12 @@ public class CollectionServiceImpl extends DSpaceObjectServiceImpl<Collection> i
return (int) resp.getTotalSearchResults();
}
@Override
public int countArchivedItem(Collection collection) throws ItemCountException {
//TODO load ItemCounter on bean creation
Context context = new Context();
return new ItemCounter(context).getCount(collection);
}
}