IEnrolment enrolmentToWrite)
IEnrollment enrolmentToWrite)
	public static void createAttend(		IStudent student,		ICurricularCourse curricularCourse,		IExecutionPeriod executionPeriod,		IEnrolment enrolmentToWrite)		throws ExcepcaoPersistencia	{		ISuportePersistente persistentSuport = SuportePersistenteOJB.getInstance();		IPersistentExecutionCourse executionCourseDAO = persistentSuport.getIPersistentExecutionCourse();		IFrequentaPersistente attendDAO = persistentSuport.getIFrequentaPersistente();				if (createdAttends == null)		{			createdAttends = new HashMap();		}		List executionCourses = executionCourseDAO.readbyCurricularCourseAndExecutionPeriod(curricularCourse, executionPeriod);		IExecutionCourse executionCourse = null;		if (executionCourses.size() > 1)		{			Iterator iterator = executionCourses.iterator();			while (iterator.hasNext())			{				IExecutionCourse executionCourse2 = (IExecutionCourse) iterator.next();				if (executionCourse2.getExecutionCourseProperties() == null					|| executionCourse2.getExecutionCourseProperties().isEmpty())				{					executionCourse = executionCourse2;				}			}		} else if (executionCourses.size() == 1)		{			executionCourse = (IExecutionCourse) executionCourses.get(0);		}		if (executionCourse != null)		{			IFrequenta attend = attendDAO.readByAlunoAndDisciplinaExecucao(student, executionCourse);			String key = student.getIdInternal().toString() + "-" + executionCourse.getIdInternal().toString();						if (attend == null)			{				attend = (IFrequenta) createdAttends.get(key);			}			if (attend != null)			{				attendDAO.simpleLockWrite(attend);				attend.setEnrolment(enrolmentToWrite);			}			else			{				IFrequenta attendToWrite = new Frequenta();				attendDAO.simpleLockWrite(attendToWrite);				attendToWrite.setAluno(student);				attendToWrite.setDisciplinaExecucao(executionCourse);				attendToWrite.setEnrolment(enrolmentToWrite);				createdAttends.put(key, attendToWrite);			}		}	}