When two events are on at exactly the same time, sort the first to be created earlier in the list (helps keep order, and makes tests simpler)

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@30181 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Nick Burch
2011-09-02 11:46:48 +00:00
parent 248f8b47af
commit a1ce9d37f0
3 changed files with 8 additions and 1 deletions

View File

@@ -255,9 +255,11 @@ public class CalendarServiceImpl implements CalendarService
} }
// Build our sorting, by date // Build our sorting, by date
// Sort by start date, then end date, then created at for two events with matching times
List<Pair<QName,Boolean>> sort = new ArrayList<Pair<QName, Boolean>>(); List<Pair<QName,Boolean>> sort = new ArrayList<Pair<QName, Boolean>>();
sort.add(new Pair<QName, Boolean>(CalendarModel.PROP_FROM_DATE, true)); sort.add(new Pair<QName, Boolean>(CalendarModel.PROP_FROM_DATE, true));
sort.add(new Pair<QName, Boolean>(CalendarModel.PROP_TO_DATE, true)); sort.add(new Pair<QName, Boolean>(CalendarModel.PROP_TO_DATE, true));
sort.add(new Pair<QName, Boolean>(ContentModel.PROP_CREATED, true));
// We only want calendar entries // We only want calendar entries
Set<QName> types = new HashSet<QName>(); Set<QName> types = new HashSet<QName>();

View File

@@ -124,9 +124,11 @@ public class GetCalendarEntriesCannedQueryFactory extends AbstractQNameAwareCann
protected CannedQuerySortDetails createCQSortDetails() protected CannedQuerySortDetails createCQSortDetails()
{ {
// Sort by start date, then end date, then created at for two events with matching times
List<Pair<? extends Object,SortOrder>> sort = new ArrayList<Pair<? extends Object, SortOrder>>(); List<Pair<? extends Object,SortOrder>> sort = new ArrayList<Pair<? extends Object, SortOrder>>();
sort.add(new Pair<QName, SortOrder>(CalendarModel.PROP_FROM_DATE, SortOrder.ASCENDING)); sort.add(new Pair<QName, SortOrder>(CalendarModel.PROP_FROM_DATE, SortOrder.ASCENDING));
sort.add(new Pair<QName, SortOrder>(CalendarModel.PROP_TO_DATE, SortOrder.ASCENDING)); sort.add(new Pair<QName, SortOrder>(CalendarModel.PROP_TO_DATE, SortOrder.ASCENDING));
sort.add(new Pair<QName, SortOrder>(ContentModel.PROP_CREATED, SortOrder.ASCENDING));
return new CannedQuerySortDetails(sort); return new CannedQuerySortDetails(sort);
} }

View File

@@ -134,7 +134,10 @@ public class WikiServiceImpl implements WikiService
siteService, transactionService, taggingService); siteService, transactionService, taggingService);
} }
private String buildName(String title) /**
* Turns a Title into a Page Name.
*/
private static String buildName(String title)
{ {
// The name is based on the title, but with underscores // The name is based on the title, but with underscores
String name = title.replace(' ', '_'); String name = title.replace(' ', '_');