Search in sources :

Example 6 with SearchAccountsOptions

use of com.zimbra.cs.account.SearchAccountsOptions in project zm-mailbox by Zimbra.

the class FixCalendarPriority method getAccountsOnServer.

private static List<NamedEntry> getAccountsOnServer() throws ServiceException {
    Provisioning prov = Provisioning.getInstance();
    Server server = prov.getLocalServer();
    String serverName = server.getAttr(Provisioning.A_zimbraServiceHostname);
    SearchAccountsOptions searchOpts = new SearchAccountsOptions(new String[] { Provisioning.A_zimbraId });
    searchOpts.setSortOpt(SortOpt.SORT_DESCENDING);
    List<NamedEntry> accts = prov.searchAccountsOnServer(server, searchOpts);
    ZimbraLog.calendar.info("Found " + accts.size() + " accounts on server " + serverName);
    return accts;
}
Also used : NamedEntry(com.zimbra.cs.account.NamedEntry) SearchAccountsOptions(com.zimbra.cs.account.SearchAccountsOptions) Server(com.zimbra.cs.account.Server) Provisioning(com.zimbra.cs.account.Provisioning)

Example 7 with SearchAccountsOptions

use of com.zimbra.cs.account.SearchAccountsOptions in project zm-mailbox by Zimbra.

the class FixCalendarEndTime method getAccountsOnServer.

private static List<NamedEntry> getAccountsOnServer() throws ServiceException {
    Provisioning prov = Provisioning.getInstance();
    Server server = prov.getLocalServer();
    String serverName = server.getAttr(Provisioning.A_zimbraServiceHostname);
    SearchAccountsOptions searchOpts = new SearchAccountsOptions(new String[] { Provisioning.A_zimbraId });
    searchOpts.setSortOpt(SortOpt.SORT_DESCENDING);
    List<NamedEntry> accts = prov.searchAccountsOnServer(server, searchOpts);
    ZimbraLog.calendar.info("Found " + accts.size() + " accounts on server " + serverName);
    return accts;
}
Also used : NamedEntry(com.zimbra.cs.account.NamedEntry) SearchAccountsOptions(com.zimbra.cs.account.SearchAccountsOptions) Server(com.zimbra.cs.account.Server) Provisioning(com.zimbra.cs.account.Provisioning)

Example 8 with SearchAccountsOptions

use of com.zimbra.cs.account.SearchAccountsOptions in project zm-mailbox by Zimbra.

the class LdapProvisioning method getAllCalendarResources.

@Override
public void getAllCalendarResources(Domain domain, Server server, NamedEntry.Visitor visitor) throws ServiceException {
    if (server != null) {
        SearchAccountsOptions searchOpts = new SearchAccountsOptions(domain);
        searchOpts.setIncludeType(IncludeType.CALENDAR_RESOURCES_ONLY);
        searchAccountsOnServerInternal(server, searchOpts, visitor);
    } else {
        getAllCalendarResources(domain, visitor);
    }
}
Also used : SearchAccountsOptions(com.zimbra.cs.account.SearchAccountsOptions)

Example 9 with SearchAccountsOptions

use of com.zimbra.cs.account.SearchAccountsOptions in project zm-mailbox by Zimbra.

the class LdapProvisioning method getAllAdminAccounts.

@SuppressWarnings("unchecked")
@Override
public List<Account> getAllAdminAccounts() throws ServiceException {
    SearchAccountsOptions opts = new SearchAccountsOptions();
    opts.setFilter(filterFactory.allAdminAccounts());
    opts.setIncludeType(IncludeType.ACCOUNTS_ONLY);
    opts.setSortOpt(SortOpt.SORT_ASCENDING);
    return (List<Account>) searchDirectoryInternal(opts);
}
Also used : SearchAccountsOptions(com.zimbra.cs.account.SearchAccountsOptions) LdapDistributionList(com.zimbra.cs.account.ldap.entry.LdapDistributionList) ArrayList(java.util.ArrayList) List(java.util.List) AddressList(com.zimbra.cs.account.AddressList) DistributionList(com.zimbra.cs.account.DistributionList)

Example 10 with SearchAccountsOptions

use of com.zimbra.cs.account.SearchAccountsOptions in project zm-mailbox by Zimbra.

the class LdapProvisioning method getAllAccounts.

@Override
public List<?> getAllAccounts(Domain domain) throws ServiceException {
    SearchAccountsOptions opts = new SearchAccountsOptions(domain);
    opts.setFilter(filterFactory.allAccountsOnly());
    opts.setIncludeType(IncludeType.ACCOUNTS_ONLY);
    opts.setSortOpt(SortOpt.SORT_ASCENDING);
    return searchDirectory(opts);
}
Also used : SearchAccountsOptions(com.zimbra.cs.account.SearchAccountsOptions)

Aggregations

SearchAccountsOptions (com.zimbra.cs.account.SearchAccountsOptions)19 NamedEntry (com.zimbra.cs.account.NamedEntry)12 Account (com.zimbra.cs.account.Account)9 ProvTest (com.zimbra.qa.unittest.prov.ProvTest)7 Provisioning (com.zimbra.cs.account.Provisioning)5 ZLdapFilter (com.zimbra.cs.ldap.ZLdapFilter)5 Server (com.zimbra.cs.account.Server)4 ServiceException (com.zimbra.common.service.ServiceException)3 AccountServiceException (com.zimbra.cs.account.AccountServiceException)3 Domain (com.zimbra.cs.account.Domain)3 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 List (java.util.List)2 ZMailbox (com.zimbra.client.ZMailbox)1 ZMountpoint (com.zimbra.client.ZMountpoint)1 Element (com.zimbra.common.soap.Element)1 AddressList (com.zimbra.cs.account.AddressList)1 AuthTokenException (com.zimbra.cs.account.AuthTokenException)1 CalendarResource (com.zimbra.cs.account.CalendarResource)1 DistributionList (com.zimbra.cs.account.DistributionList)1