throws ExcepcaoPersistencia, FenixServiceException {
throws FenixServiceException {
    public SearchPersonResults run(SearchParameters searchParameters, Predicate predicate)            throws ExcepcaoPersistencia, FenixServiceException {        final List<Person> persons;        List<Person> allValidPersons = new ArrayList<Person>();        List<Teacher> teachers = new ArrayList<Teacher>();        int totalPersons;        Role roleBd = searchParameters.getRole();        if (roleBd == null) {            roleBd = Role.getRoleByRoleType(RoleType.PERSON);        }        if ((roleBd.getRoleType() == RoleType.TEACHER) && (searchParameters.getDepartment() != null)) {            persons = new ArrayList<Person>();            teachers = searchParameters.getDepartment().getCurrentTeachers();            for (Teacher teacher : teachers) {                persons.add(teacher.getPerson());            }        } else if (roleBd.getRoleType() == RoleType.EMPLOYEE) {            persons = new ArrayList<Person>();            for (Person person : roleBd.getAssociatedPersons()) {                if (person.getTeacher() == null) {                    persons.add(person);                }            }        } else {            persons = roleBd.getAssociatedPersons();        }        allValidPersons = (List<Person>) CollectionUtils.select(persons, predicate);        totalPersons = allValidPersons.size();        if (totalPersons > SessionConstants.LIMIT_FINDED_PERSONS_TOTAL) {            throw new FenixServiceException("error.search.person");        }        Collections.sort(allValidPersons, new BeanComparator("nome"));        List<InfoPerson> infoPersons = new ArrayList<InfoPerson>();        for (Person person : (List<Person>) allValidPersons) {            infoPersons.add(InfoPerson.newInfoFromDomain(person));        }        return new SearchPersonResults(infoPersons, totalPersons);    }