try
{
// Process results of query into HarvestedItemInfo objects
while (tri.hasNext())
{
TableRow row = tri.next();
/**
* If we are looking for public-only items, we need to scan all objects
* for permissions in order to properly calculate the offset
*/
if ((!nonAnon) && (index < offset))
{
HarvestedItemInfo itemInfo = new HarvestedItemInfo();
itemInfo.itemID = row.getIntColumn("resource_id");
itemInfo.item = Item.find(context, itemInfo.itemID);
Group[] authorizedGroups = AuthorizeManager.getAuthorizedGroups(context, itemInfo.item, Constants.READ);
boolean added = false;
for (int i = 0; i < authorizedGroups.length; i++)
{
if ((authorizedGroups[i].getID() == 0) && (!added))
{
added = true;
}
}
if (!added)
{
offset++;
}
}
/*
* This conditional ensures that we only process items within any
* constraints specified by 'offset' and 'limit' parameters.
*/
else if ((index >= offset) && ((limit == 0) || (itemCounter < limit)))
{
HarvestedItemInfo itemInfo = new HarvestedItemInfo();
itemInfo.context = context;
itemInfo.handle = row.getStringColumn("handle");
itemInfo.itemID = row.getIntColumn("resource_id");
itemInfo.datestamp = row.getDateColumn("last_modified");
itemInfo.withdrawn = row.getBooleanColumn("withdrawn");
if (collections)
{
fillCollections(context, itemInfo);
}