recurrenceVO.fillRecurrenceHashMap();
HashMap recurrenceRuleMap = recurrenceVO.getRecurrenceHM();
if (recurrenceRuleMap != null && recurrenceRuleMap.size() > 0)
{
Date recurrStartDate = (Date)activityRecord.get("startdate");
// For very long recurrences we only need to calculate out 18 months before of the
// passedStartDate otherwise we spend all our time calculating recurring tasks.
Calendar compareCalendar = (Calendar)passedStartDate.clone();
compareCalendar.add(Calendar.MONTH, -18);
Date compareDate = new Date(compareCalendar.getTimeInMillis());
if (recurrStartDate.before(compareDate))
{
recurrStartDate = compareDate;
}
GregorianCalendar recurringStartDate = new GregorianCalendar(TimeZone.getTimeZone("EST"));
if (recurrStartDate != null)
{
recurringStartDate.setTime(recurrStartDate);
recurringStartDate.set(Calendar.HOUR, activityRecordStart.get(Calendar.HOUR));
recurringStartDate.set(Calendar.MINUTE, activityRecordStart.get(Calendar.MINUTE));
recurringStartDate.set(Calendar.AM_PM, activityRecordStart.get(Calendar.AM_PM));
}
Date recurrEndDate = (Date)activityRecord.get("Until");
// if there is no end date (the recurrence is open ended)
// then coerce it to the passed in end date, for calculation purposes
// Also for very long recurrences we only need to calculate out 2 months ahead of the
// passedEndDate otherwise we spend all our time calculating recurring tasks.
compareCalendar = (Calendar)passedEndDate.clone();
compareCalendar.add(Calendar.MONTH, 2);
compareDate = new Date(compareCalendar.getTimeInMillis());
if (recurrEndDate == null || recurrEndDate.after(compareDate))
{
recurrEndDate = compareDate;
}
// get an RFC 2445 compliant recurrance rule string.