IShift turno = (IShift) arg0; return InfoShift.newInfoFromDomain(turno);
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;
    public SiteView run(Integer executionCourseId, String userLogged) throws FenixServiceException {        SiteView siteView;        try {            ISuportePersistente sp = PersistenceSupportFactory.getDefaultPersistenceSupport();            IPersistentExecutionCourse persistentExecutionCourse = sp.getIPersistentExecutionCourse();            IExecutionCourse executionCourse = (IExecutionCourse) persistentExecutionCourse.readByOID(                    ExecutionCourse.class, executionCourseId);            if (executionCourse == null) {                throw new FenixServiceException("no.executionCourse");            }            IPersistentSite persistentSite = sp.getIPersistentSite();            ISite site = persistentSite.readByExecutionCourse(executionCourse);            if (site == null) {                throw new FenixServiceException("no.site");            }            ITurnoPersistente persistentShift = sp.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) {                        IShift turno = (IShift) arg0;                        return InfoShift.newInfoFromDomain(turno);                    }                });            }            IPersistentProfessorship persistentProfessorship = sp.getIPersistentProfessorship();            List infoProfessorships = new ArrayList();            ISalaPersistente persistentRoom = sp.getISalaPersistente();            List rooms = persistentRoom.readAll();            List infoRooms = new ArrayList();            if (rooms != null && rooms.size() > 0) {                infoRooms = (List) CollectionUtils.collect(rooms, new Transformer() {                    public Object transform(Object arg0) {                        IRoom room = (IRoom) arg0;                        return Cloner.copyRoom2InfoRoom(room);                    }                });            }            Collections.sort(infoRooms, new BeanComparator("nome"));            //teacher logged            IPersistentTeacher persistentTeacher = sp.getIPersistentTeacher();            ITeacher teacher = persistentTeacher.readTeacherByUsername(userLogged);            Integer professorshipSelect = null;            if (teacher != null) {                IProfessorship professorship = persistentProfessorship.readByTeacherAndExecutionCourse(                        teacher, executionCourse);                if (professorship != null) {                    professorshipSelect = professorship.getIdInternal();                    infoProfessorships.add(Cloner.copyIProfessorship2InfoProfessorship(professorship));                }            }            InfoSiteSummaries bodyComponent = new InfoSiteSummaries();            bodyComponent.setExecutionCourse((InfoExecutionCourse) Cloner.get(executionCourse));            bodyComponent.setInfoShifts(infoShifts);            bodyComponent.setInfoProfessorships(infoProfessorships);            bodyComponent.setInfoRooms(infoRooms);            bodyComponent.setTeacherId(professorshipSelect);            TeacherAdministrationSiteComponentBuilder componentBuilder = TeacherAdministrationSiteComponentBuilder                    .getInstance();            ISiteComponent commonComponent = componentBuilder.getComponent(new InfoSiteCommon(), site,                    null, null, null);            siteView = new ExecutionCourseSiteView(commonComponent, bodyComponent);        } catch (Exception e) {            e.printStackTrace();            throw new FenixServiceException(e.getMessage());        }        return siteView;    }