org.jasig.services.persondir.support
Class ComplexStubPersonAttributeDao

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<String>
                  extended by org.jasig.services.persondir.support.ComplexStubPersonAttributeDao
All Implemented Interfaces:
IPersonAttributeDao

public class ComplexStubPersonAttributeDao
extends AbstractQueryPersonAttributeDao<String>

Looks up the user's attribute Map in the backingMap. If using the IPersonAttributeDao.getUserAttributes(Map) method the attribute value returned for the key #getDefaultAttributeName() will be used as the key for the backingMap.

Configuration:

Property Description Required Default
backingMap Sets the backing map to use to return user attributes from. The backing map should have keys of type String which are the uid for the user. The values should be of type Map which follow the Map restrictions decribed by IPersonAttributeDao.getUserAttributes(Map). No Collections.EMPTY_MAP

Version:
$Revision$ $Date$

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
ComplexStubPersonAttributeDao()
          Creates a new, empty, dao.
ComplexStubPersonAttributeDao(Map<String,Map<String,List<Object>>> backingMap)
          Creates a new DAO with the specified backing map.
ComplexStubPersonAttributeDao(String queryAttributeName, Map<String,Map<String,List<Object>>> backingMap)
          Creates a new DAO with the specified backing map and query attribute.
 
Method Summary
protected  String appendAttributeToQuery(String queryBuilder, String dataAttribute, List<Object> queryValues)
          Append the attribute and value to the queryBuilder.
 Set<String> getAvailableQueryAttributes()
           
 Map<String,Map<String,List<Object>>> getBackingMap()
           
protected  List<IPersonAttributes> getPeopleForQuery(String seedValue, 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.
 Set<String> getPossibleUserAttributeNames()
           
 String getQueryAttributeName()
           
 void setBackingMap(Map<String,Map<String,List<Object>>> backingMap)
          The backing Map to use for queries, the outer map is keyed on the query attribute.
 void setQueryAttributeName(String queryAttributeName)
          Name of the attribute to look for to key into the backing map.
 
Methods inherited from class org.jasig.services.persondir.support.AbstractQueryPersonAttributeDao
generateQuery, getConfiguredUserNameAttribute, getPeopleWithMultivaluedAttributes, 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

ComplexStubPersonAttributeDao

public ComplexStubPersonAttributeDao()
Creates a new, empty, dao.


ComplexStubPersonAttributeDao

public ComplexStubPersonAttributeDao(Map<String,Map<String,List<Object>>> backingMap)
Creates a new DAO with the specified backing map.

Parameters:
backingMap - The backingMap to call setBackingMap(Map) with.

ComplexStubPersonAttributeDao

public ComplexStubPersonAttributeDao(String queryAttributeName,
                                     Map<String,Map<String,List<Object>>> backingMap)
Creates a new DAO with the specified backing map and query attribute.

Parameters:
queryAttributeName - The queryAttributeName to call setQueryAttributeName(String) with.
backingMap - The backingMap to call setBackingMap(Map) with.
Method Detail

getQueryAttributeName

public String getQueryAttributeName()

setQueryAttributeName

public void setQueryAttributeName(String queryAttributeName)
Name of the attribute to look for to key into the backing map. If not set the value returned by AbstractDefaultAttributePersonAttributeDao.getUsernameAttributeProvider() will be used.


getBackingMap

public Map<String,Map<String,List<Object>>> getBackingMap()

setBackingMap

public void setBackingMap(Map<String,Map<String,List<Object>>> backingMap)
The backing Map to use for queries, the outer map is keyed on the query attribute. The inner Map is the set of user attributes to be returned for the query attribute.


getPossibleUserAttributeNames

public Set<String> getPossibleUserAttributeNames()
Specified by:
getPossibleUserAttributeNames in interface IPersonAttributeDao
Overrides:
getPossibleUserAttributeNames in class AbstractQueryPersonAttributeDao<String>

getAvailableQueryAttributes

public Set<String> getAvailableQueryAttributes()
Specified by:
getAvailableQueryAttributes in interface IPersonAttributeDao
Overrides:
getAvailableQueryAttributes in class AbstractQueryPersonAttributeDao<String>

appendAttributeToQuery

protected String appendAttributeToQuery(String 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<String>
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(String seedValue,
                                                    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<String>
Parameters:
seedValue - 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.


Copyright © 2012 Jasig. All Rights Reserved.