Search in sources :

Example 71 with Element

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

the class ZMailbox method sendMessage.

public ZSendMessageResponse sendMessage(ZOutgoingMessage message, String sendUid, boolean needCalendarSentByFixup) throws ServiceException {
    Element req = newRequestElement(MailConstants.SEND_MSG_REQUEST);
    if (sendUid != null && sendUid.length() > 0) {
        req.addAttribute(MailConstants.A_SEND_UID, sendUid);
    }
    if (needCalendarSentByFixup) {
        req.addAttribute(MailConstants.A_NEED_CALENDAR_SENTBY_FIXUP, needCalendarSentByFixup);
    }
    ZMountpoint mountpoint = getMountpoint(message);
    //noinspection UnusedDeclaration
    getMessageElement(req, message, mountpoint);
    String requestedAccountId = mountpoint == null ? null : mountpoint.getOwnerId();
    Element resp = invoke(req, requestedAccountId);
    Element msg = resp.getOptionalElement(MailConstants.E_MSG);
    String id = msg == null ? null : msg.getAttribute(MailConstants.A_ID, null);
    return new ZSendMessageResponse(id);
}
Also used : JSONElement(com.zimbra.common.soap.Element.JSONElement) Element(com.zimbra.common.soap.Element) XMLElement(com.zimbra.common.soap.Element.XMLElement)

Example 72 with Element

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

the class ZShare method toElement.

public Element toElement(Element parent) {
    Element e = parent.addElement(E_SHARE);
    e.addAttribute(A_VERSION, mVersion);
    e.addAttribute(A_ACTION, mAction.toString());
    if (mGrantee != null)
        mGrantee.toElement(e);
    if (mGrantor != null)
        mGrantor.toElement(e);
    if (mLink != null)
        return mLink.toElement(e);
    return e;
}
Also used : Element(com.zimbra.common.soap.Element)

Example 73 with Element

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

the class ZSearchResult method init.

private void init(Element resp, Element el, TimeZone tz) throws ServiceException {
    sortBy = resp.getAttribute(MailConstants.A_SORTBY);
    hasMore = resp.getAttributeBool(MailConstants.A_QUERY_MORE);
    offset = (int) resp.getAttributeLong(MailConstants.A_QUERY_OFFSET, -1);
    hits = new ArrayList<ZSearchHit>();
    for (Element h : el.listElements()) {
        if (h.getName().equals(MailConstants.E_CONV)) {
            hits.add(new ZConversationHit(h));
        } else if (h.getName().equals(MailConstants.E_MSG)) {
            hits.add(new ZMessageHit(h));
        } else if (h.getName().equals(MailConstants.E_CONTACT)) {
            hits.add(new ZContactHit(h));
        } else if (h.getName().equals(MailConstants.E_APPOINTMENT)) {
            ZAppointmentHit.addInstances(h, hits, tz, false);
        } else if (h.getName().equals(MailConstants.E_TASK)) {
            ZAppointmentHit.addInstances(h, hits, tz, true);
        } else if (h.getName().equals(MailConstants.E_DOC)) {
            hits.add(new ZDocumentHit(h));
        } else if (h.getName().equals(MailConstants.E_WIKIWORD)) {
            hits.add(new ZWikiHit(h));
        } else if (h.getName().equals(VoiceConstants.E_VOICEMSG)) {
            hits.add(new ZVoiceMailItemHit(h));
        } else if (h.getName().equals(VoiceConstants.E_CALLLOG)) {
            hits.add(new ZCallHit(h));
        }
    }
}
Also used : Element(com.zimbra.common.soap.Element)

Example 74 with Element

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

the class ZSelectiveCallForwarding method fromElement.

synchronized void fromElement(Element element) throws ServiceException {
    super.fromElement(element);
    mForwardFrom = new ArrayList<String>();
    for (Element fromEl : element.listElements(VoiceConstants.E_PHONE)) {
        mForwardFrom.add(fromEl.getAttribute(VoiceConstants.A_PHONE_NUMBER));
    }
}
Also used : Element(com.zimbra.common.soap.Element)

Example 75 with Element

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

the class ZSelectiveCallForwarding method toElement.

void toElement(Element element) throws ServiceException {
    super.toElement(element);
    for (String name : mForwardFrom) {
        Element fromEl = element.addElement(VoiceConstants.E_PHONE);
        fromEl.addAttribute(VoiceConstants.A_PHONE_NUMBER, name);
        fromEl.addAttribute(VoiceConstants.A_ACTIVE, "true");
    }
}
Also used : Element(com.zimbra.common.soap.Element)

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