if(totalPersons.intValue() > 100){
if(totalPersons.intValue() > SessionConstants.LIMIT_FINDED_PERSONS_TOTAL){
    public List run(HashMap searchParameters) throws ExcepcaoPersistencia, FenixServiceException {        ISuportePersistente sp = PersistenceSupportFactory.getDefaultPersistenceSupport();        IPessoaPersistente persistentPerson = sp.getIPessoaPersistente();        IPersistentRole persistentRole = sp.getIPersistentRole();        ICursoPersistente persistentDegree = sp.getICursoPersistente();        IPersistentDepartment persistentDepartment = sp.getIDepartamentoPersistente();        String name = (String) searchParameters.get(new String("name"));        Integer startIndex = (Integer) searchParameters.get(new String("startIndex"));        String roleType = (String) searchParameters.get(new String("roleType"));        String degreeType = (String) searchParameters.get(new String("degreeType"));        Integer degreeId = (Integer) searchParameters.get(new String("degreeId"));        Integer departmentId = (Integer) searchParameters.get(new String("departmentId"));        IRole roleBd = null;        IDegree degree = null;        IDepartment department = null;        DegreeType degreetype = null;        List<IPerson> persons = new ArrayList<IPerson>();        List<IPerson> allValidPersons = new ArrayList<IPerson>();        List<ITeacher> teachers = new ArrayList<ITeacher>();        List<Object> objects = new ArrayList<Object>();        Integer totalPersons = null;        if (roleType != null && roleType.length() > 0) {            roleBd = persistentRole.readByRoleType(RoleType.valueOf(roleType));        }        if (degreeId != null) {            degree = (IDegree) persistentDegree.readByOID(Degree.class, degreeId);        }        if (degreeType != null && degreeType.length() > 0) {            degreetype = DegreeType.valueOf(degreeType);        }        if (departmentId != null) {            department = (IDepartment) persistentDepartment.readByOID(Department.class, departmentId);        }        String[] nameWords = name.split(" ");        if (roleBd == null) {            persons = (List<IPerson>) persistentPerson.readAll(Person.class);                } else {            if (roleBd.getRoleType().equals(RoleType.TEACHER)) {                if (department != null) {                    teachers = department.getTeachers();                    for (ITeacher teacher : teachers) {                        persons.add(teacher.getPerson());                    }                } else {                    teachers = (List<ITeacher>) sp.getIPersistentTeacher().readAll(Teacher.class);                    for (ITeacher teacher : teachers) {                        persons.add(teacher.getPerson());                    }                }            }            else if (roleBd.getRoleType().equals(RoleType.EMPLOYEE)) {                List<IEmployee> employees = (List<IEmployee>) sp.getIPersistentEmployee().readAll(                        Employee.class);                for (IEmployee employee : employees) {                    persons.add(employee.getPerson());                }            }            else if (roleBd.getRoleType().equals(RoleType.STUDENT)) {                if (degreetype == null) {                    List<IStudent> students = (List<IStudent>) sp.getIPersistentStudent().readAll(                            Student.class);                    for (IStudent student : students) {                        persons.add(student.getPerson());                    }                } else {                                        List<IStudent> students = (List<IStudent>) sp.getIPersistentStudent().readAll(                            Student.class);                    persons = getValidDegreeTypePersons(degree, students, degreetype);                }            }            else if (roleBd.getRoleType().equals(RoleType.GRANT_OWNER)) {                List<IGrantOwner> grantOwners = (List<IGrantOwner>) sp.getIPersistentGrantOwner()                        .readAll(GrantOwner.class);                for (IGrantOwner grantOwner : grantOwners) {                    persons.add(grantOwner.getPerson());                }            }        }                       allValidPersons = getValidPersons(nameWords, persons);        totalPersons = allValidPersons.size();                if(totalPersons.intValue() > 100){            throw new FenixServiceException("error.search.person");        }               Collections.sort(allValidPersons, new BeanComparator("nome"));                objects = getIntervalPersons(startIndex, allValidPersons);        List<InfoPerson> infoPersons = new ArrayList<InfoPerson>();        for (IPerson person : (List<IPerson>) objects.get(0)) {            infoPersons.add(InfoPerson.newInfoFromDomain(person));        }        List<Object> result = new ArrayList<Object>(4);        result.add(0, totalPersons);        result.add(1, infoPersons);        result.add(2, objects.get(1));        result.add(3, objects.get(2));        return result;    }