Add itemService.countItems(Context, Community)

A convenience method to get community item count
This commit is contained in:
Peter Dietz
2015-08-20 18:14:45 -04:00
parent db38e9a305
commit d0e628178e
2 changed files with 18 additions and 1 deletions

View File

@@ -1109,6 +1109,16 @@ public class ItemServiceImpl extends DSpaceObjectServiceImpl<Item> implements It
return itemDAO.countItems(context, collection, true, false);
}
@Override
public int countItems(Context context, Community community) throws SQLException {
List<Collection> collections = communityService.getAllCollections(context, community);
int itemCount = 0;
for(Collection collection : collections) {
itemCount += countItems(context, collection);
}
return itemCount;
}
@Override
protected void getAuthoritiesAndConfidences(String fieldKey, Collection collection, List<String> values, List<String> authorities, List<Integer> confidences, int i) {
Choices c = choiceAuthorityService.getBestMatch(fieldKey, values.get(i), collection, null);