mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
ACE-5453: 500 error: GET /nodes/{nodeId}/ratings?skipCount=XXX
- implemented fix and added new unit test git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@131385 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -107,15 +107,17 @@ public class NodeRatingsImpl implements NodeRatings
|
||||
Iterator<String> it = schemes.iterator();
|
||||
|
||||
int skipCount = paging.getSkipCount();
|
||||
int maxItems = paging.getMaxItems();
|
||||
int maxItems = paging.getMaxItems();
|
||||
int totalSize = schemes.size();
|
||||
int count = 0;
|
||||
|
||||
int end = skipCount + maxItems;
|
||||
if(end < 0)
|
||||
{
|
||||
// overflow
|
||||
end = Integer.MAX_VALUE;
|
||||
}
|
||||
int count = Math.min(maxItems, schemes.size() - skipCount);
|
||||
List<NodeRating> ratings = new ArrayList<NodeRating>(count);
|
||||
List<NodeRating> ratings = new ArrayList<NodeRating>(totalSize);
|
||||
|
||||
for(int i = 0; i < end && it.hasNext(); i++)
|
||||
{
|
||||
@@ -124,13 +126,12 @@ public class NodeRatingsImpl implements NodeRatings
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
count++;
|
||||
RatingScheme ratingScheme = validateRatingScheme(schemeName);
|
||||
NodeRating nodeRating = ratingScheme.getNodeRating(nodeRef);
|
||||
ratings.add(nodeRating);
|
||||
}
|
||||
|
||||
int totalSize = schemes.size();
|
||||
boolean hasMoreItems = (skipCount + count < totalSize);
|
||||
|
||||
return CollectionWithPagingInfo.asPaged(paging, ratings, hasMoreItems, totalSize);
|
||||
|
Reference in New Issue
Block a user