Simplified sub-class usage. Made compatible with changes to User constructor.

This commit is contained in:
Ben Alex 2004-03-29 02:48:10 +00:00
parent b332c3bc03
commit ea05e0b931
1 changed files with 6 additions and 20 deletions

View File

@ -54,8 +54,8 @@ public class JdbcDaoImpl extends JdbcDaoSupport implements AuthenticationDao {
//~ Instance fields ======================================================== //~ Instance fields ========================================================
private AuthoritiesByUsernameQuery authoritiesByUsernameQuery; protected AuthoritiesByUsernameQuery authoritiesByUsernameQuery;
private UsersByUsernameQuery usersByUsernameQuery; protected UsersByUsernameQuery usersByUsernameQuery;
//~ Methods ================================================================ //~ Methods ================================================================
@ -82,24 +82,9 @@ public class JdbcDaoImpl extends JdbcDaoSupport implements AuthenticationDao {
user.isEnabled(), arrayAuths); user.isEnabled(), arrayAuths);
} }
protected void setAuthoritiesByUsernameQuery(
AuthoritiesByUsernameQuery authoritiesByUsernameQuery) {
this.authoritiesByUsernameQuery = authoritiesByUsernameQuery;
}
protected void setUsersByUsernameQuery(
UsersByUsernameQuery usersByUsernameQuery) {
this.usersByUsernameQuery = usersByUsernameQuery;
}
protected void initDao() throws ApplicationContextException { protected void initDao() throws ApplicationContextException {
if (usersByUsernameQuery == null) { usersByUsernameQuery = new UsersByUsernameQuery(getDataSource());
usersByUsernameQuery = new UsersByUsernameQuery(getDataSource()); authoritiesByUsernameQuery = new AuthoritiesByUsernameQuery(getDataSource());
}
if (authoritiesByUsernameQuery == null) {
authoritiesByUsernameQuery = new AuthoritiesByUsernameQuery(getDataSource());
}
} }
//~ Inner Classes ========================================================== //~ Inner Classes ==========================================================
@ -140,7 +125,8 @@ public class JdbcDaoImpl extends JdbcDaoSupport implements AuthenticationDao {
String username = rs.getString("username"); String username = rs.getString("username");
String password = rs.getString("password"); String password = rs.getString("password");
boolean enabled = rs.getBoolean("enabled"); boolean enabled = rs.getBoolean("enabled");
User user = new User(username, password, enabled, null); User user = new User(username, password, enabled,
new GrantedAuthority[] {new GrantedAuthorityImpl("HOLDER")});
return user; return user;
} }