Search in sources :

Example 51 with Element

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

the class ZMailbox method itemAction.

// ------------------------
private Element itemAction(String op, String id, String constraints) {
    Element req = newRequestElement(MailConstants.ITEM_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 52 with Element

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

the class ZMailbox method createTaskException.

public ZAppointmentResult createTaskException(String id, String component, ZDateTime exceptionId, ZOutgoingMessage message, ZInvite invite, String optionalUid) throws ServiceException {
    Element req = newRequestElement(MailConstants.CREATE_TASK_EXCEPTION_REQUEST);
    req.addAttribute(MailConstants.A_ID, id);
    req.addAttribute(MailConstants.E_INVITE_COMPONENT, component);
    Element mEl = getMessageElement(req, message, null);
    Element invEl = invite.toElement(mEl);
    Element compEl = invEl.getElement(MailConstants.E_INVITE_COMPONENT);
    exceptionId.toElement(MailConstants.E_CAL_EXCEPTION_ID, compEl);
    if (optionalUid != null) {
        invEl.addAttribute(MailConstants.A_UID, optionalUid);
    }
    return new ZAppointmentResult(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 53 with Element

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

the class ZMailbox method refreshVoiceMailInbox.

/** Makes a server call to get updated message/unheard counts for the folders */
private void refreshVoiceMailInbox(String phone) throws ServiceException {
    ZPhoneAccount account = getPhoneAccount(phone);
    if (account == null) {
        return;
    }
    Element req = newRequestElement(VoiceConstants.GET_VOICE_FOLDER_REQUEST);
    setVoiceStorePrincipal(req);
    Element phoneEl = req.addElement(VoiceConstants.E_PHONE);
    phoneEl.addAttribute(MailConstants.A_NAME, phone);
    Element response = invoke(req);
    Element phoneResponse = response.getElement(VoiceConstants.E_PHONE);
    if (phoneResponse != null) {
        ZFolder rootFolder = account.getRootFolder();
        Element rootEl = phoneResponse.getElement(MailConstants.E_FOLDER);
        for (Element childEl : rootEl.listElements(MailConstants.E_FOLDER)) {
            String name = childEl.getAttribute(MailConstants.A_NAME);
            ZFolder childFolder = rootFolder.getSubFolderByPath(name);
            if (childFolder != null) {
                childFolder.setUnreadCount((int) childEl.getAttributeLong(MailConstants.A_UNREAD, 0));
                childFolder.setMessageCount((int) childEl.getAttributeLong(MailConstants.A_NUM, 0));
            }
        }
    }
}
Also used : JSONElement(com.zimbra.common.soap.Element.JSONElement) Element(com.zimbra.common.soap.Element) XMLElement(com.zimbra.common.soap.Element.XMLElement)

Example 54 with Element

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

the class ZMailbox method folderAction.

private Element folderAction(String op, String ids) {
    Element req = newRequestElement(MailConstants.FOLDER_ACTION_REQUEST);
    Element actionEl = req.addUniqueElement(MailConstants.E_ACTION);
    actionEl.addAttribute(MailConstants.A_ID, ids);
    actionEl.addAttribute(MailConstants.A_OPERATION, op);
    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 55 with Element

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

the class ZMailbox method createAppointment.

public ZAppointmentResult createAppointment(String folderId, String flags, ZOutgoingMessage message, ZInvite invite, String optionalUid) throws ServiceException {
    Element req = newRequestElement(MailConstants.CREATE_APPOINTMENT_REQUEST);
    //noinspection UnusedDeclaration
    Element mEl = getMessageElement(req, message, null);
    if (flags != null) {
        mEl.addAttribute(MailConstants.A_FLAGS, flags);
    }
    if (folderId != null) {
        mEl.addAttribute(MailConstants.A_FOLDER, folderId);
    }
    Element invEl = invite.toElement(mEl);
    if (optionalUid != null) {
        invEl.addAttribute(MailConstants.A_UID, optionalUid);
    }
    return new ZAppointmentResult(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