}
@Override
@SuppressWarnings("unchecked")
public PageList<Event> findEventsByCriteria(Subject subject, EventCriteria criteria) {
CriteriaQueryGenerator generator = new CriteriaQueryGenerator(subject, criteria);
;
if (authorizationManager.isInventoryManager(subject) == false) {
generator.setAuthorizationResourceFragment(CriteriaQueryGenerator.AuthorizationTokenType.RESOURCE,
"source.resource", subject.getId());
}
CriteriaQueryRunner<Event> queryRunner = new CriteriaQueryRunner(criteria, generator, entityManager);
return queryRunner.execute();