setEnrolmentCreationInformation(userView, auxEnrolment);
    public void run(IUserView userView, Integer studentCurricularPlanId, String currentState,            Double credits, String startDate, List extraCurricularCourses, String observations,            Integer branchId, Integer specializationInt) throws FenixServiceException {        try {            ISuportePersistente sp = SuportePersistenteOJB.getInstance();            IPersistentStudentCurricularPlan persistentStudentCurricularPlan = sp                    .getIStudentCurricularPlanPersistente();            IStudentCurricularPlan studentCurricularPlan = (IStudentCurricularPlan) persistentStudentCurricularPlan                    .readByOID(StudentCurricularPlan.class, studentCurricularPlanId, true);            if (studentCurricularPlan == null) {                throw new InvalidArgumentsServiceException();            }            StudentCurricularPlanState newState = new StudentCurricularPlanState(currentState);            IEmployee employee = null;            IPersistentEmployee persistentEmployee = sp.getIPersistentEmployee();            IPessoaPersistente persistentPerson = sp.getIPessoaPersistente();            IPersistentEnrollment persistentEnrolment = sp.getIPersistentEnrolment();            IPersistentBranch persistentBranch = sp.getIPersistentBranch();            IPessoa person = persistentPerson.lerPessoaPorUsername(userView.getUtilizador());            if (person == null) {                throw new InvalidArgumentsServiceException();            }            employee = persistentEmployee.readByPerson(person.getIdInternal().intValue());            if (employee == null) {                throw new InvalidArgumentsServiceException();            }            IBranch branch = (IBranch) persistentBranch.readByOID(Branch.class, branchId);            if (branch == null) {                throw new InvalidArgumentsServiceException();            }            studentCurricularPlan.setStartDate(stringDateToCalendar(startDate).getTime());            studentCurricularPlan.setCurrentState(newState);            studentCurricularPlan.setEmployee(employee);            studentCurricularPlan.setGivenCredits(credits);            studentCurricularPlan.setObservations(observations);            studentCurricularPlan.setBranch(branch);            studentCurricularPlan.setSpecialization(new Specialization(specializationInt));            List enrollments = studentCurricularPlan.getEnrolments();            Iterator iterator = enrollments.iterator();            if (newState.getState().intValue() == StudentCurricularPlanState.INACTIVE) {                while (iterator.hasNext()) {                    IEnrollment enrolment = (IEnrollment) iterator.next();                    if (enrolment.getEnrollmentState().getValue() == EnrollmentState.ENROLLED_TYPE                            || enrolment.getEnrollmentState().getValue() == EnrollmentState.TEMPORARILY_ENROLLED_TYPE) {                        persistentEnrolment.simpleLockWrite(enrolment);                        enrolment.setEnrollmentState(EnrollmentState.ANNULED);                    }                }            } else {                while (iterator.hasNext()) {                    IEnrollment enrolment = (IEnrollment) iterator.next();                    if (extraCurricularCourses.contains(enrolment.getIdInternal())) {                        if (!(enrolment instanceof EnrolmentInExtraCurricularCourse)) {                            persistentEnrolment.delete(enrolment);                            IEnrollment auxEnrolment = new EnrolmentInExtraCurricularCourse();                            persistentEnrolment.simpleLockWrite(auxEnrolment);                            copyEnrollment(enrolment, auxEnrolment);                            changeAnnulled2ActiveIfActivePlan(newState, persistentEnrolment,                                    auxEnrolment);                        } else {                            changeAnnulled2ActiveIfActivePlan(newState, persistentEnrolment, enrolment);                        }                    } else {                        if (enrolment instanceof EnrolmentInExtraCurricularCourse) {                            persistentEnrolment.delete(enrolment);                            IEnrollment auxEnrolment = new Enrolment();                            persistentEnrolment.simpleLockWrite(auxEnrolment);                            copyEnrollment(enrolment, auxEnrolment);                            changeAnnulled2ActiveIfActivePlan(newState, persistentEnrolment,                                    auxEnrolment);                        } else {                            changeAnnulled2ActiveIfActivePlan(newState, persistentEnrolment, enrolment);                        }                    }                }            }        } catch (ExcepcaoPersistencia e) {            throw new FenixServiceException(e);        }    }