Map<Integer, Resource> loadResourceMap(final Subject subject, Integer[] resourceIds) {
ResourceCriteria criteria = new ResourceCriteria();
criteria.addFilterIds(resourceIds);
final ResourceManagerLocal resourceMgr = getResourceManager();
//Use CriteriaQuery to automatically chunk/page through criteria query results
CriteriaQueryExecutor<Resource, ResourceCriteria> queryExecutor = new CriteriaQueryExecutor<Resource, ResourceCriteria>() {
@Override
public PageList<Resource> execute(ResourceCriteria criteria) {
return resourceMgr.findResourcesByCriteria(subject, criteria);
}
};
CriteriaQuery<Resource, ResourceCriteria> resources = new CriteriaQuery<Resource, ResourceCriteria>(criteria,
queryExecutor);