public List<ContactAcctDTO> findMailContactAcct(String contactCN) { AndFilter andFilter = new AndFilter(); andFilter.and(new EqualsFilter("cn", contactCN)); andFilter.and(new EqualsFilter("cn", "Mail.Location")); return ldapTemplate.search( "cn=" + contactCN, andFilter.encode(), new ContactAcctAttributeMapper()); }
/** * Return a specific certification for a particular contact. * * @param contactCN * @param acctCN * @return */ public List<ContactCertDTO> findContactCert(String contactCN, String certCN) { // Create filter AndFilter andFilter = new AndFilter(); andFilter.and(new EqualsFilter("objectclass", "document")); andFilter.and(new EqualsFilter("cn", certCN)); return ldapTemplate.search( "cn=" + contactCN, andFilter.encode(), new ContactCertAttributeMapper()); }
/** * Find a specific set of contacts. * * @param lookup ie. "cn=myuser.identity,st=CA" * @return */ public List<ContactDTO> findContact(String lookup) { StringTokenizer st = new StringTokenizer(lookup, ",="); // Create filter for person objects AndFilter andFilter = new AndFilter(); andFilter.and(new EqualsFilter("objectclass", "person")); // Go through lookup string and add filters while (st.hasMoreTokens()) { String attr = null; String value = null; attr = st.nextToken(); if (st.hasMoreTokens()) { value = st.nextToken(); } if ((attr != null) && (value != null)) { andFilter.and(new EqualsFilter(attr, value)); } } return ldapTemplate.search("", andFilter.encode(), new ContactAttributeMapper()); }
public LDAPQuery(final String objectFilter) { this.rootFilter = new AndFilter(); rootFilter.and(new HardcodedFilter(objectFilter)); }