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

@@ -24,6 +24,8 @@ import org.dspace.authorize.AuthorizeConfiguration;
import org.dspace.authorize.AuthorizeException;
import org.dspace.authorize.ResourcePolicy;
import org.dspace.authorize.service.AuthorizeService;
import org.dspace.browse.ItemCountException;
import org.dspace.browse.ItemCounter;
import org.dspace.content.dao.CommunityDAO;
import org.dspace.content.service.BitstreamService;
import org.dspace.content.service.CollectionService;
@@ -76,9 +78,9 @@ public class CommunityServiceImpl extends DSpaceObjectServiceImpl<Community> imp
protected IdentifierService identifierService;
@Autowired(required = true)
protected SubscribeService subscribeService;
protected CommunityServiceImpl() {
super();
}
@Override
@@ -708,4 +710,11 @@ public class CommunityServiceImpl extends DSpaceObjectServiceImpl<Community> imp
public int countTotal(Context context) throws SQLException {
return communityDAO.countRows(context);
}
@Override
public int getArchivedItems(Community community) throws ItemCountException {
//TODO load ItemCounter on bean creation
Context context = new Context();
return new ItemCounter(context).getCount(community);
}
}