if (student.getPayedTuition() == null || student.getPayedTuition().equals(Boolean.FALSE)) { throw new FenixServiceException( "error.exception.notAuthorized.student.warningTuition"); }  persistentStudent.simpleLockWrite(student);  IExecutionPeriod executionPeriod = persistentExecutionPeriod.readActualExecutionPeriod();  List<IShift> shifts = student.getShifts(); List shiftEnrollments = new ArrayList(); for (IShift shift : shifts) { if (shift.getDisciplinaExecucao().getExecutionPeriod().getIdInternal().equals( executionPeriod.getIdInternal())) shiftEnrollments.add(shift); }  List shiftsToUnEnroll = new ArrayList(); List filteredShiftsIdsToEnroll = new ArrayList();  filteredShiftsIdsToEnroll = calculateShiftsToEnroll(shiftIdsToEnroll, shiftEnrollments);  shiftsToUnEnroll = enrollStudentsInShiftsAndCalculateShiftsToUnEnroll(student, filteredShiftsIdsToEnroll, errorReport, persistentShift);  unEnrollStudentsInShifts(shiftsToUnEnroll, student);  }  return errorReport; } catch (ExcepcaoPersistencia e) { e.printStackTrace(); throw new FenixServiceException(e); }
return errorReport;
    public ShiftEnrollmentErrorReport run(Integer studentId, List shiftIdsToEnroll)            throws StudentNotFoundServiceException, FenixServiceException {        try {            ISuportePersistente sp = PersistenceSupportFactory.getDefaultPersistenceSupport();            IPersistentStudent persistentStudent = sp.getIPersistentStudent();            ITurnoPersistente persistentShift = sp.getITurnoPersistente();            IPersistentExecutionPeriod persistentExecutionPeriod = sp.getIPersistentExecutionPeriod();            ShiftEnrollmentErrorReport errorReport = new ShiftEnrollmentErrorReport();            if (shiftIdsToEnroll != null && !shiftIdsToEnroll.isEmpty()) {                IStudent student = (IStudent) persistentStudent.readByOID(Student.class, studentId);                if (student == null) {                    throw new StudentNotFoundServiceException();                }                if (student.getPayedTuition() == null || student.getPayedTuition().equals(Boolean.FALSE)) {                    throw new FenixServiceException(                            "error.exception.notAuthorized.student.warningTuition");                }                persistentStudent.simpleLockWrite(student);                IExecutionPeriod executionPeriod = persistentExecutionPeriod.readActualExecutionPeriod();                List<IShift> shifts = student.getShifts();                List shiftEnrollments = new ArrayList();                for (IShift shift : shifts) {                    if (shift.getDisciplinaExecucao().getExecutionPeriod().getIdInternal().equals(                            executionPeriod.getIdInternal()))                        shiftEnrollments.add(shift);                }                List shiftsToUnEnroll = new ArrayList();                List filteredShiftsIdsToEnroll = new ArrayList();                filteredShiftsIdsToEnroll = calculateShiftsToEnroll(shiftIdsToEnroll, shiftEnrollments);                shiftsToUnEnroll = enrollStudentsInShiftsAndCalculateShiftsToUnEnroll(student,                        filteredShiftsIdsToEnroll, errorReport, persistentShift);                unEnrollStudentsInShifts(shiftsToUnEnroll, student);            }            return errorReport;        } catch (ExcepcaoPersistencia e) {            e.printStackTrace();            throw new FenixServiceException(e);        }    }