}
protected void generateEnrolment(final HtmlTable groupTable, Enrolment enrolment, final String enrolmentNameClasses,
final String enrolmentYearClasses, final String enrolmentSemesterClasses, final String enrolmentEctsClasses,
final String enrolmentCheckBoxClasses) {
HtmlTableRow htmlTableRow = groupTable.createRow();
HtmlTableCell cellName = htmlTableRow.createCell();
cellName.setClasses(enrolmentNameClasses);
String enrolmentName = getPresentationNameFor(enrolment);
if (canPerformStudentEnrolments && enrolment.getDegreeModule() instanceof CurricularCourse) {
CurricularCourse curricularCourse = (CurricularCourse) enrolment.getDegreeModule();
if (!StringUtils.isEmpty(curricularCourse.getCode())) {
enrolmentName = curricularCourse.getCode() + " - " + enrolmentName;
}
enrolmentName +=
" (" + BundleUtil.getString(Bundle.STUDENT, "label.grade.scale") + " - "
+ curricularCourse.getGradeScaleChain().getDescription() + ") ";
}
cellName.setBody(new HtmlText(enrolmentName));
// Year
final HtmlTableCell yearCell = htmlTableRow.createCell();
yearCell.setClasses(enrolmentYearClasses);
final String year = enrolment.getExecutionPeriod().getExecutionYear().getYear();
yearCell.setBody(new HtmlText(year));
// Semester
final HtmlTableCell semesterCell = htmlTableRow.createCell();
semesterCell.setClasses(enrolmentSemesterClasses);
final StringBuilder semester = new StringBuilder();
semester.append(enrolment.getExecutionPeriod().getSemester().toString());
semester.append(" ");
semester.append(BundleUtil.getString(Bundle.ENUMERATION, "SEMESTER.ABBREVIATION"));
semesterCell.setBody(new HtmlText(semester.toString()));
// Ects
final HtmlTableCell ectsCell = htmlTableRow.createCell();
ectsCell.setClasses(enrolmentEctsClasses);
final StringBuilder ects = new StringBuilder();
final double ectsCredits =
(enrolment.isBolonhaDegree() && getBolonhaStudentEnrollmentBean().getCurricularRuleLevel().isNormal()) ? enrolment
.getAccumulatedEctsCredits(enrolment.getExecutionPeriod()) : enrolment.getEctsCredits();
ects.append(ectsCredits).append(" ").append(BundleUtil.getString(Bundle.STUDENT, "label.credits.abbreviation"));
ectsCell.setBody(new HtmlText(ects.toString()));
MetaObject enrolmentMetaObject = MetaObjectFactory.createObject(enrolment, new Schema(Enrolment.class));
HtmlCheckBox checkBox = new HtmlCheckBox(true);
checkBox.setName("enrolmentCheckBox" + enrolment.getExternalId());
checkBox.setUserValue(enrolmentMetaObject.getKey().toString());
enrollmentsController.addCheckBox(checkBox);
HtmlTableCell cellCheckBox = htmlTableRow.createCell();
cellCheckBox.setClasses(enrolmentCheckBoxClasses);
cellCheckBox.setBody(checkBox);
}