IEnrolment enrolment = (IEnrolment) obj;
IEnrollment enrolment = (IEnrollment) obj;
	public Object run(		InfoStudent infoStudent,		TipoCurso degreeType,		InfoExecutionYear infoExecutionYear,		Integer executionDegreeID,		List curricularYearsList,		List curricularSemestersList)		throws FenixServiceException	{		InfoStudentEnrolmentContext infoStudentEnrolmentContext = null;		try		{			ISuportePersistente sp = SuportePersistenteOJB.getInstance();			//Execution Degree			ICursoExecucaoPersistente persistentExecutionDegree = sp.getICursoExecucaoPersistente();			ICursoExecucao executionDegree = new CursoExecucao();			executionDegree.setIdInternal(executionDegreeID);			executionDegree =				(ICursoExecucao) persistentExecutionDegree.readByOId(executionDegree, false);			if (executionDegree == null)			{				throw new FenixServiceException("error.degree.noData");			}			//Degree Curricular Plan			IDegreeCurricularPlan degreeCurricularPlan = executionDegree.getCurricularPlan();//			IPersistentDegreeCurricularPlan persistentDegreeCurricularPlan =//				sp.getIPersistentDegreeCurricularPlan();//			IDegreeCurricularPlan degreeCurricularPlan = new DegreeCurricularPlan();//			degreeCurricularPlan.setIdInternal(executionDegree.getCurricularPlan().getIdInternal());//			degreeCurricularPlan =//				(IDegreeCurricularPlan) persistentDegreeCurricularPlan.readByOId(//					degreeCurricularPlan,//					false);			if (degreeCurricularPlan == null && degreeCurricularPlan.getCurricularCourses() == null)			{				throw new FenixServiceException("error.degree.noData");			}			// filters a list of curricular courses by all of its scopes that			// matters in relation to the selected semester and the selected year.			List curricularCoursesFromDegreeCurricularPlan = null;			if ((curricularYearsList == null || curricularYearsList.size() <= 0)				&& (curricularSemestersList == null || curricularSemestersList.size() <= 0))			{				curricularCoursesFromDegreeCurricularPlan = filterOptionalCourses(degreeCurricularPlan.getCurricularCourses());			}			else			{				final List curricularYearsListFinal = verifyYears(curricularYearsList);				final List curricularSemestersListFinal = verifySemesters(curricularSemestersList);				List result =					(						List) CollectionUtils							.select(degreeCurricularPlan.getCurricularCourses(), new Predicate()				{					public boolean evaluate(Object arg0)					{						boolean result = false;						if (arg0 instanceof ICurricularCourse)						{							ICurricularCourse curricularCourse = (ICurricularCourse) arg0;							List scopes = curricularCourse.getScopes();							Iterator iter = scopes.iterator();							while (iter.hasNext() && !result)							{								ICurricularCourseScope scope = (ICurricularCourseScope) iter.next();								if (curricularSemestersListFinal									.contains(scope.getCurricularSemester().getSemester())									&& curricularYearsListFinal.contains(										scope.getCurricularSemester().getCurricularYear().getYear()))								{									result = true;								}							}						}						return result;					}				});								curricularCoursesFromDegreeCurricularPlan = filterOptionalCourses(result);			}			//Student Curricular Plan			IStudentCurricularPlanPersistente persistentStudentCurricularPlan =				sp.getIStudentCurricularPlanPersistente();			IStudentCurricularPlan studentCurricularPlan = null;			if (infoStudent != null && infoStudent.getNumber() != null)			{				studentCurricularPlan =					persistentStudentCurricularPlan.readActiveByStudentNumberAndDegreeType(						infoStudent.getNumber(),						degreeType);			}			if (studentCurricularPlan == null)			{				throw new FenixServiceException("error.student.curriculum.noCurricularPlans");			}			IPersistentEnrolment persistentEnrolment = sp.getIPersistentEnrolment();			// Enrolments that have state APROVED and ENROLLED are to be subtracted from list of			// possible choices.			List enrollmentsEnrolled =				persistentEnrolment.readEnrolmentsByStudentCurricularPlanAndEnrolmentState(					studentCurricularPlan,					EnrolmentState.ENROLED);			List enrollmentsAproved =				persistentEnrolment.readEnrolmentsByStudentCurricularPlanAndEnrolmentState(					studentCurricularPlan,					EnrolmentState.APROVED);			List enrollmentsEnrolledAndAproved = new ArrayList();			enrollmentsEnrolledAndAproved.addAll(enrollmentsEnrolled);			enrollmentsEnrolledAndAproved.addAll(enrollmentsAproved);			List curricularCoursesFromEnrolmentsWithStateEnroledAndAproved =				(List) CollectionUtils.collect(enrollmentsEnrolledAndAproved, new Transformer()			{				public Object transform(Object obj)				{					IEnrolment enrolment = (IEnrolment) obj;					return enrolment.getCurricularCourse();				}			});			List possibleCurricularCoursesToChoose =				(List) CollectionUtils.subtract(					curricularCoursesFromDegreeCurricularPlan,					curricularCoursesFromEnrolmentsWithStateEnroledAndAproved);			infoStudentEnrolmentContext =				buildResult(studentCurricularPlan, possibleCurricularCoursesToChoose);			if (infoStudentEnrolmentContext == null)			{				throw new FenixServiceException("");			}		}		catch (ExcepcaoPersistencia e)		{			e.printStackTrace();			throw new FenixServiceException("");		}		return infoStudentEnrolmentContext;	}