while (previousExecutionPeriod.getExecutionYear().equals(actualExecutionPeriod.getExecutionYear())) { previousExecutionPeriod = previousExecutionPeriod.getPreviousExecutionPeriod(); }
    public SiteView run(String user, String argExecutionYear) throws FenixServiceException {        try {            InfoSiteTeacherInformation infoSiteTeacherInformation = new InfoSiteTeacherInformation();            ISuportePersistente sp = SuportePersistenteOJB.getInstance();            IPersistentTeacher persistentTeacher = sp.getIPersistentTeacher();            ITeacher teacher = persistentTeacher.readTeacherByUsername(user);            // if no execution year is specified, the info shown should refer to            // the previous execution year            IPersistentExecutionYear persistentExecutionYear = sp.getIPersistentExecutionYear();            IExecutionYear executionYear = null;            if (argExecutionYear.equals("")) {                IPersistentExecutionPeriod persistentExecutionPeriod = sp                        .getIPersistentExecutionPeriod();                IExecutionPeriod actualExecutionPeriod = persistentExecutionPeriod                        .readActualExecutionPeriod();                IExecutionPeriod previousExecutionPeriod = actualExecutionPeriod                        .getPreviousExecutionPeriod();                // FIXME this will not work on the second semester of an                // execution year!!                executionYear = previousExecutionPeriod.getExecutionYear();            } else                executionYear = persistentExecutionYear.readExecutionYearByName(argExecutionYear);            InfoTeacher infoTeacher = InfoTeacherWithPersonAndCategory.newInfoFromDomain(teacher);            infoSiteTeacherInformation.setInfoTeacher(infoTeacher);            infoSiteTeacherInformation.setInfoQualifications(getInfoQualifications(sp, teacher));            infoSiteTeacherInformation.setInfoProfessionalCareers(getInfoCareers(sp, teacher,                    CareerType.PROFESSIONAL));            infoSiteTeacherInformation.setInfoTeachingCareers(getInfoCareers(sp, teacher,                    CareerType.TEACHING));            IPersistentServiceProviderRegime persistentServiceProviderRegime = sp                    .getIPersistentServiceProviderRegime();            IServiceProviderRegime serviceProviderRegime = persistentServiceProviderRegime                    .readByTeacher(teacher);            if (serviceProviderRegime == null) {                InfoServiceProviderRegime infoServiceProviderRegime = new InfoServiceProviderRegime();                infoServiceProviderRegime.setInfoTeacher(infoTeacher);                infoSiteTeacherInformation.setInfoServiceProviderRegime(infoServiceProviderRegime);            } else {                InfoServiceProviderRegime infoServiceProviderRegime = InfoServiceProviderRegime                        .newInfoFromDomain(serviceProviderRegime);                infoSiteTeacherInformation.setInfoServiceProviderRegime(infoServiceProviderRegime);            }            infoSiteTeacherInformation.setInfoExternalActivities(getInfoExternalActivities(sp, teacher));            infoSiteTeacherInformation                    .setInfoLecturingExecutionCourses(getInfoLecturingExecutionCourses(sp, teacher,                            executionYear));            infoSiteTeacherInformation                    .setInfoResponsibleExecutionCourses(getInfoResponsibleExecutionCourses(sp, teacher,                            executionYear));            IPersistentWeeklyOcupation persistentWeeklyOcupation = sp.getIPersistentWeeklyOcupation();            IWeeklyOcupation weeklyOcupation = persistentWeeklyOcupation.readByTeacher(teacher);            if (weeklyOcupation == null) {                InfoWeeklyOcupation infoWeeklyOcupation = new InfoWeeklyOcupation();                infoWeeklyOcupation.setInfoTeacher(infoTeacher);                infoWeeklyOcupation.setResearch(new Integer(0));                infoWeeklyOcupation.setManagement(new Integer(0));                infoWeeklyOcupation.setLecture(new Integer(0));                infoWeeklyOcupation.setSupport(new Integer(0));                infoWeeklyOcupation.setOther(new Integer(0));                infoSiteTeacherInformation.setInfoWeeklyOcupation(infoWeeklyOcupation);            } else {                //CLONER                //InfoWeeklyOcupation infoWeeklyOcupation =                //Cloner.copyIWeeklyOcupation2InfoWeeklyOcupation(weeklyOcupation);                InfoWeeklyOcupation infoWeeklyOcupation = InfoWeeklyOcupation                        .newInfoFromDomain(weeklyOcupation);                infoWeeklyOcupation.setInfoTeacher(infoTeacher);                infoSiteTeacherInformation.setInfoWeeklyOcupation(infoWeeklyOcupation);            }            infoSiteTeacherInformation.setInfoDegreeOrientation(getInfoOrientation(sp, teacher,                    OrientationType.DEGREE));            infoSiteTeacherInformation.setInfoMasterOrientation(getInfoOrientation(sp, teacher,                    OrientationType.MASTER));            infoSiteTeacherInformation.setInfoPhdOrientation(getInfoOrientation(sp, teacher,                    OrientationType.PHD));            infoSiteTeacherInformation                    .setInfoArticleChapterPublicationsNumber(getInfoPublicationsNumber(sp, teacher,                            PublicationType.ARTICLES_CHAPTERS));            infoSiteTeacherInformation.setInfoEditBookPublicationsNumber(getInfoPublicationsNumber(sp,                    teacher, PublicationType.EDITOR_BOOK));            infoSiteTeacherInformation.setInfoAuthorBookPublicationsNumber(getInfoPublicationsNumber(sp,                    teacher, PublicationType.AUTHOR_BOOK));            infoSiteTeacherInformation.setInfoMagArticlePublicationsNumber(getInfoPublicationsNumber(sp,                    teacher, PublicationType.MAG_ARTICLE));            infoSiteTeacherInformation.setInfoComunicationPublicationsNumber(getInfoPublicationsNumber(                    sp, teacher, PublicationType.COMUNICATION));            infoSiteTeacherInformation.setInfoOldCientificPublications(getInfoOldPublications(sp,                    teacher, OldPublicationType.CIENTIFIC));            infoSiteTeacherInformation.setInfoOldDidacticPublications(getInfoOldPublications(sp,                    teacher, OldPublicationType.DIDACTIC));            infoSiteTeacherInformation.setInfoDidaticPublications(getInfoPublications(sp, teacher,                    PublicationConstants.DIDATIC));            infoSiteTeacherInformation.setInfoCientificPublications(getInfoPublications(sp, teacher,                    PublicationConstants.CIENTIFIC));            IPersistentExecutionPeriod persistentExecutionPeriod = sp.getIPersistentExecutionPeriod();            IExecutionPeriod executionPeriod = persistentExecutionPeriod.readActualExecutionPeriod();            //CLONER            //infoSiteTeacherInformation.setInfoExecutionPeriod(            //(InfoExecutionPeriod) Cloner.get(executionPeriod));            // FIXME possible cause of error: this execution period is used for            // what?            infoSiteTeacherInformation.setInfoExecutionPeriod(InfoExecutionPeriodWithInfoExecutionYear                    .newInfoFromDomain((IExecutionPeriod) executionYear.getExecutionPeriods().get(0)));            return new SiteView(infoSiteTeacherInformation);        } catch (ExcepcaoPersistencia e) {            throw new FenixServiceException(e);        }    }