Removed individual search controls setter methods in favour of supplying complete search controls object. Added comment for 'compare' method.
This commit is contained in:
parent
b8fa1ad906
commit
577cc17764
|
@ -78,27 +78,11 @@ public class LdapTemplate {
|
||||||
this.password = password;
|
this.password = password;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSearchScope(int searchScope) {
|
|
||||||
searchControls.setSearchScope(searchScope);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The time (in milliseconds) which to wait before the search fails;
|
* Sets the search controls which will be used for search operations by the template.
|
||||||
* the default is zero, meaning forever.
|
|
||||||
*/
|
|
||||||
public void setSearchTimeLimit(int searchTimeLimit) {
|
|
||||||
searchControls.setTimeLimit(searchTimeLimit);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the corresponding property on the SearchControls instance used
|
|
||||||
* in the search.
|
|
||||||
*
|
*
|
||||||
|
* @param searchControls the SearchControls instance which will be cached in the template.
|
||||||
*/
|
*/
|
||||||
public void setDerefLinkFlag(boolean deref) {
|
|
||||||
searchControls.setDerefLinkFlag(deref);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSearchControls(SearchControls searchControls) {
|
public void setSearchControls(SearchControls searchControls) {
|
||||||
this.searchControls = searchControls;
|
this.searchControls = searchControls;
|
||||||
}
|
}
|
||||||
|
@ -120,7 +104,15 @@ public class LdapTemplate {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Performs an LDAP compare operation of the value of an attribute for a
|
||||||
|
* particular directory entry.
|
||||||
|
*
|
||||||
|
* @param dn the entry who's attribute is to be used
|
||||||
|
* @param attributeName the attribute who's value we want to compare
|
||||||
|
* @param value the value to be checked against the directory value
|
||||||
|
* @return true if the supplied value matches that in the directory
|
||||||
|
*/
|
||||||
public boolean compare(final String dn, final String attributeName, final Object value) {
|
public boolean compare(final String dn, final String attributeName, final Object value) {
|
||||||
final String comparisonFilter = "(" + attributeName + "={0})";
|
final String comparisonFilter = "(" + attributeName + "={0})";
|
||||||
|
|
||||||
|
@ -165,6 +157,8 @@ public class LdapTemplate {
|
||||||
public Object execute(DirContext ctx) throws NamingException {
|
public Object execute(DirContext ctx) throws NamingException {
|
||||||
Set unionOfValues = new HashSet();
|
Set unionOfValues = new HashSet();
|
||||||
|
|
||||||
|
// We're only interested in a single attribute for this method, so we make a copy of
|
||||||
|
// the search controls and override the returningAttributes property
|
||||||
SearchControls ctls = new SearchControls();
|
SearchControls ctls = new SearchControls();
|
||||||
|
|
||||||
ctls.setSearchScope(searchControls.getSearchScope());
|
ctls.setSearchScope(searchControls.getSearchScope());
|
||||||
|
|
Loading…
Reference in New Issue