public T getRoleByName()

in torque/src/java/org/apache/fulcrum/security/torque/TorqueAbstractRoleManager.java [350:388]


	public <T extends Role> T getRoleByName(String name) throws DataBackendException, UnknownEntityException
    {
        T role = null;
        Connection con = null;

        try
        {
            con = Transaction.begin();

            role = doSelectByName(name, con);

            // Add attached objects if they exist
            ((TorqueAbstractSecurityEntity)role).retrieveAttachedObjects(con, getLazyLoading());

            Transaction.commit(con);
            con = null;
        }
        catch (NoRowsException e)
        {
            throw new UnknownEntityException("Could not find role " + name);
        }
        catch (TooManyRowsException e)
        {
            throw new DataBackendException("Multiple Roles with same name '" + name + "'");
        }
        catch (TorqueException e)
        {
            throw new DataBackendException("Error retrieving role information", e);
        }
        finally
        {
            if (con != null)
            {
                Transaction.safeRollback(con);
            }
        }

        return role;
    }