org.jasig.services.persondir.support.jdbc
Class MultiRowJdbcPersonAttributeDao
java.lang.Object
org.jasig.services.persondir.support.AbstractDefaultAttributePersonAttributeDao
org.jasig.services.persondir.support.AbstractQueryPersonAttributeDao
org.jasig.services.persondir.support.jdbc.AbstractJdbcPersonAttributeDao
org.jasig.services.persondir.support.jdbc.MultiRowJdbcPersonAttributeDao
- All Implemented Interfaces:
- IPersonAttributeDao
public class MultiRowJdbcPersonAttributeDao
- extends AbstractJdbcPersonAttributeDao
An org.jasig.portal.services.persondir.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. This contrasts org.jasig.portal.services.persondir.support.jdbc.SingleRowJdbcPersonAttributeDao
which expects a single row result for a user query.
Configuration:
| Property |
Description |
Required |
Default |
| attributeNameMappings |
Maps attribute names as defined in the database to attribute names to be exposed
to the client code. The keys of the Map must be Strings, the values may be
null, String or a Set of Strings. The keySet of this Map is returned
as the possibleUserAttributeNames property. If an attribute name is not in
the map the attribute name will be used in as the returned attribute name.
|
No |
Collections.EMPTY_MAP |
| nameValueColumnMappings |
The Map of columns from a name column to value columns. Keys are Strings,
Values are Strings or List of Strings
|
Yes |
null |
- Since:
- uPortal 2.5
- Version:
- $Revision: 2892 $ $Date: 2006-12-19 13:25:03 -0600 (Tue, 19 Dec 2006) $
- Author:
- andrew.petro@yale.edu, Eric Dalquist edalquist@unicon.net
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MultiRowJdbcPersonAttributeDao
public MultiRowJdbcPersonAttributeDao(DataSource ds,
List attrList,
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.attrList - Sets the query attribute list to pass to AbstractJdbcPersonAttributeDao.setQueryAttributes(List) and MultiRowPersonAttributeMappingQuery#MultiRowPersonAttributeMappingQuery(DataSource, String, List, MultiRowJdbcPersonAttributeDao)sql - The SQL to execute for user attributes, may not be null.
parseAttributeMapFromResults
public Map parseAttributeMapFromResults(List queryResults)
- Returned
Map will have values of String or a
List of String.
- Specified by:
parseAttributeMapFromResults in class AbstractJdbcPersonAttributeDao
- Parameters:
queryResults - Results from the query done using the AbstractPersonAttributeMappingQuery returned by AbstractJdbcPersonAttributeDao.getAttributeQuery()
- Returns:
- The results of the query, as specified by
org.jasig.portal.services.persondir.IPersonAttributeDao#getUserAttributes(Map) - See Also:
org.jasig.portal.services.persondir.IPersonAttributeDao#getUserAttributes(java.util.Map)
getAttributeQuery
protected AbstractPersonAttributeMappingQuery getAttributeQuery()
- Specified by:
getAttributeQuery in class AbstractJdbcPersonAttributeDao
- Returns:
- The subclasses implementation of the
AbstractPersonAttributeMappingQuery. - See Also:
org.jasig.portal.services.persondir.support.jdbc.AbstractJdbcPersonAttributeDao#getAttributeQuery()
getPossibleUserAttributeNames
public Set getPossibleUserAttributeNames()
- Description copied from interface:
IPersonAttributeDao
- Gets a
Set of attribute names that may be returned by the
IPersonAttributeDao.getUserAttributes(Map). The names returned represent all
possible names IPersonAttributeDao.getUserAttributes(Map) could return. If the
dao doesn't have a way to know all possible attribute names this
method should return null.
Returns an immutable Set.
- Returns:
- A {link Set} of possible attribute names for user queries.
getAttributeNameMappings
public Map getAttributeNameMappings()
- Get the Map from non-null String column names to Sets of non-null Strings
representing the names of the uPortal attributes to be initialized from
the specified column.
- Returns:
- Returns the attributeMappings mapping.
setAttributeNameMappings
public void setAttributeNameMappings(Map attributeNameMap)
- The passed
Map must have keys of type String and values
of type String or a Set of String.
- Parameters:
attributeNameMap - Map from column names to attribute names, may not be null.
- Throws:
IllegalArgumentException - If the Map doesn't follow the rules stated above.- See Also:
MultivaluedPersonAttributeUtils.parseAttributeToAttributeMapping(Map)
getNameValueColumnMappings
public Map getNameValueColumnMappings()
- Returns:
- The Map of name column to value column(s).
setNameValueColumnMappings
public void setNameValueColumnMappings(Map 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).
Copyright © 1998-2007 Java Architectures Special Interest Group. All Rights Reserved.