List summariesByExecutionCourseBySummaryType = persistentSummary .readByExecutionCourseAndType(executionCourse, new TipoAula(summaryType));
TeacherAdministrationSiteComponentBuilder componentBuilder = TeacherAdministrationSiteComponentBuilder .getInstance(); ISiteComponent commonComponent = componentBuilder.getComponent(new InfoSiteCommon(), site, null, null, null); SiteView siteView = new ExecutionCourseSiteView(commonComponent, bodyComponent);
    public SiteView run(Integer teacherNumber, Integer executionCourseId, Integer summaryType, Integer shiftId) throws FenixServiceException {        try {       	            ISuportePersistente persistentSuport = PersistenceSupportFactory.getDefaultPersistenceSupport();                        IPersistentTeacher persistentTeacher = persistentSuport.getIPersistentTeacher();            ITeacher teacher = persistentTeacher.readByNumber(teacherNumber);                        if(teacher == null)            	throw new FenixServiceException("no.shift");                        IPersistentExecutionCourse persistentExecutionCourse = persistentSuport                    .getIPersistentExecutionCourse();            IExecutionCourse executionCourse = (IExecutionCourse) persistentExecutionCourse.readByOID(                    ExecutionCourse.class, executionCourseId);                        if (executionCourse == null) {                throw new FenixServiceException("no.executionCourse");            }                        //execution courses's lesson types for display to filter summary            List lessonTypes = findLessonTypesExecutionCourse(executionCourse);                        IPersistentSite persistentSite = persistentSuport.getIPersistentSite();            ISite site = persistentSite.readByExecutionCourse(executionCourse);                       if (site == null) {                throw new FenixServiceException("no.site");            }	                       //execution courses's shifts for display to filter summary            ITurnoPersistente persistentShift = persistentSuport.getITurnoPersistente();            List shifts = persistentShift.readByExecutionCourse(executionCourse);            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;                    }                });            }            IPersistentSummary persistentSummary = persistentSuport.getIPersistentSummary();            List summaries = null;            if (summaryType != null && summaryType.intValue() > 0) {                List summariesBySummaryType = persistentSummary                        .readByExecutionCourseShiftsAndTypeLesson(executionCourse, new TipoAula(                                summaryType));                //read summary also by execution course key                //and add to the last list                List summariesByExecutionCourseBySummaryType = persistentSummary                        .readByExecutionCourseAndType(executionCourse, new TipoAula(summaryType));                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(executionCourse, shiftSelected);                List summariesByExecutionCourseByShift = findLesson(persistentSummary, executionCourse,                        shiftSelected);                if (summaries != null) {                    summaries = (List) CollectionUtils.intersection(summaries, allSummaries(                            summariesByShift, summariesByExecutionCourseByShift));                } else {                    summaries = allSummaries(summariesByShift, summariesByExecutionCourseByShift);                }            }            if (teacherNumber != null && teacherNumber.intValue() > 0) {          		                List summariesByProfessorship = persistentSummary.readByTeacher(executionCourse, teacher);                if (summaries != null) {                    summaries = (List) CollectionUtils.intersection(summaries, summariesByProfessorship);                } else {                    summaries = summariesByProfessorship;                }            }                        List responsibleTeachers = executionCourse.getResponsibleTeachers();            boolean responsible = false;            for (Iterator iter = responsibleTeachers.iterator(); iter.hasNext();) {				IResponsibleFor element = (IResponsibleFor) iter.next();								if (element.getTeacher().equals(teacher)){					responsible = true;					break;				}			}            			if(responsible){				List summariesByTeacher = persistentSummary.readByOtherTeachers(executionCourse);                               if (summaries != null) {                	                          	summaries.addAll(summariesByTeacher);                } else {                    summaries = summariesByTeacher;                }	                                  }            if ((summaryType == null || summaryType.intValue() == 0)                    && (shiftId == null || shiftId.intValue() == 0)                    && (teacherNumber == null || teacherNumber.intValue() == 0)) {                summaries = persistentSummary.readByExecutionCourseShifts(executionCourse);                List summariesByExecutionCourse = persistentSummary                        .readByExecutionCourse(executionCourse);                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(new ArrayList());            TeacherAdministrationSiteComponentBuilder componentBuilder = TeacherAdministrationSiteComponentBuilder                    .getInstance();            ISiteComponent commonComponent = componentBuilder.getComponent(new InfoSiteCommon(), site,                    null, null, null);            SiteView siteView = new ExecutionCourseSiteView(commonComponent, bodyComponent);            return siteView;        } catch (ExcepcaoPersistencia e) {            e.printStackTrace();            throw new FenixServiceException(e);        }    }