Search in sources :

Example 71 with XMLElement

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

the class SoapUCService method reload.

public void reload(SoapProvisioning prov) throws ServiceException {
    XMLElement req = new XMLElement(AdminConstants.GET_UC_SERVICE_REQUEST);
    Element a = req.addElement(AdminConstants.E_UC_SERVICE);
    a.setText(getId());
    a.addAttribute(AdminConstants.A_BY, Key.UCServiceBy.id.name());
    setAttrs(SoapProvisioning.getAttrs(prov.invoke(req).getElement(AdminConstants.E_UC_SERVICE)));
}
Also used : XMLElement(com.zimbra.common.soap.Element.XMLElement) Element(com.zimbra.common.soap.Element) XMLElement(com.zimbra.common.soap.Element.XMLElement)

Example 72 with XMLElement

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

the class SoapProvisioning method delegateAuth.

public DelegateAuthResponse delegateAuth(AccountBy keyType, String key, int durationSeconds) throws ServiceException {
    XMLElement req = new XMLElement(AdminConstants.DELEGATE_AUTH_REQUEST);
    req.addAttribute(AdminConstants.A_DURATION, durationSeconds);
    Element acct = req.addElement(AdminConstants.E_ACCOUNT);
    acct.addAttribute(AccountConstants.A_BY, keyType.name());
    acct.setText(key);
    return new DelegateAuthResponse(invoke(req));
}
Also used : Element(com.zimbra.common.soap.Element) XMLElement(com.zimbra.common.soap.Element.XMLElement) XMLElement(com.zimbra.common.soap.Element.XMLElement)

Example 73 with XMLElement

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

the class SoapProvisioning method deleteXMPPComponent.

@Override
public void deleteXMPPComponent(XMPPComponent comp) throws ServiceException {
    XMLElement req = new XMLElement(AdminConstants.DELETE_XMPPCOMPONENT_REQUEST);
    Element c = req.addElement(AccountConstants.E_XMPP_COMPONENT);
    c.addAttribute(AdminConstants.A_BY, "id");
    c.setText(comp.getId());
    invoke(req);
}
Also used : Element(com.zimbra.common.soap.Element) XMLElement(com.zimbra.common.soap.Element.XMLElement) XMLElement(com.zimbra.common.soap.Element.XMLElement)

Example 74 with XMLElement

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

the class SoapProvisioning method searchGal.

public SearchGalResult searchGal(Domain d, String query, GalSearchType type, String token, int limit, int offset, String sortBy) throws ServiceException {
    String typeStr = type == null ? GalSearchType.all.name() : type.name();
    XMLElement req = new XMLElement(AdminConstants.SEARCH_GAL_REQUEST);
    req.addElement(AdminConstants.E_NAME).setText(query);
    req.addAttribute(AdminConstants.A_DOMAIN, d.getName());
    req.addAttribute(AdminConstants.A_TYPE, typeStr);
    if (limit > 0)
        req.addAttribute(AdminConstants.A_LIMIT, limit);
    if (offset > 0)
        req.addAttribute(AdminConstants.A_OFFSET, limit);
    if (sortBy != null)
        req.addAttribute(AdminConstants.A_SORT_BY, sortBy);
    if (token != null)
        req.addAttribute(AdminConstants.A_TOKEN, token);
    Element resp = invoke(req);
    SearchGalResult result = SearchGalResult.newSearchGalResult(null);
    result.setToken(resp.getAttribute(AdminConstants.A_TOKEN, null));
    result.setHadMore(resp.getAttributeBool(AdminConstants.A_MORE, false));
    result.setTokenizeKey(resp.getAttribute(AccountConstants.A_TOKENIZE_KEY, null));
    for (Element e : resp.listElements(AdminConstants.E_CN)) {
        result.addMatch(new GalContact(e.getAttribute(AdminConstants.A_ID), getAttrs(e)));
    }
    return result;
}
Also used : GalContact(com.zimbra.cs.account.GalContact) Element(com.zimbra.common.soap.Element) XMLElement(com.zimbra.common.soap.Element.XMLElement) XMLElement(com.zimbra.common.soap.Element.XMLElement)

Example 75 with XMLElement

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

the class FbCli method getFreeBusyQueueInfo.

public Collection<FbQueue> getFreeBusyQueueInfo(String provider) throws ServiceException, IOException {
    ArrayList<FbQueue> queues = new ArrayList<FbQueue>();
    try {
        auth();
        XMLElement req = new XMLElement(AdminConstants.GET_FREE_BUSY_QUEUE_INFO_REQUEST);
        if (provider != null)
            req.addElement(AdminConstants.E_PROVIDER).addAttribute(AdminConstants.A_NAME, provider);
        Element resp = mTransport.invoke(req);
        for (Element provElem : resp.listElements(AdminConstants.E_PROVIDER)) {
            FbQueue queue = new FbQueue();
            queue.name = provElem.getAttribute(AdminConstants.A_NAME, null);
            for (Element acctElem : provElem.listElements(AdminConstants.E_ACCOUNT)) {
                queue.accounts.add(acctElem.getAttribute(AdminConstants.A_ID, null));
            }
            queues.add(queue);
        }
    } finally {
        mTransport.shutdown();
    }
    return queues;
}
Also used : XMLElement(com.zimbra.common.soap.Element.XMLElement) Element(com.zimbra.common.soap.Element) ArrayList(java.util.ArrayList) XMLElement(com.zimbra.common.soap.Element.XMLElement)

Aggregations

XMLElement (com.zimbra.common.soap.Element.XMLElement)140 Element (com.zimbra.common.soap.Element)111 Test (org.junit.Test)30 JSONElement (com.zimbra.common.soap.Element.JSONElement)29 XmlAnyElement (javax.xml.bind.annotation.XmlAnyElement)25 XmlElement (javax.xml.bind.annotation.XmlElement)25 FilterTest (com.zimbra.soap.mail.type.FilterTest)24 SoapHttpTransport (com.zimbra.common.soap.SoapHttpTransport)9 HashMap (java.util.HashMap)8 Account (com.zimbra.cs.account.Account)6 ArrayList (java.util.ArrayList)6 ZAuthToken (com.zimbra.common.auth.ZAuthToken)5 KeyValuePair (com.zimbra.soap.type.KeyValuePair)5 ByteBuilder (com.zimbra.common.mime.HeaderUtils.ByteBuilder)4 ServiceException (com.zimbra.common.service.ServiceException)4 DataSource (com.zimbra.cs.account.DataSource)4 Auth (com.zimbra.cs.service.account.Auth)4 URL (java.net.URL)4 Cookie (javax.servlet.http.Cookie)4 Signature (com.zimbra.cs.account.Signature)3