private List<Issue> searchIssues(User visitor, Long creator, Long assignee, String title, String priority, String status) {
        CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
        CriteriaQuery<Issue> criteriaQuery = criteriaBuilder.createQuery(Issue.class);
        
        Root<Issue> from = criteriaQuery.from(Issue.class);
        
        List<Predicate> predicates = new ArrayList<Predicate>();
        
        if (!Utils.isEmpty(creator)) {
            predicates.add(criteriaBuilder.equal(from.get("creator"), creator));
        }
        
        if (!Utils.isEmpty(assignee)) {
            predicates.add(criteriaBuilder.equal(from.get("assignee"), assignee));
        }
        
        if (!Utils.isEmpty(title)) {
            predicates.add(criteriaBuilder.like(from.<String>get("title"), "%" + title + "%"));
        }
        
        if (!Utils.isEmpty(priority)) {
            predicates.add(criteriaBuilder.equal(from.get("priority"), Priority.valueOf(priority)));
        }
        
        if (!Utils.isEmpty(status)) {
            predicates.add(criteriaBuilder.equal(from.get("status"), Status.valueOf(status)));
        }
        
        if (predicates.size() > 0) {
            criteriaQuery.where(predicates.toArray(new Predicate[predicates.size()]));
        }
        
        TypedQuery<Issue> typedQuery = entityManager.createQuery(criteriaQuery.select(from));
        
        List<Issue> issues = typedQuery.getResultList();
        
        issues = Utils.filter(issues, new IssuesFilter(visitor));
        
        Collections.sort(issues, new IssuesComparator());
        
        return issues;
    }