org.jasig.services.persondir.support.jdbc
Class MultiRowJdbcPersonAttributeDao
java.lang.Object
org.jasig.services.persondir.support.BasePersonAttributeDao
org.jasig.services.persondir.support.AbstractFlatteningPersonAttributeDao
org.jasig.services.persondir.support.AbstractDefaultAttributePersonAttributeDao
org.jasig.services.persondir.support.AbstractQueryPersonAttributeDao<org.jasig.services.persondir.support.jdbc.PartialWhereClause>
org.jasig.services.persondir.support.jdbc.AbstractJdbcPersonAttributeDao<Map<String,Object>>
org.jasig.services.persondir.support.jdbc.MultiRowJdbcPersonAttributeDao
- All Implemented Interfaces:
- IPersonAttributeDao
public class MultiRowJdbcPersonAttributeDao
- extends AbstractJdbcPersonAttributeDao<Map<String,Object>>
An IPersonAttributeDao
implementation that maps attribute names and values from name and value column
pairs. This is usefull if user attributes are stored in a table like:
| USER_NM |
ATTR_NM |
ATTR_VL |
| jstudent |
name.given |
joe |
| jstudent |
name.family |
student |
| badvisor |
name.given |
bob |
| badvisor |
name.family |
advisor |
This class expects 1 to N row results for a query, with each row containing 1 to N name
value attribute mappings and the userName of the user the attributes are for. This contrasts
SingleRowJdbcPersonAttributeDao which expects
a single row result for a user query.
Configuration:
| Property |
Description |
Required |
Default |
| nameValueColumnMappings |
A Map of attribute name columns to attribute value columns. A single result row can have multiple
name columns and multiple value columns associated with each name. The values of the Map can be
either String or Collection.
|
Yes |
null |
- Since:
- uPortal 2.5
- Version:
- $Revision$ $Date$
- Author:
- andrew.petro@yale.edu, Eric Dalquist edalquist@unicon.net
| 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 java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MultiRowJdbcPersonAttributeDao
public MultiRowJdbcPersonAttributeDao(DataSource ds,
String sql)
- Creates a new MultiRowJdbcPersonAttributeDao specifying the DataSource and SQL to use.
- Parameters:
ds - The DataSource to get connections from for executing queries, may not be null.sql - The SQL to execute for user attributes, may not be null.
getNameValueColumnMappings
public Map<String,Set<String>> getNameValueColumnMappings()
- Returns:
- The Map of name column to value column(s).
setNameValueColumnMappings
public void setNameValueColumnMappings(Map<String,?> nameValueColumnMap)
- The
Map of columns from a name column to value columns. Keys are Strings,
Values are Strings or List of Strings.
- Parameters:
nameValueColumnMap - The Map of name column to value column(s).
getRowMapper
protected org.springframework.jdbc.core.simple.ParameterizedRowMapper<Map<String,Object>> getRowMapper()
- Specified by:
getRowMapper in class AbstractJdbcPersonAttributeDao<Map<String,Object>>
- Returns:
- The ParameterizedRowMapper to handle the results of the SQL query.
parseAttributeMapFromResults
protected List<IPersonAttributes> parseAttributeMapFromResults(List<Map<String,Object>> queryResults,
String queryUserName)
- Description copied from class:
AbstractJdbcPersonAttributeDao
- Takes the
List from the query and parses it into the List of IPersonAttributes attributes to be returned.
- Specified by:
parseAttributeMapFromResults in class AbstractJdbcPersonAttributeDao<Map<String,Object>>
- Parameters:
queryResults - Results from the query.queryUserName - The username passed in the query map, if no username attribute existed in the query Map null is provided.
- Returns:
- The results of the query
Copyright © 2012 Jasig. All Rights Reserved.