Search in sources :

Example 6 with Element

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

the class ZDateTime method toElement.

public Element toElement(String name, Element parent) {
    Element dtEl = parent.addElement(name);
    dtEl.addAttribute(MailConstants.A_CAL_DATETIME, mDateTime);
    if (mTimeZoneId != null)
        dtEl.addAttribute(MailConstants.A_CAL_TIMEZONE, mTimeZoneId);
    return dtEl;
}
Also used : Element(com.zimbra.common.soap.Element)

Example 7 with Element

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

the class ZCalDataSource method toIdElement.

public Element toIdElement(Element parent) {
    Element src = parent.addElement(MailConstants.E_DS_CAL);
    src.addAttribute(MailConstants.A_ID, getId());
    return src;
}
Also used : Element(com.zimbra.common.soap.Element)

Example 8 with Element

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

the class ZCalDataSource method toElement.

public Element toElement(Element parent) {
    Element src = parent.addElement(MailConstants.E_DS_CAL);
    src.addAttribute(MailConstants.A_ID, data.getId());
    src.addAttribute(MailConstants.A_NAME, data.getName());
    src.addAttribute(MailConstants.A_DS_IS_ENABLED, data.isEnabled());
    src.addAttribute(MailConstants.A_FOLDER, data.getFolderId());
    return src;
}
Also used : Element(com.zimbra.common.soap.Element)

Example 9 with Element

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

the class ZMailbox method createDataSource.

/**
     * Creates a data source.
     *
     * @return the new data source id
     */
public String createDataSource(ZDataSource source) throws ServiceException {
    Element req = newRequestElement(MailConstants.CREATE_DATA_SOURCE_REQUEST);
    source.toElement(req);
    return invoke(req).listElements().get(0).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)

Example 10 with Element

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

the class ZMailbox method createMountpoint.

/**
     * create a new mountpoint in the specified parent folder.
     *
     * @param parentId parent folder id
     * @param name name of new folder
     * @param defaultView default view of new folder.
     * @param color
     * @param flags
     * @param ownerBy used to specify whether owner is an id or account name (email address)
     * @param owner either the id or name of the owner
     * @param itemBy used to specify whether sharedItem is an id or path to the shared item
     * @param sharedItem either the id or path of the item
     * @param reminderEnabled whether client should show reminders on appointments/tasks
     *
     * @return newly created folder
     * @throws ServiceException on error
     * @param color initial color
     * @param flags initial flags
     */
public ZMountpoint createMountpoint(String parentId, String name, ZFolder.View defaultView, ZFolder.Color color, String flags, OwnerBy ownerBy, String owner, SharedItemBy itemBy, String sharedItem, boolean reminderEnabled) throws ServiceException {
    Element req = newRequestElement(MailConstants.CREATE_MOUNTPOINT_REQUEST);
    Element linkEl = req.addUniqueElement(MailConstants.E_MOUNT);
    linkEl.addAttribute(MailConstants.A_NAME, name);
    linkEl.addAttribute(MailConstants.A_FOLDER, parentId);
    if (defaultView != null) {
        linkEl.addAttribute(MailConstants.A_DEFAULT_VIEW, defaultView.name());
    }
    if (color != null) {
        if (StringUtil.equal(color.getName(), Color.RGBCOLOR)) {
            linkEl.addAttribute(MailConstants.A_RGB, color.getRgbColorValue());
        } else {
            linkEl.addAttribute(MailConstants.A_COLOR, color.getValue());
        }
    }
    if (flags != null) {
        linkEl.addAttribute(MailConstants.A_FLAGS, flags);
    }
    linkEl.addAttribute(ownerBy == OwnerBy.BY_ID ? MailConstants.A_ZIMBRA_ID : MailConstants.A_OWNER_NAME, owner);
    linkEl.addAttribute(itemBy == SharedItemBy.BY_ID ? MailConstants.A_REMOTE_ID : MailConstants.A_PATH, sharedItem);
    linkEl.addAttribute(MailConstants.A_REMINDER, reminderEnabled);
    Element newMountEl = invoke(req).getElement(MailConstants.E_MOUNT);
    ZMountpoint newMount = getMountpointById(newMountEl.getAttribute(MailConstants.A_ID));
    return newMount != null ? newMount : new ZMountpoint(newMountEl, null, this);
}
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