if (containers)
if (collections)
    public static List harvest(Context context,        DSpaceObject scope,        String startDate,        String endDate,        int offset,        int limit,        boolean items,        boolean containers,        boolean withdrawn)        throws SQLException    {        // SQL to add to the list of tables after the SELECT        String scopeTableSQL = "";        // SQL to add to the WHERE clause of the query        String scopeWhereSQL = "";                        if (scope != null)        {            if (scope.getType() == Constants.COMMUNITY)            {                // Getting things within a community                scopeTableSQL = ", community2item";                scopeWhereSQL = " AND community2item.community_id=" +                    scope.getID() +                    " AND community2item.item_id=handle.resource_id";            }            else if (scope.getType() == Constants.COLLECTION)            {                scopeTableSQL = ", collection2item";                scopeWhereSQL = " AND collection2item.collection_id=" +                    scope.getID() +                    " AND collection2item.item_id=handle.resource_id";            }            // Theoretically, no other possibilities, won't bother to check        }                // Put together our query.  Note there is no need for an        // "in_archive=true" condition, we are using the existence of        // Handles as our 'existence criterion'.        String query =             "SELECT handle.handle, handle.resource_id, item.withdrawn, item.last_modified FROM handle, item" +            scopeTableSQL + " WHERE handle.resource_type_id=" + Constants.ITEM +            " AND handle.resource_id=item.item_id" + scopeWhereSQL;                if (startDate != null)        {            query = query + " AND item.last_modified >= '" + startDate + "'";        }                if (endDate != null)        {            query = query + " AND item.last_modified <= '" + endDate + "'";        }        if (withdrawn = false)        {            // Exclude withdrawn items            query = query + " AND withdrawn=false";        }                // Order by item ID, so that for a given harvest the order will be        // consistent.  This is so that big harvests can be broken up into        // several smaller operations (e.g. for OAI resumption tokens.)        query = query + " ORDER BY handle.resource_id";                log.debug(LogManager.getHeader(context,            "harvest SQL",            query));        // Execute        TableRowIterator tri = DatabaseManager.query(context, query);        List infoObjects = new LinkedList();        int index = 0;                // Process results of query into HarvestedItemInfo objects        while (tri.hasNext())        {            TableRow row = tri.next();            /*             * This conditional ensures that we only process items within             * any constraints specified by 'offset' and 'limit' parameters.             */            if (index >= offset &&               (limit == 0 || index < offset + limit))            {                HarvestedItemInfo itemInfo = new HarvestedItemInfo();                itemInfo.handle = row.getStringColumn("handle");                itemInfo.itemID = row.getIntColumn("resource_id");                // Put datestamp in ISO8601                itemInfo.datestamp = row.getDateColumn("last_modified");                itemInfo.withdrawn = row.getBooleanColumn("withdrawn");                if (containers)                {                    fillContainers(context, itemInfo);                }                if (items)                {                    // Get the item                    itemInfo.item = Item.find(context, itemInfo.itemID);                }                infoObjects.add(itemInfo);            }            index++;        }        return infoObjects;    }