Merge pull request #1277 from tdonohue/DS-3039

DS-3039 : Fix Community item counting logic. Also cleanup item counting elsewhere in code
This commit is contained in:
Tim Donohue
2016-02-19 14:05:20 -06:00
12 changed files with 301 additions and 235 deletions

View File

@@ -576,22 +576,6 @@ public class CommunityServiceImpl extends DSpaceObjectServiceImpl<Community> imp
authorizeService.authorizeAction(context, community, Constants.WRITE);
}
@Override
public int countItems(Context context, Community community) throws SQLException {
int total = 0;
// add collection counts
List<Collection> cols = community.getCollections();
for (Collection col : cols) {
total += itemService.countItems(context, col);
}
// add sub-community counts
List<Community> comms = community.getSubcommunities();
for (int j = 0; j < comms.size(); j++) {
total += countItems(context, comms.get(j));
}
return total;
}
@Override
public Community findByAdminGroup(Context context, Group group) throws SQLException {
return communityDAO.findByAdminGroup(context, group);