An IPersonAttributeDao implementation that maps from column names in the result of SQL query to uPortal attribute names.
Advanced configuration examples
Code Block |
---|
|
<beans>
<!-- this is the key bean, with the special id "personAttributeDao" that PersonDirectory is looking for. -->
<bean id="personAttributeDao"
class="org.jasig.portal.services.persondir.support.JdbcPersonAttributeDaoImpl">
<!-- the JDBC implementation takes two arguments in its constructor.
the first is a DataSource -->
<constructor-arg>
<!-- here we're using a DataSource backed by RDBMServices -->
<bean
class="org.jasig.portal.services.db.RDBMServicesDataSource">
<property name="dbName">
<value>personDb</value>
</property>
</bean>
</constructor-arg>
<!-- the second constructor argument to the JDBC implementation is the SQL
query that will yield a single row. The ? will be replaced with the
userid about whom we are querying -->
<constructor-arg>
<value>SELECT name, shirt_color FROM someschema.sometable
WHERE uid = ?</value>
</constructor-arg>
<!-- the JDBC implementation has one other requirement: a Map
from column names in the ResultSet to uPortal IPerson attribute names. -->
<property name="columnsToAttributes">
<map>
<entry key="name">
<value>name</value>
</entry>
<entry key="shirt_color">
<value>shirtColor</value>
</entry>
</map>
</property>
</bean>
</beans>
|