Search in sources :

Example 66 with Element

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

the class ZMailbox method getAvailableSkins.

public List<String> getAvailableSkins() throws ServiceException {
    Element req = newRequestElement(AccountConstants.GET_AVAILABLE_SKINS_REQUEST);
    Element resp = invoke(req);
    List<String> result = new ArrayList<String>();
    for (Element skin : resp.listElements(AccountConstants.E_SKIN)) {
        String name = skin.getAttribute(AccountConstants.A_NAME, null);
        if (name != null) {
            result.add(name);
        }
    }
    Collections.sort(result);
    return result;
}
Also used : JSONElement(com.zimbra.common.soap.Element.JSONElement) Element(com.zimbra.common.soap.Element) XMLElement(com.zimbra.common.soap.Element.XMLElement) ArrayList(java.util.ArrayList)

Example 67 with Element

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

the class ZMailbox method invokeJaxbOnTargetAccount.

@SuppressWarnings("unchecked")
public <T> T invokeJaxbOnTargetAccount(Object jaxbObject, String requestedAccountId) throws ServiceException {
    Element req = JaxbUtil.jaxbToElement(jaxbObject);
    Element res = invoke(req, requestedAccountId);
    return (T) JaxbUtil.elementToJaxb(res);
}
Also used : JSONElement(com.zimbra.common.soap.Element.JSONElement) Element(com.zimbra.common.soap.Element) XMLElement(com.zimbra.common.soap.Element.XMLElement)

Example 68 with Element

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

the class ZMailbox method deleteSignature.

public synchronized void deleteSignature(String id) throws ServiceException {
    Element req = newRequestElement(AccountConstants.DELETE_SIGNATURE_REQUEST);
    req.addElement(AccountConstants.E_SIGNATURE).addAttribute(AccountConstants.A_ID, id);
    invoke(req);
    updateSigs();
}
Also used : JSONElement(com.zimbra.common.soap.Element.JSONElement) Element(com.zimbra.common.soap.Element) XMLElement(com.zimbra.common.soap.Element.XMLElement)

Example 69 with Element

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

the class ZMailbox method getAppointment.

public ZAppointment getAppointment(String id) throws ServiceException {
    Element req = newRequestElement(MailConstants.GET_APPOINTMENT_REQUEST);
    req.addAttribute(MailConstants.A_ID, id);
    req.addAttribute(MailConstants.A_SYNC, true);
    return new ZAppointment(invoke(req).getElement(MailConstants.E_APPOINTMENT));
}
Also used : JSONElement(com.zimbra.common.soap.Element.JSONElement) Element(com.zimbra.common.soap.Element) XMLElement(com.zimbra.common.soap.Element.XMLElement)

Example 70 with Element

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

the class ZMailbox method addMessage.

/**
     * @param folderId (required) folderId of folder to add message to
     * @param flags non-comma-separated list of flags, e.g. "sf" for "sent by me and flagged",
     *        or <tt>null</tt>
     * @param tags coma-spearated list of tags, or null for no tags, or <tt>null</tt>
     * @param receivedDate time the message was originally received, in MILLISECONDS since the epoch,
     *        or <tt>0</tt> for the current time
     * @param content message content
     * @param noICal if TRUE, then don't process iCal attachments.
     * @param filterSent if TRUE, then do outgoing message filtering
     * @return ID of newly created message
     * @throws com.zimbra.common.service.ServiceException on error
     */
public String addMessage(String folderId, String flags, String tags, long receivedDate, String content, boolean noICal, boolean filterSent) throws ServiceException {
    Element req = newRequestElement(MailConstants.ADD_MSG_REQUEST);
    if (filterSent) {
        req.addAttribute(MailConstants.A_FILTER_SENT, filterSent);
    }
    Element m = req.addUniqueElement(MailConstants.E_MSG);
    m.addAttribute(MailConstants.A_FOLDER, folderId);
    if (flags != null && flags.length() > 0) {
        m.addAttribute(MailConstants.A_FLAGS, flags);
    }
    if (tags != null && tags.length() > 0) {
        m.addAttribute(MailConstants.A_TAGS, tags);
    }
    if (receivedDate != 0) {
        m.addAttribute(MailConstants.A_DATE, receivedDate);
    }
    m.addAttribute(MailConstants.A_NO_ICAL, noICal);
    m.addElement(MailConstants.E_CONTENT).setText(content);
    return invoke(req).getElement(MailConstants.E_MSG).getAttribute(MailConstants.A_ID);
}
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