}
@Override
public Object provide(Object source, Object current) {
ChooseRegistrationOrPhd chooseRegistrationOrPhd = (ChooseRegistrationOrPhd) source;
Student student = chooseRegistrationOrPhd.getStudent();
Set<PhdRegistrationWrapper> phdRegistrationWrapperResult = new HashSet<PhdRegistrationWrapper>();
ExecutionYear currentExecutionYear = ExecutionYear.readCurrentExecutionYear();
for (final PhdIndividualProgramProcess phdProcess : student.getPerson().getPhdIndividualProgramProcessesSet()) {
if (!phdProcess.isAllowedToManageProcess(Authenticate.getUser())) {
continue;
}
if ((phdProcess.isProcessActive() && student.hasValidInsuranceEvent())) {
phdRegistrationWrapperResult.add(new PhdRegistrationWrapper(phdProcess));
} else if (phdProcess.isConcluded()) {
ExecutionYear conclusionYear = phdProcess.getConclusionYear();
if (matchesRecentExecutionYear(currentExecutionYear, conclusionYear)) {
phdRegistrationWrapperResult.add(new PhdRegistrationWrapper(phdProcess));
}
}
}
for (Registration registration : student.getActiveRegistrations()) {
if (!registration.getDegreeType().isEmpty() && registration.isAllowedToManageRegistration()) {
phdRegistrationWrapperResult.add(new PhdRegistrationWrapper(registration));
}
}
for (Registration registration : student.getConcludedRegistrations()) {
if (!registration.getDegreeType().isEmpty() && registration.isBolonha()
&& registration.isAllowedToManageRegistration()) {
RegistrationConclusionBean conclusionBean = null;
CycleType cycleType = registration.getDegreeType().getLastOrderedCycleType();
if (cycleType != null) {