use of com.zimbra.cs.ldap.ZSearchResultEnumeration in project zm-mailbox by Zimbra.
the class LdapProvisioning method getAllUCServices.
@Override
public List<UCService> getAllUCServices() throws ServiceException {
List<UCService> result = new ArrayList<UCService>();
ZLdapFilter filter = filterFactory.allUCServices();
try {
ZSearchResultEnumeration ne = helper.searchDir(mDIT.ucServiceBaseDN(), filter, ZSearchControls.SEARCH_CTLS_SUBTREE());
while (ne.hasMore()) {
ZSearchResultEntry sr = ne.next();
LdapUCService s = new LdapUCService(sr.getDN(), sr.getAttributes(), this);
result.add(s);
}
ne.close();
} catch (ServiceException e) {
throw ServiceException.FAILURE("unable to list all servers", e);
}
if (result.size() > 0) {
ucServiceCache.put(result, true);
}
Collections.sort(result);
return result;
}
use of com.zimbra.cs.ldap.ZSearchResultEnumeration in project zm-mailbox by Zimbra.
the class LdapProvisioning method getSignaturesByQuery.
private List<Signature> getSignaturesByQuery(Account acct, LdapEntry entry, ZLdapFilter filter, ZLdapContext initZlc, List<Signature> result) throws ServiceException {
if (result == null) {
result = new ArrayList<Signature>();
}
try {
String base = entry.getDN();
ZSearchResultEnumeration ne = helper.searchDir(base, filter, ZSearchControls.SEARCH_CTLS_SUBTREE(), initZlc, LdapServerType.REPLICA);
while (ne.hasMore()) {
ZSearchResultEntry sr = ne.next();
result.add(new LdapSignature(acct, sr.getDN(), sr.getAttributes(), this));
}
ne.close();
} catch (ServiceException e) {
throw ServiceException.FAILURE("unable to lookup signature via query: " + filter.toFilterString() + " message: " + e.getMessage(), e);
}
return result;
}
use of com.zimbra.cs.ldap.ZSearchResultEnumeration in project zm-mailbox by Zimbra.
the class LdapProvisioning method domainDnExists.
private boolean domainDnExists(ZLdapContext zlc, String dn) throws ServiceException {
try {
ZSearchResultEnumeration ne = helper.searchDir(dn, filterFactory.domainLabel(), ZSearchControls.SEARCH_CTLS_SUBTREE(), zlc, LdapServerType.MASTER);
boolean result = ne.hasMore();
ne.close();
return result;
} catch (ServiceException e) {
// or should we throw? TODO
return false;
}
}
use of com.zimbra.cs.ldap.ZSearchResultEnumeration in project zm-mailbox by Zimbra.
the class LdapProvisioning method getMimeTypesByQuery.
@Override
public List<MimeTypeInfo> getMimeTypesByQuery(String mimeType) throws ServiceException {
List<MimeTypeInfo> mimeTypes = new ArrayList<MimeTypeInfo>();
try {
ZSearchResultEnumeration ne = helper.searchDir(mDIT.mimeBaseDN(), filterFactory.mimeEntryByMimeType(mimeType), ZSearchControls.SEARCH_CTLS_SUBTREE());
while (ne.hasMore()) {
ZSearchResultEntry sr = ne.next();
mimeTypes.add(new LdapMimeType(sr, this));
}
ne.close();
} catch (ServiceException e) {
throw ServiceException.FAILURE("unable to get mime types for " + mimeType, e);
}
return mimeTypes;
}
use of com.zimbra.cs.ldap.ZSearchResultEnumeration in project zm-mailbox by Zimbra.
the class LdapProvisioning method getAllMimeTypesByQuery.
@Override
public List<MimeTypeInfo> getAllMimeTypesByQuery() throws ServiceException {
List<MimeTypeInfo> mimeTypes = new ArrayList<MimeTypeInfo>();
try {
ZSearchResultEnumeration ne = helper.searchDir(mDIT.mimeBaseDN(), filterFactory.allMimeEntries(), ZSearchControls.SEARCH_CTLS_SUBTREE());
while (ne.hasMore()) {
ZSearchResultEntry sr = ne.next();
mimeTypes.add(new LdapMimeType(sr, this));
}
ne.close();
} catch (ServiceException e) {
throw ServiceException.FAILURE("unable to get mime types", e);
}
return mimeTypes;
}
Aggregations