if (setSpec.startsWith("col_"))
{
try
{
DSpaceObject dso = handleResolver.resolve(setSpec.replace("col_", ""));
return new DatabaseFilterResult(
"EXISTS (SELECT tmp.* FROM collection2item tmp WHERE tmp.resource_id=i.item_id AND collection_id = ?)",
dso.getID());
}
catch (Exception ex)
{
log.error(ex.getMessage(), ex);
}
}
else if (setSpec.startsWith("com_"))
{
try
{
DSpaceObject dso = handleResolver.resolve(setSpec.replace("com_", ""));
List<Integer> list = collectionsService.getAllSubCollections(dso.getID());
String subCollections = StringUtils.join(list.iterator(), ",");
return new DatabaseFilterResult(
"EXISTS (SELECT tmp.* FROM collection2item tmp WHERE tmp.resource_id=i.item_id AND collection_id IN ("
+ subCollections + "))");
}
catch (Exception e)
{
log.error(e.getMessage(), e);
}
}
return new DatabaseFilterResult();
}