use of com.zimbra.cs.account.AddressList in project zm-mailbox by Zimbra.
the class LdapProvisioning method getAddressList.
/**
* @param id id of the address list
* @return AddressList object
* @throws ServiceException if an error occurs while querying LDAP.
*/
@Override
public AddressList getAddressList(String zimbraId) throws ServiceException {
AddressList list = null;
try {
ZimbraLog.ldap.info("Called addresslist");
String[] returnAttrs = { "objectClass", Provisioning.A_uid, Provisioning.A_zimbraId, Provisioning.A_zimbraAddressListGalFilter, Provisioning.A_description, Provisioning.A_zimbraIsAddressListActive, Provisioning.A_zimbraAddressListLdapFilter };
ZSearchControls searchControls = ZSearchControls.createSearchControls(ZSearchScope.SEARCH_SCOPE_SUBTREE, ZSearchControls.SIZE_UNLIMITED, returnAttrs);
ZSearchResultEnumeration ne = helper.searchDir(mDIT.mailBranchBaseDN(), filterFactory.addressListById(zimbraId), searchControls, null, LdapServerType.MASTER);
if (ne.hasMore()) {
ZSearchResultEntry sr = ne.next();
String dn = sr.getDN();
ZimbraLog.ldap.debug("Got address list: %s with attributes : %s", dn, sr.getAttributes());
Map<String, Object> attrs = sr.getAttributes().getAttrs();
String name = (String) attrs.get(Provisioning.A_displayName);
list = new AddressList(dn, name, zimbraId, attrs, null, this);
}
ne.close();
} catch (ServiceException e) {
throw ServiceException.FAILURE(String.format("Unable to fetch address list '%s'", zimbraId), e);
}
return list;
}
Aggregations