org.jasig.services.persondir.support.ldap
Class LdapPersonAttributeDao

java.lang.Object
  extended by org.jasig.services.persondir.support.BasePersonAttributeDao
      extended by org.jasig.services.persondir.support.AbstractFlatteningPersonAttributeDao
          extended by org.jasig.services.persondir.support.AbstractDefaultAttributePersonAttributeDao
              extended by org.jasig.services.persondir.support.AbstractQueryPersonAttributeDao<org.jasig.services.persondir.support.ldap.LogicalFilterWrapper>
                  extended by org.jasig.services.persondir.support.ldap.LdapPersonAttributeDao
All Implemented Interfaces:
IPersonAttributeDao, org.springframework.beans.factory.InitializingBean

public class LdapPersonAttributeDao
extends AbstractQueryPersonAttributeDao<org.jasig.services.persondir.support.ldap.LogicalFilterWrapper>
implements org.springframework.beans.factory.InitializingBean

LDAP implementation of IPersonAttributeDao. In the case of multi valued attributes a List is set as the value.

Configuration:

Property Description Required Default
searchControls Set the SearchControls used for executing the LDAP query. No Default instance with SUBTREE scope.
baseDN The base DistinguishedName to use when executing the query filter. No ""
contextSource A ContextSource from the Spring-LDAP framework. Provides a DataSource style object that this DAO can retrieve LDAP connections from. Yes null
setReturningAttributes If the ldap attributes set in the ldapAttributesToPortalAttributes Map should be copied into the SearchControls.setReturningAttributes(String[]). Setting this helps reduce wire traffic of ldap queries. No true
queryType How multiple attributes in a query should be concatenated together. The other option is OR. No AND

Since:
uPortal 2.5
Version:
$Revision$ $Date$
Author:
andrew.petro@yale.edu, Eric Dalquist

Field Summary
 
Fields inherited from class org.jasig.services.persondir.support.BasePersonAttributeDao
logger
 
Fields inherited from interface org.jasig.services.persondir.IPersonAttributeDao
WILDCARD, WILDCARD_PATTERN
 
Constructor Summary
LdapPersonAttributeDao()
           
 
Method Summary
 void afterPropertiesSet()
           
protected  org.jasig.services.persondir.support.ldap.LogicalFilterWrapper appendAttributeToQuery(org.jasig.services.persondir.support.ldap.LogicalFilterWrapper queryBuilder, String dataAttribute, List<Object> queryValues)
          Append the attribute and value to the queryBuilder.
 String getBaseDN()
           
 org.springframework.ldap.core.ContextSource getContextSource()
           
protected  List<IPersonAttributes> getPeopleForQuery(org.jasig.services.persondir.support.ldap.LogicalFilterWrapper queryBuilder, String queryUserName)
          Executes the query for the generated queryBuilder object and returns a list where each entry is a Map of attributes for a single IPersonAttributes.
 String getQueryTemplate()
           
 QueryType getQueryType()
           
 SearchControls getSearchControls()
           
 int getTimeLimit()
          Deprecated. Set the property on the SearchControls and set that via setSearchControls(SearchControls)
 void setBaseDN(String baseDN)
           
 void setContextSource(org.springframework.ldap.core.ContextSource contextSource)
           
 void setLdapTemplate(org.springframework.ldap.core.LdapTemplate ldapTemplate)
          Sets the LdapTemplate, and thus the ContextSource (implicitly).
 void setQueryTemplate(String queryTemplate)
          Optional wrapper template for the generated part of the query.
 void setQueryType(QueryType queryType)
          Type of logical operator to use when joining WHERE clause components
 void setSearchControls(SearchControls searchControls)
           
 void setTimeLimit(int ms)
          Deprecated.  
 
Methods inherited from class org.jasig.services.persondir.support.AbstractQueryPersonAttributeDao
generateQuery, getAvailableQueryAttributes, getConfiguredUserNameAttribute, getPeopleWithMultivaluedAttributes, getPossibleUserAttributeNames, getQueryAttributeMapping, getResultAttributeMapping, getUnmappedUsernameAttribute, isRequireAllQueryAttributes, isUseAllQueryAttributes, mapPersonAttributes, setQueryAttributeMapping, setRequireAllQueryAttributes, setResultAttributeMapping, setUnmappedUsernameAttribute, setUseAllQueryAttributes
 
Methods inherited from class org.jasig.services.persondir.support.AbstractDefaultAttributePersonAttributeDao
getPerson, getUsernameAttributeProvider, setUsernameAttributeProvider, toSeedMap
 
Methods inherited from class org.jasig.services.persondir.support.AbstractFlatteningPersonAttributeDao
getPeople, toMultivaluedSeed
 
Methods inherited from class org.jasig.services.persondir.support.BasePersonAttributeDao
flattenResults, getMultivaluedUserAttributes, getMultivaluedUserAttributes, getUserAttributes, getUserAttributes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LdapPersonAttributeDao

public LdapPersonAttributeDao()
Method Detail

afterPropertiesSet

public void afterPropertiesSet()
                        throws Exception
Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
Throws:
Exception

appendAttributeToQuery

protected org.jasig.services.persondir.support.ldap.LogicalFilterWrapper appendAttributeToQuery(org.jasig.services.persondir.support.ldap.LogicalFilterWrapper queryBuilder,
                                                                                                String dataAttribute,
                                                                                                List<Object> queryValues)
Description copied from class: AbstractQueryPersonAttributeDao
Append the attribute and value to the queryBuilder.

Specified by:
appendAttributeToQuery in class AbstractQueryPersonAttributeDao<org.jasig.services.persondir.support.ldap.LogicalFilterWrapper>
Parameters:
queryBuilder - The sub-class specific query builder object
dataAttribute - The full attribute name to append
queryValues - The values for the data attribute
Returns:
An updated queryBuiler

getPeopleForQuery

protected List<IPersonAttributes> getPeopleForQuery(org.jasig.services.persondir.support.ldap.LogicalFilterWrapper queryBuilder,
                                                    String queryUserName)
Description copied from class: AbstractQueryPersonAttributeDao
Executes the query for the generated queryBuilder object and returns a list where each entry is a Map of attributes for a single IPersonAttributes.

Specified by:
getPeopleForQuery in class AbstractQueryPersonAttributeDao<org.jasig.services.persondir.support.ldap.LogicalFilterWrapper>
Parameters:
queryBuilder - The query generated by calls to AbstractQueryPersonAttributeDao.appendAttributeToQuery(Object, String, List)
queryUserName - The username passed in the query map, if no username attribute existed in the query Map null is provided.
Returns:
The list of IPersons found by the query. The user attributes should be using the raw names from the data layer.

getTimeLimit

@Deprecated
public int getTimeLimit()
Deprecated. Set the property on the SearchControls and set that via setSearchControls(SearchControls)

See Also:
SearchControls.getTimeLimit()

setTimeLimit

@Deprecated
public void setTimeLimit(int ms)
Deprecated. 

See Also:
SearchControls.setTimeLimit(int)

getBaseDN

public String getBaseDN()
Returns:
The base distinguished name to use for queries.

setBaseDN

public void setBaseDN(String baseDN)
Parameters:
baseDN - The base distinguished name to use for queries.

getContextSource

public org.springframework.ldap.core.ContextSource getContextSource()
Returns:
The ContextSource to get DirContext objects for queries from.

setContextSource

public void setContextSource(org.springframework.ldap.core.ContextSource contextSource)
Parameters:
contextSource - The ContextSource to get DirContext objects for queries from.

setLdapTemplate

public void setLdapTemplate(org.springframework.ldap.core.LdapTemplate ldapTemplate)
Sets the LdapTemplate, and thus the ContextSource (implicitly).

Parameters:
ldapTemplate - the LdapTemplate to query the LDAP server from. CANNOT be NULL.

getSearchControls

public SearchControls getSearchControls()
Returns:
Search controls to use for LDAP queries

setSearchControls

public void setSearchControls(SearchControls searchControls)
Parameters:
searchControls - Search controls to use for LDAP queries

getQueryType

public QueryType getQueryType()
Returns:
the queryType

setQueryType

public void setQueryType(QueryType queryType)
Type of logical operator to use when joining WHERE clause components

Parameters:
queryType - the queryType to set

getQueryTemplate

public String getQueryTemplate()

setQueryTemplate

public void setQueryTemplate(String queryTemplate)
Optional wrapper template for the generated part of the query. Use {0} as a placeholder for where the generated query should be inserted.



Copyright © 2012 Jasig. All Rights Reserved.