tempInfoExam = Cloner.copyIExam2InfoExam(tempExam);
tempInfoExam = InfoExamWithRoomOccupationsAndScopesWithCurricularCoursesWithDegreeAndSemesterAndYear.newInfoFromDomain(tempExam);
    public InfoViewExam run(Calendar day, Calendar beginning, Calendar end) throws ExcepcaoPersistencia {        InfoViewExam infoViewExam = new InfoViewExam();        List infoViewExams = new ArrayList();        ISuportePersistente sp = PersistenceSupportFactory.getDefaultPersistenceSupport();        IPersistentEnrollment persistentEnrolment = sp.getIPersistentEnrolment();        // Read exams on requested day, start and end time        List exams = sp.getIPersistentExam().readBy(day, beginning, end);        IExam tempExam = null;        InfoExam tempInfoExam = null;        // List tempAssociatedCurricularCourses = null;        IDegree tempDegree = null;        List tempInfoExecutionCourses = null;        List tempInfoDegrees = null;        // Integer numberStudentesAttendingCourse = null;        int totalNumberStudents = 0;        // For every exam return:        // - exam info        // - degrees associated with exam        // - number of students attending course (potentially attending        // exam)        for (int i = 0; i < exams.size(); i++) {            // prepare exam info            tempExam = (IExam) exams.get(i);            tempInfoExam = Cloner.copyIExam2InfoExam(tempExam);            tempInfoDegrees = new ArrayList();            tempInfoExecutionCourses = new ArrayList();            // int totalNumberStudentsForExam = 0;            IExecutionPeriod executionPeriod = tempExam.getAssociatedExecutionCourses().get(0)                    .getExecutionPeriod();            if (tempExam.getAssociatedExecutionCourses() != null) {                for (int k = 0; k < tempExam.getAssociatedExecutionCourses().size(); k++) {                    IExecutionCourse executionCourse = tempExam.getAssociatedExecutionCourses().get(k);                    tempInfoExecutionCourses.add(Cloner.get(executionCourse));                }            }            int numberOfStudentsForExam = 0;            List curricularCourseIDs = new ArrayList();            for (int j = 0; j < tempExam.getAssociatedCurricularCourseScope().size(); j++) {                ICurricularCourseScope scope = tempExam.getAssociatedCurricularCourseScope().get(j);                if (!curricularCourseIDs.contains(scope.getCurricularCourse().getIdInternal())) {                    curricularCourseIDs.add(scope.getCurricularCourse().getIdInternal());                    List enroledStudents = persistentEnrolment                            .readByCurricularCourseAndExecutionPeriod(scope.getCurricularCourse()                                    .getIdInternal(), executionPeriod.getIdInternal());                    numberOfStudentsForExam += enroledStudents.size();                    tempDegree = scope.getCurricularCourse().getDegreeCurricularPlan().getDegree();                    tempInfoDegrees.add(Cloner.copyIDegree2InfoDegree(tempDegree));                }            }            totalNumberStudents += numberOfStudentsForExam;            // add exam and degree info to result list            infoViewExams.add(new InfoViewExamByDayAndShift(tempInfoExam, tempInfoExecutionCourses,                    tempInfoDegrees, new Integer(numberOfStudentsForExam)));        }        infoViewExam.setInfoViewExamsByDayAndShift(infoViewExams);        // Read all rooms to determine total exam capacity        // TODO : This can be done more efficiently.        List rooms = sp.getISalaPersistente().readAll();        int totalExamCapacity = 0;        for (int i = 0; i < rooms.size(); i++) {            IRoom room = (IRoom) rooms.get(i);            if (!room.getTipo().equals(new TipoSala(TipoSala.LABORATORIO))) {                totalExamCapacity += room.getCapacidadeExame().intValue();            }        }        infoViewExam.setAvailableRoomOccupation(new Integer(totalExamCapacity - totalNumberStudents));        return infoViewExam;    }