|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jasig.services.persondir.support.BasePersonAttributeDao
org.jasig.services.persondir.support.AbstractFlatteningPersonAttributeDao
org.jasig.services.persondir.support.AbstractDefaultAttributePersonAttributeDao
org.jasig.services.persondir.support.AbstractQueryPersonAttributeDao<QB>
public abstract class AbstractQueryPersonAttributeDao<QB>
Provides common functionality for DAOs using a set of attribute values from the seed to
perform a query. Ensures the nessesary attributes to run the query exist on the seed and
organizes the values into an argument array.
Configuration:
| Property | Description | Required | Default |
|---|---|---|---|
| queryAttributeMapping |
A Map from attribute names used in the query Map to attribute names to use in the SQL.
The values can be either String or Collection to use a single Map attribute under
multiple names as in the SQL. If set only Map attributes listed will be used in the SQL. If not
set all Map attributes are used as-is in the SQL.
|
No | null |
| resultAttributeMapping |
A Map from SQL result names to returned attribute names. The values can be either String
or Collection to use a single SQL result under multiple returned attributes. If set only
SQL attributes listed will be returned. If not set all SQL attributes will be returned.
|
No | null |
| requireAllQueryAttributes |
If the SQL should only be run if all attributes listed in the queryAttributeMapping exist in the query
Map. Ignored if queryAttributeMapping is null
|
No | false |
| unmappedUsernameAttribute |
The unmapped username attribute returned by the query. If null the value returned by the configured
IUsernameAttributeProvider is used.
|
No | null |
| 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 | |
|---|---|
AbstractQueryPersonAttributeDao()
|
|
| Method Summary | |
|---|---|
protected abstract QB |
appendAttributeToQuery(QB queryBuilder,
String dataAttribute,
List<Object> queryValues)
Append the attribute and value to the queryBuilder. |
protected QB |
generateQuery(Map<String,List<Object>> query)
Generates a query using the queryBuilder object passed by the subclass. |
Set<String> |
getAvailableQueryAttributes()
|
protected String |
getConfiguredUserNameAttribute()
|
protected abstract List<IPersonAttributes> |
getPeopleForQuery(QB queryBuilder,
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<IPersonAttributes> |
getPeopleWithMultivaluedAttributes(Map<String,List<Object>> query)
|
Set<String> |
getPossibleUserAttributeNames()
|
Map<String,Set<String>> |
getQueryAttributeMapping()
|
Map<String,Set<String>> |
getResultAttributeMapping()
|
String |
getUnmappedUsernameAttribute()
|
boolean |
isRequireAllQueryAttributes()
|
boolean |
isUseAllQueryAttributes()
|
protected IPersonAttributes |
mapPersonAttributes(IPersonAttributes person)
Uses resultAttributeMapping to return a copy of the IPersonAttributes with only the attributes specified in resultAttributeMapping mapped to their result attribute names. |
void |
setQueryAttributeMapping(Map<String,?> queryAttributeMapping)
Map from query attribute names to data-layer attribute names to use when building the query. |
void |
setRequireAllQueryAttributes(boolean requireAllQueryAttributes)
If all attributes specified in the queryAttributeMapping keySet must be present to actually run the query |
void |
setResultAttributeMapping(Map<String,?> resultAttributeMapping)
Set the Map to use for mapping from a data layer name to an attribute name or Set of attribute
names. |
void |
setUnmappedUsernameAttribute(String userNameAttribute)
The returned attribute to use as the userName for the mapped IPersons. |
void |
setUseAllQueryAttributes(boolean useAllQueryAttributes)
If setQueryAttributeMapping(Map) is null this determines if no parameters should be specified
or if all query attributes should be used as parameters. |
| 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 |
|---|
public AbstractQueryPersonAttributeDao()
| Method Detail |
|---|
public boolean isUseAllQueryAttributes()
public void setUseAllQueryAttributes(boolean useAllQueryAttributes)
setQueryAttributeMapping(Map) is null this determines if no parameters should be specified
or if all query attributes should be used as parameters. Defaults to true.
public Map<String,Set<String>> getQueryAttributeMapping()
public void setQueryAttributeMapping(Map<String,?> queryAttributeMapping)
queryAttributeMapping - the queryAttributeMapping to setpublic Map<String,Set<String>> getResultAttributeMapping()
public void setResultAttributeMapping(Map<String,?> resultAttributeMapping)
Map to use for mapping from a data layer name to an attribute name or Set of attribute
names. Data layer names that are specified but have null mappings will use the column name for the attribute
name. Data layer names that are not specified as keys in this Map will be ignored.
Map must have keys of type String and values of type String or a Set
of String.
resultAttributeMapping - Map from column names to attribute names, may not be null.
IllegalArgumentException - If the Map doesn't follow the rules stated above.MultivaluedPersonAttributeUtils.parseAttributeToAttributeMapping(Map)public boolean isRequireAllQueryAttributes()
public void setRequireAllQueryAttributes(boolean requireAllQueryAttributes)
requireAllQueryAttributes - the requireAllQueryAttributes to setpublic String getUnmappedUsernameAttribute()
public void setUnmappedUsernameAttribute(String userNameAttribute)
#setDefaultAttributeName(String)
value will be used and if that is null the AttributeNamedPersonImpl.DEFAULT_USER_NAME_ATTRIBUTE value is
used.
userNameAttribute - the userNameAttribute to setpublic final Set<IPersonAttributes> getPeopleWithMultivaluedAttributes(Map<String,List<Object>> query)
public Set<String> getAvailableQueryAttributes()
public Set<String> getPossibleUserAttributeNames()
protected abstract List<IPersonAttributes> getPeopleForQuery(QB queryBuilder,
String queryUserName)
queryBuilder - The query generated by calls to appendAttributeToQuery(Object, String, List)queryUserName - The username passed in the query map, if no username attribute existed in the query Map null is provided.
protected abstract QB appendAttributeToQuery(QB queryBuilder,
String dataAttribute,
List<Object> queryValues)
queryBuilder - The sub-class specific query builder objectdataAttribute - The full attribute name to appendqueryValues - The values for the data attribute
protected final QB generateQuery(Map<String,List<Object>> query)
#appendAttributeToQuery(Object, String, String). Attributes are only added if
there is an attributed mapped in the queryAttributeMapping.
queryBuilder - The sub-class specific object to pass to #appendAttributeToQuery(Object, String, String) when building the queryquery - The query Map to populate the queryBuilder with.
protected final IPersonAttributes mapPersonAttributes(IPersonAttributes person)
person - The IPersonAttributes to map attributes for
protected String getConfiguredUserNameAttribute()
#getDefaultAttributeName() should
never return null this method should never return null either.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||