Search in sources :

Example 41 with Element

use of com.zimbra.common.soap.Element in project zm-mailbox by Zimbra.

the class ZMailbox method enableSharedReminder.

/**
     * enable/disable displaying reminder for shared appointments/tasks
     * @param mountpointId
     * @param reminderEnabled
     * @throws ServiceException
     */
public void enableSharedReminder(String mountpointId, boolean reminderEnabled) throws ServiceException {
    Element req = newRequestElement(MailConstants.ENABLE_SHARED_REMINDER_REQUEST);
    Element linkEl = req.addUniqueElement(MailConstants.E_MOUNT);
    linkEl.addAttribute(MailConstants.A_ID, mountpointId);
    linkEl.addAttribute(MailConstants.A_REMINDER, reminderEnabled);
    invoke(req);
}
Also used : JSONElement(com.zimbra.common.soap.Element.JSONElement) Element(com.zimbra.common.soap.Element) XMLElement(com.zimbra.common.soap.Element.XMLElement)

Example 42 with Element

use of com.zimbra.common.soap.Element in project zm-mailbox by Zimbra.

the class ZMailbox method convAction.

private Element convAction(String op, String id, String constraints) {
    Element req = newRequestElement(MailConstants.CONV_ACTION_REQUEST);
    Element actionEl = req.addUniqueElement(MailConstants.E_ACTION);
    actionEl.addAttribute(MailConstants.A_ID, id);
    actionEl.addAttribute(MailConstants.A_OPERATION, op);
    if (constraints != null) {
        actionEl.addAttribute(MailConstants.A_TARGET_CONSTRAINT, constraints);
    }
    return actionEl;
}
Also used : JSONElement(com.zimbra.common.soap.Element.JSONElement) Element(com.zimbra.common.soap.Element) XMLElement(com.zimbra.common.soap.Element.XMLElement)

Example 43 with Element

use of com.zimbra.common.soap.Element in project zm-mailbox by Zimbra.

the class ZMailbox method internalSearch.

// ------------------------
private synchronized ZSearchResult internalSearch(String convId, ZSearchParams params, boolean nest) throws ServiceException {
    QName name;
    if (convId != null) {
        name = MailConstants.SEARCH_CONV_REQUEST;
    } else if (params.getTypes().equals(ZSearchParams.TYPE_VOICE_MAIL) || params.getTypes().equals(ZSearchParams.TYPE_CALL)) {
        name = VoiceConstants.SEARCH_VOICE_REQUEST;
    } else if (params.getTypes().equals(ZSearchParams.TYPE_GAL)) {
        name = AccountConstants.SEARCH_GAL_REQUEST;
    } else {
        name = MailConstants.SEARCH_REQUEST;
    }
    Element req = newRequestElement(name);
    if (params.getTypes().equals(ZSearchParams.TYPE_GAL)) {
        req.addAttribute(AccountConstants.A_TYPE, GalEntryType.account.name());
        req.addElement(AccountConstants.E_NAME).setText(params.getQuery());
    //req.addAttribute(MailConstants.A_SORTBY, SearchSortBy.nameAsc.name());
    }
    req.addAttribute(MailConstants.A_CONV_ID, convId);
    if (nest) {
        req.addAttribute(MailConstants.A_NEST_MESSAGES, true);
    }
    if (params.getLimit() != 0) {
        req.addAttribute(MailConstants.A_QUERY_LIMIT, params.getLimit());
    }
    if (params.getOffset() != 0) {
        req.addAttribute(MailConstants.A_QUERY_OFFSET, params.getOffset());
    }
    if (params.getSortBy() != null) {
        req.addAttribute(MailConstants.A_SORTBY, params.getSortBy().name());
    }
    if (params.getTypes() != null) {
        req.addAttribute(MailConstants.A_SEARCH_TYPES, params.getTypes());
    }
    if (params.getFetch() != null && params.getFetch() != Fetch.none) {
        // use "1" for "first" for backward compat until DF is updated
        req.addAttribute(MailConstants.A_FETCH, params.getFetch() == Fetch.first ? "1" : params.getFetch().name());
    }
    if (params.getCalExpandInstStart() != 0) {
        req.addAttribute(MailConstants.A_CAL_EXPAND_INST_START, params.getCalExpandInstStart());
    }
    if (params.getCalExpandInstEnd() != 0) {
        req.addAttribute(MailConstants.A_CAL_EXPAND_INST_END, params.getCalExpandInstEnd());
    }
    if (params.isPreferHtml()) {
        req.addAttribute(MailConstants.A_WANT_HTML, params.isPreferHtml());
    }
    if (params.isMarkAsRead()) {
        req.addAttribute(MailConstants.A_MARK_READ, params.isMarkAsRead());
    }
    if (params.isRecipientMode()) {
        req.addAttribute(MailConstants.A_RECIPIENTS, params.isRecipientMode());
    }
    if (params.getField() != null) {
        req.addAttribute(MailConstants.A_FIELD, params.getField());
    }
    if (params.getInDumpster()) {
        req.addAttribute(MailConstants.A_IN_DUMPSTER, true);
    }
    req.addAttribute(MailConstants.E_QUERY, params.getQuery(), Element.Disposition.CONTENT);
    if (params.getCursor() != null) {
        Cursor cursor = params.getCursor();
        Element cursorEl = req.addElement(MailConstants.E_CURSOR);
        if (cursor.getPreviousId() != null) {
            cursorEl.addAttribute(MailConstants.A_ID, cursor.getPreviousId());
        }
        if (cursor.getPreviousSortValue() != null) {
            cursorEl.addAttribute(MailConstants.A_SORTVAL, cursor.getPreviousSortValue());
        }
    }
    if (params.getTypes().equals(ZSearchParams.TYPE_VOICE_MAIL) || params.getTypes().equals(ZSearchParams.TYPE_CALL)) {
        getAllPhoneAccounts();
        setVoiceStorePrincipal(req);
    }
    Element resp = invoke(req);
    if (params.getTypes().equals(ZSearchParams.TYPE_GAL)) {
        try {
            resp.getAttribute(MailConstants.A_SORTBY);
        } catch (Exception e) {
            resp.addAttribute(MailConstants.A_SORTBY, params.getSortBy().name());
        }
        try {
            resp.getAttribute(MailConstants.A_QUERY_OFFSET);
        } catch (Exception e) {
            resp.addAttribute(MailConstants.A_QUERY_OFFSET, params.getOffset());
        }
    }
    return new ZSearchResult(resp, nest, params.getTimeZone() != null ? params.getTimeZone() : getPrefs().getTimeZone());
}
Also used : QName(org.dom4j.QName) JSONElement(com.zimbra.common.soap.Element.JSONElement) Element(com.zimbra.common.soap.Element) XMLElement(com.zimbra.common.soap.Element.XMLElement) Cursor(com.zimbra.client.ZSearchParams.Cursor) JSONException(org.json.JSONException) SoapFaultException(com.zimbra.common.soap.SoapFaultException) ServiceException(com.zimbra.common.service.ServiceException) IOException(java.io.IOException) ZClientException(com.zimbra.common.zclient.ZClientException) URISyntaxException(java.net.URISyntaxException) RemoteServiceException(com.zimbra.common.service.RemoteServiceException)

Example 44 with Element

use of com.zimbra.common.soap.Element in project zm-mailbox by Zimbra.

the class ZMailbox method sendInviteReply.

public ZSendInviteReplyResult sendInviteReply(String id, String component, ReplyVerb verb, boolean updateOrganizer, ZTimeZone tz, ZDateTime instance, ZOutgoingMessage message) throws ServiceException {
    Element req = newRequestElement(MailConstants.SEND_INVITE_REPLY_REQUEST);
    req.addAttribute(MailConstants.A_ID, id);
    req.addAttribute(MailConstants.A_CAL_COMPONENT_NUM, component);
    req.addAttribute(MailConstants.A_VERB, verb.name());
    req.addAttribute(MailConstants.A_CAL_UPDATE_ORGANIZER, updateOrganizer);
    if (tz != null) {
        tz.toElement(req);
    }
    if (instance != null) {
        instance.toElement(MailConstants.E_CAL_EXCEPTION_ID, req);
    }
    if (message != null) {
        getMessageElement(req, message, null);
    }
    mMessageCache.remove(id);
    return new ZSendInviteReplyResult(invoke(req));
}
Also used : JSONElement(com.zimbra.common.soap.Element.JSONElement) Element(com.zimbra.common.soap.Element) XMLElement(com.zimbra.common.soap.Element.XMLElement)

Example 45 with Element

use of com.zimbra.common.soap.Element in project zm-mailbox by Zimbra.

the class ZMailbox method iCalReply.

/**
     * Sends an iCalendar REPLY object
     * @param ical iCalendar data
     * @throws ServiceException on error
     */
public void iCalReply(String ical, String sender) throws ServiceException {
    Element req = newRequestElement(MailConstants.ICAL_REPLY_REQUEST);
    Element icalElem = req.addUniqueElement(MailConstants.E_CAL_ICAL);
    icalElem.setText(ical);
    if (sender != null) {
        icalElem.addAttribute(MailConstants.E_CAL_ATTENDEE, sender);
    }
    invoke(req);
}
Also used : JSONElement(com.zimbra.common.soap.Element.JSONElement) Element(com.zimbra.common.soap.Element) XMLElement(com.zimbra.common.soap.Element.XMLElement)

Aggregations

Element (com.zimbra.common.soap.Element)980 ZimbraSoapContext (com.zimbra.soap.ZimbraSoapContext)315 XMLElement (com.zimbra.common.soap.Element.XMLElement)269 Account (com.zimbra.cs.account.Account)220 Test (org.junit.Test)175 JSONElement (com.zimbra.common.soap.Element.JSONElement)167 Provisioning (com.zimbra.cs.account.Provisioning)147 Mailbox (com.zimbra.cs.mailbox.Mailbox)138 ServiceException (com.zimbra.common.service.ServiceException)103 ItemId (com.zimbra.cs.service.util.ItemId)81 ArrayList (java.util.ArrayList)81 OperationContext (com.zimbra.cs.mailbox.OperationContext)80 HashMap (java.util.HashMap)77 ItemIdFormatter (com.zimbra.cs.service.util.ItemIdFormatter)56 SoapHttpTransport (com.zimbra.common.soap.SoapHttpTransport)54 Server (com.zimbra.cs.account.Server)49 FilterTest (com.zimbra.soap.mail.type.FilterTest)46 IOException (java.io.IOException)45 XmlAnyElement (javax.xml.bind.annotation.XmlAnyElement)44 XmlElement (javax.xml.bind.annotation.XmlElement)44