return headers;
}
private void fillSpreadSheet(final Spreadsheet spreadsheet, final AcademicInterval academicInterval) {
for (final ExecutionCourse executionCourse : ExecutionCourse.filterByAcademicInterval(academicInterval)) {
final Row row = spreadsheet.addRow();
row.setCell(executionCourse.getNome());
final StringBuilder responsibleForStringBuilder = new StringBuilder();
final StringBuilder responsibleForEmailsStringBuilder = new StringBuilder();
boolean isFirstResp = true;
for (final Professorship professorship : executionCourse.getProfessorshipsSet()) {
if (professorship.getResponsibleFor().booleanValue()) {
if (isFirstResp) {
isFirstResp = false;
} else {
responsibleForStringBuilder.append("; ");
responsibleForEmailsStringBuilder.append("; ");
}
final Teacher teacher = professorship.getTeacher();
responsibleForStringBuilder.append(teacher.getPerson().getUsername());
responsibleForStringBuilder.append(" ");
final Person person = teacher.getPerson();
responsibleForStringBuilder.append(person.getName());
responsibleForEmailsStringBuilder.append(person.getEmail());
}
}
row.setCell(responsibleForStringBuilder.toString());
final Map<Degree, Set<Integer>> degreeOccurenceMap = constructDegreeOccurenceMap(academicInterval, executionCourse);
row.setCell(Integer.toString(degreeOccurenceMap.size()));
final StringBuilder degreeStringBuilder = new StringBuilder();
boolean isFirst = true;
for (final Degree degree : degreeOccurenceMap.keySet()) {
if (isFirst) {
isFirst = false;
} else {
degreeStringBuilder.append("; ");
}
degreeStringBuilder.append(degree.getSigla());
}
row.setCell(degreeStringBuilder.toString());
final StringBuilder degreeCurricularYearStringBuilder = new StringBuilder();
isFirst = true;
for (final Entry<Degree, Set<Integer>> entry : degreeOccurenceMap.entrySet()) {
if (isFirst) {
isFirst = false;
} else {
degreeCurricularYearStringBuilder.append("; ");
}
final Degree degree = entry.getKey();
degreeCurricularYearStringBuilder.append(degree.getSigla());
degreeCurricularYearStringBuilder.append('(');
boolean isFirstYear = true;
for (final Integer curricularYearInteger : entry.getValue()) {
if (isFirstYear) {
isFirstYear = false;
} else {
degreeCurricularYearStringBuilder.append(", ");
}
degreeCurricularYearStringBuilder.append(curricularYearInteger.toString());
}
degreeCurricularYearStringBuilder.append(')');
}
row.setCell(degreeCurricularYearStringBuilder.toString());
final StringBuilder degreeTypeStringBuilder = new StringBuilder();
final Set<DegreeType> degreeTypes = new TreeSet<DegreeType>();
for (final Degree degree : degreeOccurenceMap.keySet()) {
degreeTypes.add(degree.getDegreeType());
}
for (final DegreeType degreeType : degreeTypes) {
if (degreeTypeStringBuilder.length() > 0) {
degreeStringBuilder.append(", ");
}
degreeTypeStringBuilder.append(degreeType);
}
row.setCell(degreeTypeStringBuilder.toString());
row.setCell(responsibleForEmailsStringBuilder.toString());
int enrolmentCount = 0;
for (final Attends attends : executionCourse.getAttendsSet()) {
if (attends.getEnrolment() != null) {
enrolmentCount++;
}
}
row.setCell(enrolmentCount);
row.setCell(executionCourse.getAttendsSet().size());
}
}