Search in sources :

Example 1 with EncodeCalendarItemResult

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;
}
Also used : CalendarItem(com.zimbra.cs.mailbox.CalendarItem) Appointment(com.zimbra.cs.mailbox.Appointment) Account(com.zimbra.cs.account.Account) EncodeCalendarItemResult(com.zimbra.cs.service.mail.GetCalendarItemSummaries.EncodeCalendarItemResult) Element(com.zimbra.common.soap.Element)

Aggregations

Element (com.zimbra.common.soap.Element)1 Account (com.zimbra.cs.account.Account)1 Appointment (com.zimbra.cs.mailbox.Appointment)1 CalendarItem (com.zimbra.cs.mailbox.CalendarItem)1 EncodeCalendarItemResult (com.zimbra.cs.service.mail.GetCalendarItemSummaries.EncodeCalendarItemResult)1