final ILesson lesson = (ILesson) iterator.next(); final InfoLesson infoLesson = InfoLesson.newInfoFromDomain(lesson); final InfoRoom infoRoom = InfoRoom.newInfoFromDomain(lesson.getSala()); infoLesson.setInfoSala(infoRoom); infoShift.getInfoLessons().add(infoLesson); } return infoShift;
final ILesson lesson = (ILesson) iterator.next(); final InfoLesson infoLesson = InfoLesson.newInfoFromDomain(lesson); final InfoRoom infoRoom = InfoRoom.newInfoFromDomain(lesson.getSala()); infoLesson.setInfoSala(infoRoom); infoShift.getInfoLessons().add(infoLesson);
    public SiteView run(Integer executionCourseId, String summaryType, Integer shiftId,            Integer professorShiftId) throws FenixServiceException, ExcepcaoPersistencia {                    ISuportePersistente persistentSuport = PersistenceSupportFactory.getDefaultPersistenceSupport();            IPersistentExecutionCourse persistentExecutionCourse = persistentSuport            .getIPersistentExecutionCourse();            IExecutionCourse executionCourse = (IExecutionCourse) persistentExecutionCourse.readByOID(                    ExecutionCourse.class, executionCourseId);            if (executionCourse == null) {                throw new FenixServiceException("no.executionCourse");            }                        IPersistentSite persistentSite = persistentSuport.getIPersistentSite();        ISite site = persistentSite.readByExecutionCourse(executionCourseId);            if (site == null) {                throw new FenixServiceException("no.site");            }                        //execution courses's lesson types for display to filter summary            List lessonTypes = findLessonTypesExecutionCourse(executionCourse);                        //execution courses's shifts for display to filter summary            ITurnoPersistente persistentShift = persistentSuport.getITurnoPersistente();        List shifts = persistentShift.readByExecutionCourse(executionCourse.getIdInternal());            List infoShifts = new ArrayList();            if (shifts != null && shifts.size() > 0) {                infoShifts = (List) CollectionUtils.collect(shifts, new Transformer() {                                        public Object transform(Object arg0) {                        final IShift turno = (IShift) arg0;                        final InfoShift infoShift = InfoShift.newInfoFromDomain(turno);                        infoShift.setInfoLessons(new ArrayList(turno.getAssociatedLessons().size()));                    for (final Iterator iterator = turno.getAssociatedLessons().iterator(); iterator                            .hasNext();) {                            final ILesson lesson = (ILesson) iterator.next();                            final InfoLesson infoLesson = InfoLesson.newInfoFromDomain(lesson);                            final InfoRoom infoRoom = InfoRoom.newInfoFromDomain(lesson.getSala());                            infoLesson.setInfoSala(infoRoom);                            infoShift.getInfoLessons().add(infoLesson);                        }                        return infoShift;                    }                });            }                        //execution courses's professorships for display to filter summary            IPersistentProfessorship persistentProfessorship = persistentSuport            .getIPersistentProfessorship();        List<IProfessorship> professorships = persistentProfessorship.readByExecutionCourse(executionCourseId);            List infoProfessorships = new ArrayList();            if (professorships != null && professorships.size() > 0) {                infoProfessorships = (List) CollectionUtils.collect(professorships, new Transformer() {                                        public Object transform(Object arg0) {                        IProfessorship professorship = (IProfessorship) arg0;                        return InfoProfessorshipWithAll.newInfoFromDomain(professorship);                    }                });            }                        IPersistentSummary persistentSummary = persistentSuport.getIPersistentSummary();            List summaries = null;                 if (summaryType!= null && !summaryType.equals("0")) {            ShiftType sumaryType = ShiftType.valueOf(summaryType);                   List summariesBySummaryType = persistentSummary.readByExecutionCourseShiftsAndTypeLesson(                    executionCourseId, sumaryType);                                //read summary also by execution course key                //and add to the last list                List summariesByExecutionCourseBySummaryType = persistentSummary                    .readByExecutionCourseAndType(executionCourseId, sumaryType);                                summaries = allSummaries(summariesBySummaryType, summariesByExecutionCourseBySummaryType);            }                      if (shiftId != null && shiftId.intValue() > 0) {                IShift shiftSelected = (IShift) persistentShift.readByOID(Shift.class, shiftId);                if (shiftSelected == null) {                    throw new FenixServiceException("no.shift");                }                            List summariesByShift = persistentSummary.readByShift(executionCourseId, shiftSelected                    .getIdInternal());                                List summariesByExecutionCourseByShift = findLesson(persistentSummary, executionCourse,                        shiftSelected);                                if (summaries != null) {                    summaries = (List) CollectionUtils.intersection(summaries, allSummaries(                            summariesByShift, summariesByExecutionCourseByShift));                } else {                    summaries = allSummaries(summariesByShift, summariesByExecutionCourseByShift);                }            }                    summaries = readTeacherSummaries(executionCourseId, professorShiftId, persistentProfessorship, persistentSummary, summaries);                        summaries = readSummariesOfOtherTeachers(executionCourseId, professorShiftId, persistentSummary, summaries);                                summaries = readSummariesOfOtherTeachersIfResponsible(executionCourseId, professorShiftId, persistentSuport, persistentSummary, summaries, professorships);                        if ((summaryType == null)                    && (shiftId == null || shiftId.intValue() == 0)                    && (professorShiftId == null || professorShiftId.intValue() == 0)) {            summaries = persistentSummary.readByExecutionCourseShifts(executionCourseId);                        List summariesByExecutionCourse = persistentSummary.readByExecutionCourse(executionCourseId);                                summaries = allSummaries(summaries, summariesByExecutionCourse);            }                        List result = new ArrayList();            if (summaries != null && summaries.size() > 0) {                Iterator iter = summaries.iterator();                while (iter.hasNext()) {                    ISummary summary = (ISummary) iter.next();                    InfoSummary infoSummary = InfoSummary.newInfoFromDomain(summary);					                    result.add(infoSummary);                }            }                        InfoSiteSummaries bodyComponent = new InfoSiteSummaries();            bodyComponent.setInfoSummaries(result);            bodyComponent.setExecutionCourse((InfoExecutionCourse) Cloner.get(executionCourse));            bodyComponent.setLessonTypes(lessonTypes);            bodyComponent.setInfoShifts(infoShifts);            bodyComponent.setInfoProfessorships(infoProfessorships);                        TeacherAdministrationSiteComponentBuilder componentBuilder = TeacherAdministrationSiteComponentBuilder            .getInstance();        ISiteComponent commonComponent = componentBuilder.getComponent(new InfoSiteCommon(), site, null,                null, null);            SiteView siteView = new ExecutionCourseSiteView(commonComponent, bodyComponent);                        return siteView;        }