System.out.println("Error ! Degree Curricular Plan Not Found !"); throw new Exception();
System.out.println("[ERROR] Degree Curricular Plan Not Found"); continue;
	private static void writeEnrolments(		List enrolments2Write,		IStudentCurricularPlan studentCurricularPlan,		MWAluno oldStudent,		SuportePersistenteOJB sp)		throws Exception	{		Iterator iterator = enrolments2Write.iterator();		while (iterator.hasNext())		{			final MwEnrolment mwEnrolment = (MwEnrolment) iterator.next();			// Get the Degree Of the Student			IDegreeCurricularPlan degreeCurricularPlan = getDegreeCurricularPlan(mwEnrolment.getDegreecode(), studentCurricularPlan, sp);			if (degreeCurricularPlan == null)			{				System.out.println("Error ! Degree Curricular Plan Not Found !");				throw new Exception();			}			// Get The Branch (This could be the student branch or the curricular course branch			IBranch branch = getBranch(mwEnrolment.getDegreecode(), mwEnrolment.getBranchcode(), degreeCurricularPlan, sp);			if (branch == null)			{				System.out.println("Error ! Branch Not Found !");				throw new Exception();			}			// Get the Curricular Course 			List curricularCourses =				sp.getIPersistentCurricularCourse().readbyCourseCodeAndDegreeCurricularPlan(					StringUtils.trim(mwEnrolment.getCoursecode()),					degreeCurricularPlan);			ICurricularCourse curricularCourse = null;			if (curricularCourses.size() != 1)			{				// if the result size is greater than 1 then check if the Branch Code match in Any				if (curricularCourses.size() > 1)				{					System.out.println("Several Curricular Courses with Code found " + mwEnrolment.getCoursecode() + " found for Degree " + mwEnrolment.getDegreecode());					curricularCoursesNotFound++;					enrolmentNotWritten++;					return;				} else				{ // size == 0					// Try to read by CourseCode Only (this will assume that all the Degree Curricular Plan name ends with "2003/2004"					IPersistentCurricularCourse curricularCourseDAO = sp.getIPersistentCurricularCourse();					curricularCourses = curricularCourseDAO.readbyCourseCode(StringUtils.trim(mwEnrolment.getCoursecode()));					if (curricularCourses.size() == 1)					{						curricularCourse = (ICurricularCourse) curricularCourses.get(0);					} else if (curricularCourses.size() > 1)					{						if (hasDiferentDegrees(curricularCourses))						{							curricularCourse = getCurricularCourseFromAnotherDegree(mwEnrolment, sp);							if (curricularCourse == null)							{								return;							}						} else						{							curricularCourse = (ICurricularCourse) curricularCourses.get(0);						}					} else					{						ReportEnrolment.addCurricularCourseNotFound(mwEnrolment.getCoursecode(),							mwEnrolment.getDegreecode().toString(),							mwEnrolment.getNumber().toString());						return;					}				}			} else // curricularCourses.size() == 1			{				curricularCourse = (ICurricularCourse) curricularCourses.get(0);			}			// Get the Curricular Course Scope			ICurricularCourseScope curricularCourseScope =				getCurricularCourseScopeToEnrollIn(studentCurricularPlan, mwEnrolment, curricularCourse, branch, sp);			if (curricularCourseScope == null)			{				return;			}			IEnrolment enrolment = createEnrolment(studentCurricularPlan, sp, curricularCourseScope);			// Update the Corresponding Attend if it exists			IFrequenta attend = updateAttend(curricularCourse, executionPeriod, enrolment, mwEnrolment, sp);			if (attend == null)			{//				System.out.println("Student " + mwEnrolment.getNumber() + " has no Attend for " + mwEnrolment.getCoursecode() + " from Degree " + mwEnrolment.getDegreecode());				attendsNotFound++;				return;			}		}	}