mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged HEAD-BUG-FIX (4.3/Cloud) to HEAD (4.3/Cloud)
57078: Merged V4.2-BUG-FIX (4.2.1) to HEAD-BUG-FIX (Cloud/4.3) 56565: Merged V4.1-BUG-FIX (4.1.7) to V4.2-BUG-FIX (4.2.1) 56238: Merged DEV to V4.1-BUG-FIX (4.1.7) 50368: MNT-9500: After editing one occurrence of recurrent event the recurrence disappears - Implemented the new functionality that allow update occurrences in a recurrence event. Now we have ability to update the following properties through outlook: start, end, subject, location. Calendar web script was updated to display event\events information correctly. Also appropriate unit tests were added. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@61709 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -21,7 +21,7 @@
|
||||
|
||||
<types>
|
||||
<type name="ia:ignoreEvent">
|
||||
<title>Separate Recurring Event</title>
|
||||
<title>Separate Ignored Recurring Event</title>
|
||||
<parent>cm:content</parent>
|
||||
<properties>
|
||||
<property name="ia:date">
|
||||
@@ -29,7 +29,28 @@
|
||||
</property>
|
||||
</properties>
|
||||
</type>
|
||||
|
||||
<type name="ia:updateEvent">
|
||||
<title>Separate Updated Recurring Event</title>
|
||||
<parent>cm:content</parent>
|
||||
<properties>
|
||||
<property name="ia:updatedDate">
|
||||
<type>d:datetime</type>
|
||||
</property>
|
||||
<property name="ia:newWhatEvent">
|
||||
<type>d:text</type>
|
||||
</property>
|
||||
<property name="ia:newStart">
|
||||
<type>d:datetime</type>
|
||||
</property>
|
||||
<property name="ia:newEnd">
|
||||
<type>d:datetime</type>
|
||||
</property>
|
||||
<property name="ia:newWhereEvent">
|
||||
<type>d:text</type>
|
||||
</property>
|
||||
</properties>
|
||||
</type>
|
||||
|
||||
<type name="ia:calendarEvent">
|
||||
<title>Calendar Event</title>
|
||||
<parent>cm:content</parent>
|
||||
@@ -92,7 +113,18 @@
|
||||
<many>true</many>
|
||||
</target>
|
||||
</child-association>
|
||||
</associations>
|
||||
<child-association name="ia:updatedEventList">
|
||||
<source>
|
||||
<mandatory>false</mandatory>
|
||||
<many>true</many>
|
||||
</source>
|
||||
<target>
|
||||
<class>ia:updateEvent</class>
|
||||
<mandatory>false</mandatory>
|
||||
<many>true</many>
|
||||
</target>
|
||||
</child-association>
|
||||
</associations>
|
||||
</type>
|
||||
|
||||
<type name="ia:calendar">
|
||||
|
@@ -52,4 +52,13 @@ public interface CalendarModel
|
||||
/** SharePoint Event */
|
||||
public static final QName ASPECT_DOC_FOLDERED = QName.createQName(CALENDAR_MODEL_URL, "docFoldered");
|
||||
public static final QName PROP_DOC_FOLDER = QName.createQName(CALENDAR_MODEL_URL, "docFolder");
|
||||
|
||||
/** Updated instances of recurrent series **/
|
||||
public static final QName PROP_UPDATED_EVENT_DATE = QName.createQName(CALENDAR_MODEL_URL, "updatedDate");
|
||||
public static final QName PROP_UPDATED_WHAT = QName.createQName(CALENDAR_MODEL_URL, "newWhatEvent");
|
||||
public static final QName PROP_UPDATED_START = QName.createQName(CALENDAR_MODEL_URL, "newStart");
|
||||
public static final QName PROP_UPDATED_END = QName.createQName(CALENDAR_MODEL_URL, "newEnd");
|
||||
public static final QName PROP_UPDATED_WHERE= QName.createQName(CALENDAR_MODEL_URL, "newWhereEvent");
|
||||
public static final QName ASSOC_UPDATED_EVENT_LIST = QName.createQName(CALENDAR_MODEL_URL, "updatedEventList");
|
||||
public static final QName TYPE_UPDATED_EVENT = QName.createQName(CALENDAR_MODEL_URL, "updateEvent");
|
||||
}
|
@@ -22,9 +22,12 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.model.ForumModel;
|
||||
import org.alfresco.query.CannedQuery;
|
||||
import org.alfresco.query.CannedQueryParameters;
|
||||
import org.alfresco.query.CannedQuerySortDetails.SortOrder;
|
||||
@@ -37,6 +40,8 @@ import org.alfresco.repo.security.permissions.impl.acegi.MethodSecurityBean;
|
||||
import org.alfresco.service.cmr.calendar.CalendarEntry;
|
||||
import org.alfresco.service.cmr.calendar.CalendarRecurrenceHelper;
|
||||
import org.alfresco.service.cmr.calendar.CalendarService;
|
||||
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter;
|
||||
import org.alfresco.service.cmr.tagging.TaggingService;
|
||||
@@ -142,9 +147,21 @@ public class GetCalendarEntriesCannedQuery extends AbstractCannedQueryPermission
|
||||
searchTo = recurringLastDate;
|
||||
}
|
||||
|
||||
Set<QName> childNodeTypeQNames = new HashSet<QName>();
|
||||
childNodeTypeQNames.add(CalendarModel.TYPE_IGNORE_EVENT);
|
||||
List<ChildAssociationRef> ignoreEventList = nodeService.getChildAssocs(result.getNodeRef(), childNodeTypeQNames);
|
||||
Set<Date> ignoredDates = new HashSet<Date>();
|
||||
for (ChildAssociationRef ignoreEvent : ignoreEventList)
|
||||
{
|
||||
NodeRef nodeRef = ignoreEvent.getChildRef();
|
||||
Date ignoredDate = (Date) nodeService.getProperty(nodeRef, CalendarModel.PROP_IGNORE_EVENT_DATE);
|
||||
ignoredDates.add(ignoredDate);
|
||||
}
|
||||
|
||||
|
||||
List<Date> dates = CalendarRecurrenceHelper.getRecurrencesOnOrAfter(
|
||||
recurringRule, fromDate, toDate, recurringLastDate,
|
||||
searchFrom, searchTo, false);
|
||||
searchFrom, searchTo, false, ignoredDates);
|
||||
if (dates != null && dates.size() > 0)
|
||||
{
|
||||
// Do any of these fit?
|
||||
|
@@ -19,15 +19,23 @@
|
||||
package org.alfresco.service.cmr.calendar;
|
||||
|
||||
import java.text.DateFormatSymbols;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.alfresco.repo.calendar.CalendarModel;
|
||||
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.extensions.surf.util.I18NUtil;
|
||||
@@ -205,11 +213,11 @@ public class CalendarRecurrenceHelper
|
||||
* @return The next recurrence on or after the given date, or null if there aren't any
|
||||
*/
|
||||
public static List<Date> getRecurrencesOnOrAfter(CalendarEntry entry, Date onOrAfter,
|
||||
Date until, boolean firstOnly)
|
||||
Date until, boolean firstOnly, Set<Date> ignoredDates)
|
||||
{
|
||||
return getRecurrencesOnOrAfter(
|
||||
entry.getRecurrenceRule(), entry.getStart(), entry.getEnd(),
|
||||
entry.getLastRecurrence(), onOrAfter, until, firstOnly);
|
||||
entry.getLastRecurrence(), onOrAfter, until, firstOnly, ignoredDates);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -223,7 +231,8 @@ public class CalendarRecurrenceHelper
|
||||
*/
|
||||
public static List<Date> getRecurrencesOnOrAfter(String recurrenceRule, Date eventStart,
|
||||
Date eventEnd, Date lastRecurrence,
|
||||
Date onOrAfter, Date until, boolean firstOnly)
|
||||
Date onOrAfter, Date until, boolean firstOnly,
|
||||
Set<Date> ignoredDates)
|
||||
{
|
||||
if (recurrenceRule == null)
|
||||
{
|
||||
@@ -318,7 +327,22 @@ public class CalendarRecurrenceHelper
|
||||
{
|
||||
logger.warn("Unsupported recurrence frequency " + freq);
|
||||
}
|
||||
|
||||
|
||||
SimpleDateFormat fmt = new SimpleDateFormat("yyyyMMdd");
|
||||
for (Date ignoredDate : ignoredDates)
|
||||
{
|
||||
Iterator<Date> i = dates.iterator();
|
||||
while (i.hasNext())
|
||||
{
|
||||
Date date = i.next();
|
||||
if (fmt.format(date).equals(fmt.format(ignoredDate)))
|
||||
{
|
||||
// occurrence is on the same day to ignore
|
||||
i.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Return what we've got
|
||||
return dates;
|
||||
}
|
||||
|
Reference in New Issue
Block a user