ALF-9367. Added new/improved Unit Tests in area of tagged blogposts and sorted result sets.

Also fixed a bug-ette whereby for 'get all' blogposts, the drafts at the end where sorted the wrong way.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@29071 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Neil McErlean
2011-07-15 11:02:51 +00:00
parent c6172b79ee
commit afa67d2bda
4 changed files with 172 additions and 28 deletions

View File

@@ -137,17 +137,17 @@ public class DraftsAndPublishedBlogPostsCannedQuery extends AbstractCannedQueryP
}
List<Pair<? extends Object, SortOrder>> sortPairs = parameters.getSortDetails().getSortPairs();
// For now, the BlogService only sorts by a single property.
if (sortPairs != null && !sortPairs.isEmpty())
{
Pair<? extends Object, SortOrder> sortPair = sortPairs.get(0);
QName sortProperty = (QName) sortPair.getFirst();
final PropertyBasedComparator comparator = new PropertyBasedComparator(sortProperty);
if (sortPair.getSecond() == SortOrder.DESCENDING)
for (Pair<? extends Object, SortOrder> sortPair : sortPairs)
{
Collections.sort(filtered, Collections.reverseOrder(comparator));
QName sortProperty = (QName) sortPair.getFirst();
final PropertyBasedComparator comparator = new PropertyBasedComparator(sortProperty);
if (sortPair.getSecond() == SortOrder.DESCENDING)
{
Collections.sort(filtered, Collections.reverseOrder(comparator));
}
}
}