Search in sources :

Example 96 with XMLElement

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

the class SoapDomain method modifyAttrs.

public void modifyAttrs(SoapProvisioning prov, Map<String, ? extends Object> attrs, boolean checkImmutable) throws ServiceException {
    XMLElement req = new XMLElement(AdminConstants.MODIFY_DOMAIN_REQUEST);
    req.addElement(AdminConstants.E_ID).setText(getId());
    SoapProvisioning.addAttrElements(req, attrs);
    setAttrs(SoapProvisioning.getAttrs(prov.invoke(req).getElement(AdminConstants.E_DOMAIN)));
}
Also used : XMLElement(com.zimbra.common.soap.Element.XMLElement)

Example 97 with XMLElement

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

the class SoapProvisioning method getCreateObjectAttrs.

@Override
public RightCommand.EffectiveRights getCreateObjectAttrs(String targetType, DomainBy domainBy, String domain, CosBy cosBy, String cos, GranteeBy granteeBy, String grantee) throws ServiceException {
    XMLElement req = new XMLElement(AdminConstants.GET_CREATE_OBJECT_ATTRS_REQUEST);
    Element eTarget = req.addElement(AdminConstants.E_TARGET);
    eTarget.addAttribute(AdminConstants.A_TYPE, targetType);
    if (domainBy != null && domain != null) {
        Element eDomain = req.addElement(AdminConstants.E_DOMAIN);
        eDomain.addAttribute(AdminConstants.A_BY, domainBy.toString());
        eDomain.setText(domain);
    }
    if (cosBy != null && cos != null) {
        Element eCos = req.addElement(AdminConstants.E_COS);
        eCos.addAttribute(AdminConstants.A_BY, cosBy.toString());
        eCos.setText(cos);
    }
    /*
        if (granteeBy != null && grantee != null)
            toXML(req, null, granteeBy, grantee);
        */
    Element resp = invoke(req);
    return RightCommand.EffectiveRights.fromXML_CreateObjectAttrs(resp);
}
Also used : Element(com.zimbra.common.soap.Element) XMLElement(com.zimbra.common.soap.Element.XMLElement) XMLElement(com.zimbra.common.soap.Element.XMLElement)

Example 98 with XMLElement

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

the class BlobConsistencyUtil method getAllMailboxIds.

private List<Integer> getAllMailboxIds(SoapProvisioning prov) throws ServiceException {
    List<Integer> ids = new ArrayList<Integer>();
    XMLElement request = new XMLElement(AdminConstants.GET_ALL_MAILBOXES_REQUEST);
    Element response = prov.invoke(request);
    for (Element mboxEl : response.listElements(AdminConstants.E_MAILBOX)) {
        ids.add((int) mboxEl.getAttributeLong(AdminConstants.A_ID));
    }
    return ids;
}
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)

Example 99 with XMLElement

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

the class SoapProvisioning method soapAdminAuthenticate.

public void soapAdminAuthenticate(ZAuthToken zat) throws ServiceException {
    // TODO: Do we need 3rd party AuthToken support in JAXB before we can migrate to JAXB?
    if (mTransport == null)
        throw ZClientException.CLIENT_ERROR("must call setURI before calling adminAuthenticate", null);
    XMLElement req = new XMLElement(AdminConstants.AUTH_REQUEST);
    zat.encodeAuthReq(req, true);
    Element response = invoke(req);
    mAuthToken = new ZAuthToken(response.getElement(AdminConstants.E_AUTH_TOKEN), true);
    mAuthTokenLifetime = response.getAttributeLong(AdminConstants.E_LIFETIME);
    mAuthTokenExpiration = System.currentTimeMillis() + mAuthTokenLifetime;
    mTransport.setAuthToken(mAuthToken);
}
Also used : Element(com.zimbra.common.soap.Element) XMLElement(com.zimbra.common.soap.Element.XMLElement) XMLElement(com.zimbra.common.soap.Element.XMLElement) ZAuthToken(com.zimbra.common.auth.ZAuthToken)

Example 100 with XMLElement

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

the class SoapProvisioning method preAuthAccount.

@Override
public void preAuthAccount(Account acct, String accountName, String accountBy, long timestamp, long expires, String preAuth, Map<String, Object> authCtxt) throws ServiceException {
    XMLElement req = new XMLElement(AccountConstants.AUTH_REQUEST);
    Element a = req.addElement(AccountConstants.E_ACCOUNT);
    a.addAttribute(AccountConstants.A_BY, "name");
    a.setText(accountName);
    Element p = req.addElement(AccountConstants.E_PREAUTH);
    p.addAttribute(AccountConstants.A_TIMESTAMP, timestamp);
    p.addAttribute(AccountConstants.A_BY, accountBy);
    p.addAttribute(AccountConstants.A_EXPIRES, expires);
    p.setText(preAuth);
    invoke(req);
}
Also used : Element(com.zimbra.common.soap.Element) XMLElement(com.zimbra.common.soap.Element.XMLElement) 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