class JDBCConnection implements ObjectStoreConnection {

    @Override
    public boolean updateRole(String domainName, Role role) {

        int affectedRows;
        final String caller = "updateRole";

        String roleName = ZMSUtils.extractRoleName(domainName, role.getName());
        if (roleName == null) {
            throw requestError(caller, "domain name mismatch: " + domainName +
                    " update role name: " + role.getName());
        }
        
        int domainId = getDomainId(domainName);
        if (domainId == 0) {
            throw notFoundError(caller, ZMSConsts.OBJECT_DOMAIN, domainName);
        }
        int roleId = getRoleId(domainId, roleName);
        if (roleId == 0) {
            throw notFoundError(caller, ZMSConsts.OBJECT_ROLE, ZMSUtils.roleResourceName(domainName, roleName));
        }
        
        try (PreparedStatement ps = con.prepareStatement(SQL_UPDATE_ROLE)) {
            ps.setString(1, processInsertValue(role.getTrust()));
            ps.setBoolean(2, processInsertValue(role.getAuditEnabled(), false));
            ps.setBoolean(3, processInsertValue(role.getSelfServe(), false));
            ps.setInt(4, processInsertValue(role.getMemberExpiryDays()));
            ps.setInt(5, processInsertValue(role.getTokenExpiryMins()));
            ps.setInt(6, processInsertValue(role.getCertExpiryMins()));
            ps.setString(7, processInsertValue(role.getSignAlgorithm()));
            ps.setInt(8, processInsertValue(role.getServiceExpiryDays()));
            ps.setInt(9, processInsertValue(role.getMemberReviewDays()));
            ps.setInt(10, processInsertValue(role.getServiceReviewDays()));
            ps.setBoolean(11, processInsertValue(role.getReviewEnabled(), false));
            ps.setString(12, processInsertValue(role.getNotifyRoles()));
            ps.setString(13, processInsertValue(role.getUserAuthorityFilter()));
            ps.setString(14, processInsertValue(role.getUserAuthorityExpiration()));
            ps.setInt(15, processInsertValue(role.getGroupExpiryDays()));
            ps.setInt(16, roleId);
            affectedRows = executeUpdate(ps, caller);
        } catch (SQLException ex) {
            throw sqlError(ex, caller);
        }
        
        return (affectedRows > 0);
    }

    public  JDBCConnection(Connection con, boolean autoCommit);

}