List teachers = department.getTeachers();
List teachers = department.getCurrentTeachers();
    public List run(Integer departmentId, Integer executionYearId) throws FenixServiceException,            ExcepcaoPersistencia {        ISuportePersistente ps = PersistenceSupportFactory.getDefaultPersistenceSupport();        IPersistentObject persistentObject = ps.getIPersistentObject();        //Execution Year        IExecutionYear executionYear = null;        if (executionYearId != null) {            executionYear = (IExecutionYear) persistentObject.readByOID(ExecutionYear.class,                    executionYearId);        }        //Departement        IDepartment department = (IDepartment) persistentObject                .readByOID(Department.class, departmentId);                List teachers = department.getTeachers();        Iterator iter = teachers.iterator();        IPersistentProfessorship persistentProfessorship = ps.getIPersistentProfessorship();                List professorships = new ArrayList();        List responsibleFors = new ArrayList();        while (iter.hasNext()) {            ITeacher teacher = (ITeacher) iter.next();            List teacherProfessorships = null;            if (executionYear == null) {                teacherProfessorships = persistentProfessorship.readByTeacher(teacher.getIdInternal());            } else {                teacherProfessorships = persistentProfessorship.readByTeacherAndExecutionYear(teacher                        .getIdInternal(), executionYear.getIdInternal());            }            if (teacherProfessorships != null) {                professorships.addAll(teacherProfessorships);            }            List teacherResponsibleFors = null;            List<IProfessorship> teacherResponsibleForsAux = null;            if (executionYear == null) {                teacherResponsibleFors = teacher.responsibleFors();            } else {                teacherResponsibleForsAux = teacher.responsibleFors();                 for(IProfessorship professorship : teacherResponsibleForsAux){                    if(professorship.getExecutionCourse().getExecutionPeriod().getExecutionYear().equals(executionYear));                        teacherResponsibleFors.add(professorship);                }                               }            if (teacherResponsibleFors != null) {                responsibleFors.addAll(teacherResponsibleFors);            }        }        List detailedProfessorships = getDetailedProfessorships(professorships, responsibleFors, ps);        Collections.sort(detailedProfessorships, new Comparator() {            public int compare(Object o1, Object o2) {                DetailedProfessorship detailedProfessorship1 = (DetailedProfessorship) o1;                DetailedProfessorship detailedProfessorship2 = (DetailedProfessorship) o2;                int result = detailedProfessorship1.getInfoProfessorship().getInfoExecutionCourse()                        .getIdInternal().intValue()                        - detailedProfessorship2.getInfoProfessorship().getInfoExecutionCourse()                                .getIdInternal().intValue();                if (result == 0                        && (detailedProfessorship1.getResponsibleFor().booleanValue() || detailedProfessorship2                                .getResponsibleFor().booleanValue())) {                    if (detailedProfessorship1.getResponsibleFor().booleanValue()) {                        return -1;                    }                    if (detailedProfessorship2.getResponsibleFor().booleanValue()) {                        return 1;                    }                }                return result;            }        });        List result = new ArrayList();        iter = detailedProfessorships.iterator();        List temp = new ArrayList();        while (iter.hasNext()) {            DetailedProfessorship detailedProfessorship = (DetailedProfessorship) iter.next();            if (temp.isEmpty()                    || ((DetailedProfessorship) temp.get(temp.size() - 1)).getInfoProfessorship()                            .getInfoExecutionCourse().equals(                                    detailedProfessorship.getInfoProfessorship()                                            .getInfoExecutionCourse())) {                temp.add(detailedProfessorship);            } else {                result.add(temp);                temp = new ArrayList();                temp.add(detailedProfessorship);            }        }        if (!temp.isEmpty()) {            result.add(temp);        }        return result;    }