/**
   * Checks the bean injection.
   *
   * @throws Exception
   * @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet()
   */
  public void afterPropertiesSet() throws Exception {

    Assert.notNull(
        this.parametersProvider,
        "The property parametersProvider in the class "
            + this.getClass().getName()
            + " can't be null.");

    Assert.notNull(
        this.connectionManager,
        "The property connectionManager in the class "
            + this.getClass().getName()
            + " can't be null.");

    ldapParameters = (PersonsParametersSection) parametersProvider.getPersonsParametersSection();
    uidAttributeArray = new String[] {ldapParameters.getLdapUidAttribute()};
    connection = connectionManager.connect();
    constraints = new LDAPSearchConstraints();
    constraints.setMaxResults(0);
  }
 /**
  * Returns an ldap search constraints object configured with the supplied search request.
  *
  * @param sr search request containing configuration to create search constraints
  * @return ldap search constraints
  */
 protected LDAPSearchConstraints getLDAPSearchConstraints(final SearchRequest sr) {
   LDAPSearchConstraints constraints = connection.getSearchConstraints();
   if (constraints == null) {
     constraints = new LDAPSearchConstraints();
   }
   constraints.setServerTimeLimit(Long.valueOf(sr.getTimeLimit()).intValue());
   constraints.setMaxResults(Long.valueOf(sr.getSizeLimit()).intValue());
   if (sr.getDerefAliases() != null) {
     if (sr.getDerefAliases() == DerefAliases.ALWAYS) {
       constraints.setDereference(LDAPSearchConstraints.DEREF_ALWAYS);
     } else if (sr.getDerefAliases() == DerefAliases.FINDING) {
       constraints.setDereference(LDAPSearchConstraints.DEREF_FINDING);
     } else if (sr.getDerefAliases() == DerefAliases.NEVER) {
       constraints.setDereference(LDAPSearchConstraints.DEREF_NEVER);
     } else if (sr.getDerefAliases() == DerefAliases.SEARCHING) {
       constraints.setDereference(LDAPSearchConstraints.DEREF_SEARCHING);
     }
   }
   constraints.setReferralFollowing(sr.getFollowReferrals());
   return constraints;
 }