if (searchBean.hasAnyStudentStatuteType() && !hasStudentStatuteType(searchBean, registration)) {
continue;
}
final RegistrationState lastRegistrationState = registration.getLastRegistrationState(executionYear);
if (lastRegistrationState == null) {
continue;
}
if (searchBean.hasAnyRegistrationStateTypes()
&& !searchBean.getRegistrationStateTypes().contains(lastRegistrationState.getStateType())) {
continue;
}
if ((searchBean.isIngressedInChosenYear()) && (registration.getIngressionYear() != executionYear)) {
continue;
}
if (searchBean.isConcludedInChosenYear()) {
CycleType cycleType;
if (searchBean.getDegreeType() != null) {
final TreeSet<CycleType> orderedCycleTypes = searchBean.getDegreeType().getOrderedCycleTypes();
cycleType = orderedCycleTypes.isEmpty() ? null : orderedCycleTypes.last();
} else {
cycleType = registration.getCycleType(executionYear);
}
RegistrationConclusionBean conclusionBean;
if (registration.isBolonha()) {
conclusionBean = new RegistrationConclusionBean(registration, cycleType);
if (conclusionBean.getCycleCurriculumGroup() == null || !conclusionBean.isConcluded()) {
continue;
}
} else {
conclusionBean = new RegistrationConclusionBean(registration);
if (!conclusionBean.isConclusionProcessed()) {
continue;
}
}
if (conclusionBean.getConclusionYear() != executionYear) {
continue;
}
}
if (searchBean.getActiveEnrolments() && !registration.hasAnyEnrolmentsIn(executionYear)) {
continue;
}
if (searchBean.getStandaloneEnrolments() && !registration.hasAnyStandaloneEnrolmentsIn(executionYear)) {
continue;
}
if ((searchBean.getRegime() != null) && (registration.getRegimeType(executionYear) != searchBean.getRegime())) {
continue;
}
if ((searchBean.getNationality() != null) && (registration.getPerson().getCountry() != searchBean.getNationality())) {
continue;
}
if ((searchBean.getIngression() != null) && (registration.getIngression() != searchBean.getIngression())) {
continue;
}
result.add(new RegistrationWithStateForExecutionYearBean(registration, lastRegistrationState.getStateType(),
executionYear));
}
return result;
}