StringBuffer userRoles = new StringBuffer();
StringBuffer sql = new StringBuffer();
sql.append(" select name, role_id from roles where role_id in ");
sql.append(" (select role_id from role2user where user_id=?) order by name ");
QueryParser qp = new QueryParser(sql.toString());
qp.addPreparedStmtElementDefinition(userId);
ArrayList<String> roleList = null;
try
{
Configuration.getConnectionPool().executeQuery(qp);
roleList = qp.getResults(String.class, "name");
if( roleList == null )
{
throw new NoUserRolesException("Database errors prevented retrieval of role names for user");
}
for( int i = 0; i < qp.getResultCount(); i++)
{
ArrayList results = qp.getRowResults(i);
userRoles.append( results.get(0).toString() + " (" + results.get(1).toString() + ")|" );
}
/*for( String role: roleList )
{
userRoles.append( role + "|" );