criteria.add(TurbineRolePeer.ROLE_NAME, rolename);
roles = TurbineRolePeer.doSelect(criteria);
}
catch(Exception e)
{
throw new RoleException("Failed to retrieve role '" +
rolename + "'", e);
}
if ( roles.size() > 1 )
{
throw new RoleException(
"Multiple Roles with same rolename '" + rolename + "'");
}
if ( roles.size() == 1 )
{
TurbineRole role = (TurbineRole)roles.get(0);
return role;
}
throw new RoleException("Unknown role '" + rolename + "'");
}