Merged HEAD-BUG-FIX (4.3/Cloud) to HEAD (4.3/Cloud)

59250: Merged V4.2-BUG-FIX (4.2.1) to HEAD-BUG-FIX (Cloud/4.3)
      59188: MNT-9996: All day Calendar events do not show for the first day in the Share Site Calendar grid.
      Fix unit tests failure. Detect allday events as events with the same start and end dates which have UTC midnight time.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@62114 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alan Davis
2014-02-12 01:14:57 +00:00
parent 0b62194fc7
commit 92d096ffe8

View File

@@ -19,7 +19,6 @@
package org.alfresco.repo.calendar.cannedqueries; package org.alfresco.repo.calendar.cannedqueries;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections; import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.Date; import java.util.Date;
@@ -84,6 +83,11 @@ public class GetCalendarEntriesCannedQuery extends AbstractCannedQueryPermission
this.nodeService = nodeService; this.nodeService = nodeService;
} }
private boolean isMidnightUTC(String isoDate)
{
return isoDate.endsWith("Z") && (isoDate.indexOf("T00:00:00") != -1);
}
@Override @Override
protected List<CalendarEntry> queryAndFilter(CannedQueryParameters parameters) protected List<CalendarEntry> queryAndFilter(CannedQueryParameters parameters)
{ {
@@ -110,16 +114,11 @@ public class GetCalendarEntriesCannedQuery extends AbstractCannedQueryPermission
String strFromDate = result.getFromDate(); String strFromDate = result.getFromDate();
String strToDate = result.getToDate(); String strToDate = result.getToDate();
if (strFromDate != null && strFromDate.equals(strToDate)) if (strFromDate != null && strFromDate.equals(strToDate) && isMidnightUTC(strFromDate))
{ {
// it is all day event and should conform with current server's timezone // it is all day event and should conform with current server's timezone
fromDate = ISO8601DateFormat.parseDayOnly(strFromDate, TimeZone.getDefault()); fromDate = ISO8601DateFormat.parseDayOnly(strFromDate, TimeZone.getDefault());
// all day event should be from midnight till next midnight toDate = fromDate;
Calendar defaultCalendar = ISO8601DateFormat.getCalendar();
defaultCalendar.setTime(fromDate);
// add one day to toDate
defaultCalendar.add(Calendar.DATE, 1);
toDate = defaultCalendar.getTime();
} }
else else
{ {