org.jasig.services.persondir.support.jdbc
Class AbstractJdbcPersonAttributeDao<R>
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<R>
- All Implemented Interfaces:
- IPersonAttributeDao
- Direct Known Subclasses:
- MultiRowJdbcPersonAttributeDao, SingleRowJdbcPersonAttributeDao
public abstract class AbstractJdbcPersonAttributeDao<R>
- extends AbstractQueryPersonAttributeDao<org.jasig.services.persondir.support.jdbc.PartialWhereClause>
Provides common logic for executing a JDBC based query including building the WHERE clause SQL string.
Configuration:
| Property |
Description |
Required |
Default |
| queryType |
How multiple attributes in a query should be concatenated together. The other option is OR.
|
No |
AND |
- Version:
- $Revision$
- Author:
- Eric Dalquist
| 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 |
AbstractJdbcPersonAttributeDao
public AbstractJdbcPersonAttributeDao(DataSource ds,
String queryTemplate)
- Parameters:
ds - The DataSource to use for queriesqueryTemplate - Template to use for SQL query generation. Use {0} as the placeholder for where the generated portion of the WHERE clause should be inserted.
getQueryTemplate
public String getQueryTemplate()
- Returns:
- the queryTemplate
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
parseAttributeMapFromResults
protected abstract List<IPersonAttributes> parseAttributeMapFromResults(List<R> queryResults,
String queryUserName)
- Takes the
List from the query and parses it into the List of IPersonAttributes attributes to be returned.
- 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
getRowMapper
protected abstract org.springframework.jdbc.core.simple.ParameterizedRowMapper<R> getRowMapper()
- Returns:
- The ParameterizedRowMapper to handle the results of the SQL query.
appendAttributeToQuery
protected org.jasig.services.persondir.support.jdbc.PartialWhereClause appendAttributeToQuery(org.jasig.services.persondir.support.jdbc.PartialWhereClause 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.jdbc.PartialWhereClause>
- Parameters:
queryBuilder - The sub-class specific query builder objectdataAttribute - The full attribute name to appendqueryValues - The values for the data attribute
- Returns:
- An updated queryBuiler
getPeopleForQuery
protected List<IPersonAttributes> getPeopleForQuery(org.jasig.services.persondir.support.jdbc.PartialWhereClause 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.jdbc.PartialWhereClause>
- 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.
Copyright © 2012 Jasig. All Rights Reserved.