Person person = Person.readPersonByUsername(username); if (person == null) { throw new NonExistingServiceException("noPerson"); }
final Person person = Person.readPersonByUsername(username); final ExecutionCourse executionCourse = rootDomainObject.readExecutionCourseByOID(executionCourseOID); final CurricularCourse curricularCourse = (CurricularCourse) rootDomainObject.readDegreeModuleByOID(curricularCourseOID); final ExecutionYear currentExecutionYear = ExecutionYear.readCurrentExecutionYear();
    public boolean run(Integer infoExecutionCourseCode, Integer infoCurricularCourseCode,            InfoCurriculum infoCurriculumNew, String username) throws FenixServiceException,            ExcepcaoPersistencia {        // Person who change all information        Person person = Person.readPersonByUsername(username);        if (person == null) {            throw new NonExistingServiceException("noPerson");        }        // inexistent new information        if (infoCurriculumNew == null) {            throw new FenixServiceException("nullCurriculum");        }        // Curricular Course        if (infoCurricularCourseCode == null) {            throw new FenixServiceException("nullCurricularCourseCode");        }        CurricularCourse curricularCourse = (CurricularCourse) rootDomainObject.readDegreeModuleByOID(infoCurricularCourseCode);        if (curricularCourse == null) {            throw new NonExistingServiceException("noCurricularCourse");        }        // Curriculum               Curriculum curriculum = curricularCourse.findLatestCurriculum();        // information doesn't exists, so it's necessary create it        if (curriculum == null) {            curriculum = curricularCourse.insertCurriculum("", "", "", "", "", "");        }        ExecutionYear currentExecutionYear = ExecutionYear.readCurrentExecutionYear();        if (!curriculum.getLastModificationDate().before(currentExecutionYear.getBeginDate())                && !curriculum.getLastModificationDate().after(currentExecutionYear.getEndDate())) {            curriculum.edit(curriculum.getGeneralObjectives(), curriculum.getOperacionalObjectives(),                    infoCurriculumNew.getProgram(), curriculum.getGeneralObjectivesEn(), curriculum                            .getOperacionalObjectivesEn(), infoCurriculumNew.getProgramEn());            curriculum.edit(curriculum.getGeneralObjectives(), curriculum.getOperacionalObjectives(),                    infoCurriculumNew.getProgram(), curriculum.getGeneralObjectivesEn(), curriculum                            .getOperacionalObjectivesEn(), infoCurriculumNew.getProgramEn());        } else {            Curriculum newCurriculum;            newCurriculum = curricularCourse.insertCurriculum(infoCurriculumNew.getProgram(),                    infoCurriculumNew.getProgramEn(), curriculum.getOperacionalObjectives(), curriculum                            .getOperacionalObjectivesEn(), curriculum.getGeneralObjectivesEn(), curriculum                            .getGeneralObjectivesEn());            newCurriculum.setPersonWhoAltered(person);        }        return true;    }