use of com.zimbra.cs.account.gal.GalParams in project zm-mailbox by Zimbra.
the class LdapProvisioning method searchZimbraWithNamedFilter.
private SearchGalResult searchZimbraWithNamedFilter(Domain domain, GalOp galOp, String filterName, String n, int maxResults, String token, GalContact.Visitor visitor) throws ServiceException {
GalParams.ZimbraGalParams galParams = new GalParams.ZimbraGalParams(domain, galOp);
String queryExpr = getFilterDef(filterName);
String query = null;
String tokenize = GalUtil.tokenizeKey(galParams, galOp);
if (queryExpr != null) {
if (token != null)
n = "";
query = GalUtil.expandFilter(tokenize, queryExpr, n, token);
}
SearchGalResult result = SearchGalResult.newSearchGalResult(visitor);
result.setTokenizeKey(tokenize);
if (query == null) {
ZimbraLog.gal.warn("searchZimbraWithNamedFilter query is null");
return result;
}
// filter out hidden entries
if (!query.startsWith("(")) {
query = "(" + query + ")";
}
query = "(&" + query + "(!(zimbraHideInGal=TRUE)))";
ZLdapContext zlc = null;
try {
zlc = LdapClient.getContext(LdapUsage.fromGalOpLegacy(galOp));
LdapGalSearch.searchGal(zlc, GalSearchConfig.GalType.zimbra, galParams.pageSize(), galParams.searchBase(), query, maxResults, getGalRules(domain, true), token, result);
} finally {
LdapClient.closeContext(zlc);
}
// Collections.sort(result);
return result;
}
Aggregations