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

@@ -29,6 +29,7 @@ import javax.persistence.Table;
import javax.persistence.Transient;
import org.dspace.authorize.AuthorizeException;
import org.dspace.browse.ItemCountException;
import org.dspace.content.comparator.NameAscendingComparator;
import org.dspace.content.factory.ContentServiceFactory;
import org.dspace.content.service.CollectionService;
@@ -336,4 +337,12 @@ public class Collection extends DSpaceObject implements DSpaceObjectLegacySuppor
return collectionService;
}
public int getAllItems() {
try {
return collectionService.countArchivedItem(this);
} catch (ItemCountException e) {
throw new RuntimeException(e);
}
}
}