use of com.zimbra.cs.service.mail.GetCalendarItemSummaries.EncodeCalendarItemResult in project zm-mailbox by Zimbra.
the class SearchResponse method add.
/**
* The encoded element OR NULL if the search params contained a calItemExpand
* range AND the calendar item did not have any instances in the specified range.
*
* @return could be NULL
*/
private Element add(CalendarItemHit hit) throws ServiceException {
CalendarItem item = hit.getCalendarItem();
Account acct = DocumentHandler.getRequestedAccount(zsc);
long rangeStart = params.getCalItemExpandStart();
long rangeEnd = params.getCalItemExpandEnd();
if (rangeStart == -1 && rangeEnd == -1 && (item instanceof Appointment)) {
// If no time range was given, force first instance only. (bug 51267)
rangeStart = item.getStartTime();
rangeEnd = rangeStart + 1;
}
EncodeCalendarItemResult encoded = GetCalendarItemSummaries.encodeCalendarItemInstances(zsc, octxt, item, acct, rangeStart, rangeEnd, true);
Element el = encoded.element;
if (el != null) {
element.addElement(el);
ToXML.setCalendarItemFields(el, ifmt, octxt, item, PendingModifications.Change.ALL_FIELDS, false, params.getNeuterImages());
el.addAttribute(MailConstants.A_CONTENTMATCHED, true);
}
return el;
}
Aggregations