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

57915: Merged V4.2-BUG-FIX (4.2.1) to HEAD-BUG-FIX (Cloud/4.3)
      57908: Merged V4.1-BUG-FIX (4.1.8) to V4.2-BUG-FIX (4.2.1)
         57900: Merged V4.1.7 (4.1.7) to V4.1-BUG-FIX (4.1.8)
            57890: Merged DEV to V4.1.7 (4.1.7)
               57718:  MNT-9500: After editing one occurrence of recurrent event the recurrence disappears
                  - Implemented the functionality that allow updating series in outlook calendar.
               57846: MNT-9500: After editing one occurrence of recurrent event the recurrence disappears
                 - Unit tests and unforeseen behaviour (deletion of updated occurrence; update of recurrence, when occurrence was deleted) were implemented. Also, mini calendar dashlet was updated.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@61908 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alan Davis
2014-02-11 22:28:24 +00:00
parent ff2080895e
commit 31506b14d3

View File

@@ -183,14 +183,18 @@ public abstract class AbstractCalendarListingWebScript extends AbstractCalendarW
childNodeTypeQNames = new HashSet<QName>(); childNodeTypeQNames = new HashSet<QName>();
childNodeTypeQNames.add(CalendarModel.TYPE_UPDATED_EVENT); childNodeTypeQNames.add(CalendarModel.TYPE_UPDATED_EVENT);
List<ChildAssociationRef> updatedEventList = nodeService.getChildAssocs(entry.getNodeRef(), childNodeTypeQNames); List<ChildAssociationRef> updatedEventList = nodeService.getChildAssocs(entry.getNodeRef(), childNodeTypeQNames);
Map<String, Date[]> updatedDates = new HashMap<String, Date[]>(); Map<String, Object> updatedDates = new HashMap<String, Object>();
for (ChildAssociationRef updatedEvent : updatedEventList) for (ChildAssociationRef updatedEvent : updatedEventList)
{ {
NodeRef nodeRef = updatedEvent.getChildRef(); NodeRef nodeRef = updatedEvent.getChildRef();
Date updatedDate = (Date) nodeService.getProperty(nodeRef, CalendarModel.PROP_UPDATED_EVENT_DATE); Date updatedDate = (Date) nodeService.getProperty(nodeRef, CalendarModel.PROP_UPDATED_EVENT_DATE);
Date newStart = (Date) nodeService.getProperty(nodeRef, CalendarModel.PROP_UPDATED_START); Date newStart = (Date) nodeService.getProperty(nodeRef, CalendarModel.PROP_UPDATED_START);
Date newEnd = (Date) nodeService.getProperty(nodeRef, CalendarModel.PROP_UPDATED_END); Date newEnd = (Date) nodeService.getProperty(nodeRef, CalendarModel.PROP_UPDATED_END);
String newWhere = (String) nodeService.getProperty(nodeRef, CalendarModel.PROP_UPDATED_WHERE);
String newWhat = (String) nodeService.getProperty(nodeRef, CalendarModel.PROP_UPDATED_WHAT);
updatedDates.put(fmt.format(updatedDate), new Date[] { newStart, newEnd }); updatedDates.put(fmt.format(updatedDate), new Date[] { newStart, newEnd });
updatedDates.put(fmt.format(updatedDate).toString() + "where", newWhere);
updatedDates.put(fmt.format(updatedDate).toString() + "what", newWhat);
} }
// first occurrence can be edited as separate event // first occurrence can be edited as separate event
@@ -199,9 +203,9 @@ public abstract class AbstractCalendarListingWebScript extends AbstractCalendarW
// If first result only, alter title and finish // If first result only, alter title and finish
if (repeatingFirstOnly) if (repeatingFirstOnly)
{ {
updateRepeating(entry, updatedDates, entryResult, duration, fmt, liveEntry);
entryResult.put(RESULT_TITLE, entry.getTitle() + " (Repeating)"); entryResult.put(RESULT_TITLE, entry.getTitle() + " (Repeating)");
updateRepeating(entry, updatedDates, entryResult, duration, fmt, liveEntry);
return true; // Date has been changed return true; // Date has been changed
} }
else else
@@ -244,19 +248,17 @@ public abstract class AbstractCalendarListingWebScript extends AbstractCalendarW
result.put("legacyTimeTo", ltf.format(newEnd)); result.put("legacyTimeTo", ltf.format(newEnd));
} }
private void updateRepeating(CalendarEntry entry, Map<String, Date[]> updatedDates, Map<String, Object> entryResult, long duration, SimpleDateFormat fmt, Date date) private void updateRepeating(CalendarEntry entry, Map<String, Object> updatedDates, Map<String, Object> entryResult, long duration, SimpleDateFormat fmt, Date date)
{ {
if (updatedDates.keySet().contains(fmt.format(date))) if (updatedDates.keySet().contains(fmt.format(date)))
{ {
// there is day that was edited // there is day that was edited
Date[] newValues = updatedDates.get(fmt.format(date)); Date[] newValues = (Date[]) updatedDates.get(fmt.format(date));
long newDuration = newValues[1].getTime() - newValues[0].getTime(); long newDuration = newValues[1].getTime() - newValues[0].getTime();
NodeRef nodeRef = nodeService.getChildAssocsByPropertyValue(entry.getNodeRef(), CalendarModel.PROP_UPDATED_EVENT_DATE, date).get(0).getChildRef();
if (nodeRef != null) entryResult.put(RESULT_TITLE, (String) updatedDates.get(fmt.format(date).toString() + "what"));
{ entryResult.put("where", (String) updatedDates.get(fmt.format(date).toString() + "where"));
entryResult.put(RESULT_TITLE, (String) nodeService.getProperty(nodeRef, CalendarModel.PROP_UPDATED_WHAT));
entryResult.put("where", (String) nodeService.getProperty(nodeRef, CalendarModel.PROP_UPDATED_WHERE));
}
updateRepeatingStartEnd(newValues[0], newDuration, entryResult); updateRepeatingStartEnd(newValues[0], newDuration, entryResult);
} }
else else