spreadsheet.setHeader("ciclo de estudos");
spreadsheet.setHeader("regime");
spreadsheet.setHeader("número inscricoes");
spreadsheet.setHeader("número aprovacoes");
final ExecutionSemester firstExecutionSemester =
ExecutionYear.readExecutionYearByName("2003/2004").getFirstExecutionPeriod();
final ExecutionSemester lastExecutionSemester = getExecutionYear().getLastExecutionPeriod();
for (final Degree degree : Degree.readNotEmptyDegrees()) {
if (checkDegreeType(getDegreeType(), degree)) {
if (isActive(degree)) {
for (final Registration registration : degree.getRegistrationsSet()) {
if (registration.isRegistered(getExecutionYear())) {
final EnrolmentAndAprovalCounterMap map =
new EnrolmentAndAprovalCounterMap(firstExecutionSemester, lastExecutionSemester, registration);
for (final Entry<ExecutionSemester, EnrolmentAndAprovalCounter> entry : map.entrySet()) {
final ExecutionSemester executionSemester = entry.getKey();
final EnrolmentAndAprovalCounter enrolmentAndAprovalCounter = entry.getValue();
final Row row = spreadsheet.addRow();
row.setCell(registration.getNumber().toString());
row.setCell(executionSemester.getExecutionYear().getYear());
row.setCell(executionSemester.getSemester().toString());
setDegreeCells(row, degree);
final StringBuilder stringBuilder = new StringBuilder();
for (final StudentStatuteBean studentStatuteBean : registration.getStudent().getStatutes(
executionSemester)) {
if (stringBuilder.length() > 0) {
stringBuilder.append(", ");
}
stringBuilder.append(studentStatuteBean.getStudentStatute().getStatuteType());
}
row.setCell(stringBuilder.toString());
CycleType cycleType = registration.getCycleType(executionSemester.getExecutionYear());
row.setCell(cycleType != null ? cycleType.getDescription() : "");
row.setCell(registration.getRegimeType(executionSemester.getExecutionYear()).getLocalizedName());
row.setCell(Integer.toString(enrolmentAndAprovalCounter.getEnrolments()));
row.setCell(Integer.toString(enrolmentAndAprovalCounter.getAprovals()));
}
}
}