}
user = JetspeedSecurity.getUser(new UserNamePrincipal(username));
}
catch(JetspeedSecurityException e)
{
throw new RoleException("Failed to Retrieve User: ", e);
}
Criteria criteria = new Criteria();
criteria.add(TurbineUserGroupRolePeer.USER_ID, user.getUserId());
List rels;
HashMap roles;
try
{
rels = TurbineUserGroupRolePeer.doSelect(criteria);
if (rels.size() > 0)
{
roles = new HashMap(rels.size());
}
else
roles = new HashMap();
for (int ix = 0; ix < rels.size(); ix++)
{
TurbineUserGroupRole rel = (TurbineUserGroupRole)rels.get(ix);
Role role = rel.getTurbineRole();
roles.put(role.getName(), role);
}
}
catch(Exception e)
{
throw new RoleException("Failed to retrieve roles ", e);
}
return roles.values().iterator();
}