Search in sources :

Example 56 with XMLElement

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

the class TestAccess method CreateSignature.

public void CreateSignature(Role role, Perm perm) throws Exception {
    String signatureName = "signature-create-" + random();
    XMLElement req = new XMLElement(AccountConstants.CREATE_SIGNATURE_REQUEST);
    Element signature = req.addElement(AccountConstants.E_SIGNATURE);
    signature.addAttribute(AccountConstants.A_NAME, signatureName);
    accessTest(role, perm, req);
}
Also used : XMLElement(com.zimbra.common.soap.Element.XMLElement) Element(com.zimbra.common.soap.Element) XMLElement(com.zimbra.common.soap.Element.XMLElement)

Example 57 with XMLElement

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

the class TestAccess method GetAvailableSkins.

public void GetAvailableSkins(Role role, Perm perm) throws Exception {
    XMLElement req = new XMLElement(AccountConstants.GET_AVAILABLE_SKINS_REQUEST);
    accessTest(role, perm, req);
}
Also used : XMLElement(com.zimbra.common.soap.Element.XMLElement)

Example 58 with XMLElement

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

the class TestAccess method ModifyPrefs.

public void ModifyPrefs(Role role, Perm perm) throws Exception {
    XMLElement req = new XMLElement(AccountConstants.MODIFY_PREFS_REQUEST);
    Element p = req.addElement(AccountConstants.E_PREF);
    p.addAttribute(AccountConstants.A_NAME, Provisioning.A_zimbraPrefSkin);
    p.setText("beach");
    accessTest(role, perm, req);
}
Also used : XMLElement(com.zimbra.common.soap.Element.XMLElement) Element(com.zimbra.common.soap.Element) XMLElement(com.zimbra.common.soap.Element.XMLElement)

Example 59 with XMLElement

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

the class GalSyncAccountUtil method syncGalAccount.

private void syncGalAccount() throws ServiceException, IOException {
    checkArgs();
    mTransport = null;
    try {
        mTransport = new SoapHttpTransport(mAdminURL);
        auth();
        mTransport.setAuthToken(mAuth);
        XMLElement req = new XMLElement(AdminConstants.SYNC_GAL_ACCOUNT_REQUEST);
        Element acct = req.addElement(AdminConstants.E_ACCOUNT);
        acct.addAttribute(AdminConstants.A_ID, mAccountId);
        Element ds = acct.addElement(AdminConstants.E_DATASOURCE);
        if (mDataSourceId != null)
            ds.addAttribute(AdminConstants.A_BY, "id").setText(mDataSourceId);
        else
            ds.addAttribute(AdminConstants.A_BY, "name").setText(mDataSourceName);
        if (mFullSync)
            ds.addAttribute(AdminConstants.A_FULLSYNC, "TRUE");
        if (mForceSync)
            ds.addAttribute(AdminConstants.A_RESET, "TRUE");
        mTransport.invoke(req);
    } finally {
        if (mTransport != null)
            mTransport.shutdown();
    }
}
Also used : XMLElement(com.zimbra.common.soap.Element.XMLElement) Element(com.zimbra.common.soap.Element) SoapHttpTransport(com.zimbra.common.soap.SoapHttpTransport) XMLElement(com.zimbra.common.soap.Element.XMLElement)

Example 60 with XMLElement

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

the class GalSyncAccountUtil method addGalSyncDataSource.

private Element addGalSyncDataSource(String accountName, String dsName, String domain, String type, String folder, String pollingInterval) throws ServiceException, IOException {
    mTransport = null;
    try {
        mTransport = new SoapHttpTransport(mAdminURL);
        auth();
        mTransport.setAuthToken(mAuth);
        XMLElement req = new XMLElement(AdminConstants.ADD_GAL_SYNC_DATASOURCE_REQUEST);
        req.addAttribute(AdminConstants.A_NAME, dsName);
        req.addAttribute(AdminConstants.A_DOMAIN, domain);
        req.addAttribute(AdminConstants.A_TYPE, type);
        if (folder != null)
            req.addAttribute(AdminConstants.E_FOLDER, folder);
        Element acct = req.addElement(AdminConstants.E_ACCOUNT);
        acct.addAttribute(AdminConstants.A_BY, AccountBy.name.name());
        acct.setText(accountName);
        if (pollingInterval != null)
            req.addElement(AdminConstants.E_A).addAttribute(AdminConstants.A_N, Provisioning.A_zimbraDataSourcePollingInterval).setText(pollingInterval);
        return mTransport.invokeWithoutSession(req);
    } finally {
        if (mTransport != null)
            mTransport.shutdown();
    }
}
Also used : XMLElement(com.zimbra.common.soap.Element.XMLElement) Element(com.zimbra.common.soap.Element) SoapHttpTransport(com.zimbra.common.soap.SoapHttpTransport) 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