return null;
return curricularCourseScope;
	private static ICurricularCourseScope getCurricularCourseScopeToEnrollIn(		IStudentCurricularPlan studentCurricularPlan,		MwEnrolment mwEnrolment,		ICurricularCourse curricularCourse,		IBranch branch,		SuportePersistenteOJB sp)		throws ExcepcaoPersistencia	{		boolean sameDegree = true;		IPersistentCurricularCourseScope curricularCourseScopeDAO = sp.getIPersistentCurricularCourseScope();		List curricularCourseScopes = null;		if (!curricularCourse.getDegreeCurricularPlan().equals(studentCurricularPlan.getDegreeCurricularPlan()))		{			curricularCourseScopes = curricularCourseScopeDAO.readByCurricularCourse(curricularCourse);				return (ICurricularCourseScope) curricularCourseScopes.get(0);		}		curricularCourseScopes =			curricularCourseScopeDAO.readByCurricularCourseAndYearAndSemester(				curricularCourse,				mwEnrolment.getCurricularcourseyear(),				mwEnrolment.getCurricularcoursesemester());		ICurricularCourseScope curricularCourseScope = null;		if ((curricularCourseScopes == null) || (curricularCourseScopes.isEmpty()))		{			// Try to read by Course and Year only			curricularCourseScopes = curricularCourseScopeDAO.readByCurricularCourseAndYear(curricularCourse, mwEnrolment.getCurricularcourseyear());			if ((curricularCourseScopes == null) || (curricularCourseScopes.isEmpty()))			{				// Se a disciplina da inscricao nao e do curso do aluno e nao conseguimos encontrar: 				//  - por ano e semestre				//  - por ano				// Entao vamods tentar ler so por semestre que aparece na inscricao e se exisir apenas 1				// e a que procuramos 				if (!sameDegree)				{					curricularCourseScopes =						curricularCourseScopeDAO.readByCurricularCourseAndSemester(curricularCourse, mwEnrolment.getCurricularcoursesemester());				}				if ((curricularCourseScopes != null) && (curricularCourseScopes.size() == 1))				{					curricularCourseScope = (ICurricularCourseScope) curricularCourseScopes.get(0);				} else				{					ReportEnrolment.addCurricularCourseScopeNotFound(mwEnrolment.getCoursecode(),						mwEnrolment.getDegreecode().toString(),						mwEnrolment.getNumber().toString(),						mwEnrolment.getCurricularcourseyear().toString(),						mwEnrolment.getCurricularcoursesemester().toString(),						mwEnrolment.getBranchcode().toString());					return null;				}			} else			{				// See if a Scope exists for this branch				curricularCourseScope = findScopeForBranch(curricularCourseScopes, branch);				if (curricularCourseScope == null)				{					curricularCourseScope = findScopeForBranch(curricularCourseScopes, studentCurricularPlan.getBranch());				}				// If there's no Scope, try to find the "empty" scope				if (curricularCourseScope == null)				{					curricularCourseScope = findScopeForBranch(curricularCourseScopes, null);				}				// if we can't find a scope and the degree of the course is diferent from the student's, them we ignore the branch				if ((curricularCourseScope == null)					&& (!studentCurricularPlan.getDegreeCurricularPlan().getDegree().equals(curricularCourse.getDegreeCurricularPlan().getDegree())))				{					curricularCourseScope = (ICurricularCourseScope) curricularCourseScopes.get(0);				}				// If still we cannot find a scope ...				if (curricularCourseScope == null)				{					System.out.println("Error Reading Curricular Course Scope after finding scopes by Curricular Course and Year!! ");					System.out.println("Numero do Aluno " + mwEnrolment.getNumber());					System.out.println("Codigo Curso " + mwEnrolment.getDegreecode());					System.out.println("Codigo Disciplina " + mwEnrolment.getCoursecode());					System.out.println("Codigo Ramo " + mwEnrolment.getBranchcode());					System.out.println("Ano Curricular " + mwEnrolment.getCurricularcourseyear());					System.out.println("Semestre Disciplina " + mwEnrolment.getCurricularcoursesemester());					System.out.println("Curricular Course ID " + curricularCourse.getIdInternal());					System.out.println("---------");					curricularCourseScopesNotFound++;					enrolmentNotWritten++;					return null;				}			}		} else		{			if (curricularCourseScopes.size() == 1)			{				curricularCourseScope = (ICurricularCourseScope) curricularCourseScopes.get(0);			}			// There is a list of Scopes for This Curricular Course, year and semester			// See if a Scope exists for this branch			if (curricularCourseScope == null)			{				curricularCourseScope = findScopeForBranch(curricularCourseScopes, branch);			}			if (curricularCourseScope == null)			{				curricularCourseScope = findScopeForBranch(curricularCourseScopes, studentCurricularPlan.getBranch());			}			// If there's no Scope, try to find the "empty" scope			if (curricularCourseScope == null)			{				curricularCourseScope = findScopeForBranch(curricularCourseScopes, null);			}			// if we can't find a scope and the degree of the course is diferent from the student's, them we ignore the branch			if ((curricularCourseScope == null)				&& (!studentCurricularPlan.getDegreeCurricularPlan().getDegree().equals(curricularCourse.getDegreeCurricularPlan().getDegree())))			{				curricularCourseScope = (ICurricularCourseScope) curricularCourseScopes.get(0);			}			// If still we cannot find a scope ...			if (curricularCourseScope == null)			{				System.out.println("Error Reading Curricular Course Scope after finding scopes by Curricular Course, Year and Semester!! ");				System.out.println("Numero do Aluno " + mwEnrolment.getNumber());				System.out.println("Codigo Curso " + mwEnrolment.getDegreecode());				System.out.println("Codigo Disciplina " + mwEnrolment.getCoursecode());				System.out.println("Codigo Ramo " + mwEnrolment.getBranchcode());				System.out.println("Ano Curricular " + mwEnrolment.getCurricularcourseyear());				System.out.println("Semestre Disciplina " + mwEnrolment.getCurricularcoursesemester());				System.out.println("Curricular Course ID " + curricularCourse.getIdInternal());				System.out.println("---------");				curricularCourseScopesNotFound++;				enrolmentNotWritten++;				return null;			}		}		return null;	}