final Calculator calculator = new Calculator(registration.getStudent());
if (!processed.contains(registration)) {
final Person person = registration.getPerson();
final Row row = spreadsheetCurricularInfo.addRow();
final BigDecimal candidacyGrade = submission.getGrade(this);
// final ICurriculum curriculum = registration.getCurriculum();
row.setCell(getString("label.username"), person.getUsername());
row.setCell(getString("label.name"), person.getName());
row.setCell(getString("label.degree"), registration.getDegree().getSigla());
row.setCell(getString("label.candidate.classification"),
candidacyGrade == null ? "" : candidacyGrade.toString());
row.setCell(getString("label.ects.first.cycle"), calculator.completedECTSCycle1.toString());
row.setCell(getString("label.ects.average"), calculator.getEctsAverage().toString());
row.setCell(getString("label.ects.average.first.and.second.cycle"), calculator
.getEctsEverateFirstAndSecondCycle().toString());
row.setCell(getString("label.ects.completed"), calculator.completedECTS.toString());
//row.setCell(getString("label.ects.pending"), calculator.getPendingEcts().toString());
row.setCell(getString("label.ects.enrolled"), calculator.enrolledECTS.toString());
for (final Registration otherRegistration : registration.getStudent().getRegistrationsSet()) {
final Row rowOCI = spreadsheetOtherCurricularInfo.addRow();
final ICurriculum curriculumOther = otherRegistration.getCurriculum();
rowOCI.setCell(getString("label.username"), person.getUsername());
rowOCI.setCell(getString("label.name"), person.getName());
rowOCI.setCell(getString("label.degree"), otherRegistration.getDegree().getSigla());
rowOCI.setCell(getString("label.curricular.year"), curriculumOther.getCurricularYear());
rowOCI.setCell(getString("label.ects.completed.degree"), curriculumOther.getSumEctsCredits().toString());
rowOCI.setCell(getString("label.average.degree"), curriculumOther.getAverage().toString());
fillCycleDetails(rowOCI, CycleType.FIRST_CYCLE, otherRegistration,
getString("label.ects.completed.cycle.first"), getString("label.average.cycle.first"));
fillCycleDetails(rowOCI, CycleType.SECOND_CYCLE, otherRegistration,
getString("label.ects.completed.cycle.second"), getString("label.average.cycle.second"));
}
for (final OutboundMobilityCandidacy c : submission.getSortedOutboundMobilityCandidacySet()) {
final OutboundMobilityCandidacyContest contestFromCandidacy = c.getOutboundMobilityCandidacyContest();
final MobilityAgreement mobilityAgreement = contestFromCandidacy.getMobilityAgreement();
final UniversityUnit unit = mobilityAgreement.getUniversityUnit();
final Country country = unit.getCountry();
final Row row2 = spreadsheetOptions.addRow();
row2.setCell(getString("label.username"), person.getUsername());
row2.setCell(getString("label.preference.order"), c.getPreferenceOrder());
row2.setCell(getString("label.degrees"), contestFromCandidacy.getOutboundMobilityCandidacyContestGroup()
.getDescription());
row2.setCell(getString("label.mobility.program"), mobilityAgreement.getMobilityProgram()
.getRegistrationProtocol().getDescription().getContent());
row2.setCell(getString("label.country"), country == null ? "" : country.getName());
row2.setCell(getString("label.university"), unit.getPresentationName());
}
final Row contactRow = spreadsheetContactInformation.addRow();
contactRow.setCell(getString("label.username"), person.getUsername());
contactRow.setCell(getString("label.name"), person.getName());
contactRow.setCell(getString("label.email"), person.getEmailForSendingEmails());
contactRow.setCell(getString("label.phone"), person.getDefaultPhoneNumber());
contactRow.setCell(getString("label.mobile"), person.getDefaultMobilePhoneNumber());
processed.add(registration);
}
}
}