org.jasig.services.persondir.support.jdbc
Class SingleRowJdbcPersonAttributeDao

java.lang.Object
  extended by org.jasig.services.persondir.support.AbstractDefaultAttributePersonAttributeDao
      extended by org.jasig.services.persondir.support.AbstractQueryPersonAttributeDao
          extended by org.jasig.services.persondir.support.jdbc.AbstractJdbcPersonAttributeDao
              extended by org.jasig.services.persondir.support.jdbc.SingleRowJdbcPersonAttributeDao
All Implemented Interfaces:
IPersonAttributeDao

public class SingleRowJdbcPersonAttributeDao
extends AbstractJdbcPersonAttributeDao

An org.jasig.portal.services.persondir.IPersonAttributeDao implementation that maps from column names in the result of a SQL query to attribute names.
You must set a Map from column names to attribute names and only column names appearing as keys in that map will be used.

Configuration:

Property Description Required Default
columnsToAttributes The Map of String columns names to String or Sets of Strings to use as attribute names in the returned Map. If a column name is not in the map the column name will be used in as the returned attribute name. No Collections.EMPTY_MAP

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

Field Summary
 
Fields inherited from class org.jasig.services.persondir.support.AbstractDefaultAttributePersonAttributeDao
logger
 
Constructor Summary
SingleRowJdbcPersonAttributeDao(DataSource ds, List attrList, String sql)
          Creates a new MultiRowJdbcPersonAttributeDao specifying the DataSource and SQL to use.
 
Method Summary
protected  AbstractPersonAttributeMappingQuery getAttributeQuery()
           
 Map getColumnsToAttributes()
          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.
 Set getPossibleUserAttributeNames()
          Gets a Set of attribute names that may be returned by the IPersonAttributeDao.getUserAttributes(Map).
 Map parseAttributeMapFromResults(List queryResults)
          Returned Map will have values of String or a List of String.
 void setColumnsToAttributes(Map columnsToAttributesMap)
          Set the Map to use for mapping from a column name to a attribute name or Set of attribute names.
 
Methods inherited from class org.jasig.services.persondir.support.jdbc.AbstractJdbcPersonAttributeDao
getUserAttributesIfNeeded, setQueryAttributes
 
Methods inherited from class org.jasig.services.persondir.support.AbstractQueryPersonAttributeDao
getQueryAttributes, getUserAttributes
 
Methods inherited from class org.jasig.services.persondir.support.AbstractDefaultAttributePersonAttributeDao
getDefaultAttributeName, getUserAttributes, setDefaultAttributeName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SingleRowJdbcPersonAttributeDao

public SingleRowJdbcPersonAttributeDao(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 SingleRowPersonAttributeMappingQuery#SingleRowPersonAttributeMappingQuery(DataSource, String, List, SingleRowJdbcPersonAttributeDao)
sql - The SQL to execute for user attributes, may not be null.
Method Detail

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.

getColumnsToAttributes

public Map getColumnsToAttributes()
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.

setColumnsToAttributes

public void setColumnsToAttributes(Map columnsToAttributesMap)
Set the Map to use for mapping from a column name to a attribute name or Set of attribute names. Column names that are specified but have null mappings will use the column name for the attribute name. Column names that are not specified as keys in this Map will be ignored.
The passed Map must have keys of type String and values of type String or a Set of String.

Parameters:
columnsToAttributesMap - 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)


Copyright © 1998-2007 Java Architectures Special Interest Group. All Rights Reserved.