AuthorizeManager.addPolicy(ourContext, b, Constants.DELETE, ourContext.getCurrentUser()); AuthorizeManager.addPolicy(ourContext, b, Constants.REMOVE, ourContext.getCurrentUser());
    public void removeBundle(Bundle b)        throws SQLException, AuthorizeException, IOException    {        // Check authorisation        AuthorizeManager.authorizeAction(ourContext, this, Constants.REMOVE);        log.info(LogManager.getHeader(ourContext,            "remove_bundle",            "item_id=" + getID() +                ",bundle_id=" + b.getID()));        // Remove from internal list of bundles        ListIterator li = bundles.listIterator();        while (li.hasNext())        {            Bundle existing = (Bundle) li.next();            if (b.getID() == existing.getID())            {                // We've found the bundle to remove                li.remove();            }        }        // Remove mapping from DB        DatabaseManager.updateQuery(ourContext,            "DELETE FROM item2bundle WHERE item_id=" + getID() +                " AND bundle_id=" + b.getID());        // If the bundle is orphaned, it's removed        TableRowIterator tri = DatabaseManager.query(ourContext,            "SELECT * FROM item2bundle WHERE bundle_id=" +                b.getID());        if (!tri.hasNext())        {            // The bundle is an orphan, delete it            b.delete();        }    }