row.setCell(personalInformationBean.getConclusionYear());
// Nota de conclusão da habilitação anterior
row.setCell(personalInformationBean.getConclusionGrade() != null ? personalInformationBean.getConclusionGrade() : "");
MobilityAgreement mobilityAgreement = null;
ExecutionInterval chosenCandidacyInterval = null;
//getting the last mobility program done
for (OutboundMobilityCandidacySubmission outboundCandidacySubmission : registration
.getOutboundMobilityCandidacySubmissionSet()) {
if (outboundCandidacySubmission.getSelectedCandidacy() != null
&& outboundCandidacySubmission.getSelectedCandidacy().getSelected()) {
ExecutionInterval candidacyInterval =
outboundCandidacySubmission.getOutboundMobilityCandidacyPeriod().getExecutionInterval();
//the candidacies are made in the previous year
if (candidacyInterval.getAcademicInterval().isBefore(executionYear.getAcademicInterval())) {
if (mobilityAgreement != null) {
if (!candidacyInterval.getAcademicInterval().isAfter(chosenCandidacyInterval.getAcademicInterval())) {
continue;
}
}
mobilityAgreement =
outboundCandidacySubmission.getSelectedCandidacy().getOutboundMobilityCandidacyContest()
.getMobilityAgreement();
chosenCandidacyInterval = candidacyInterval;
}
}
}
// Programa de mobilidade
row.setCell(mobilityAgreement != null ? mobilityAgreement.getMobilityProgram().getName().getContent() : "");
// País de mobilidade
row.setCell(mobilityAgreement != null ? mobilityAgreement.getUniversityUnit().getCountry().getName() : "");
// Duração do programa de mobilidade
row.setCell(personalInformationBean.getMobilityProgramDuration() != null ? BundleUtil.getString(Bundle.ENUMERATION,
personalInformationBean.getMobilityProgramDuration().name()) : "");