if (source instanceof PhdProgramCandidacyProcessBean) {
PhdProgramCandidacyProcessBean bean = (PhdProgramCandidacyProcessBean) source;
Set<PhdProgramFocusArea> focusAreaSet = new HashSet<PhdProgramFocusArea>();
InstitutionPhdCandidacyPeriod phdCandidacyPeriod = (InstitutionPhdCandidacyPeriod) bean.getPhdCandidacyPeriod();
for (PhdProgram phdProgram : phdCandidacyPeriod.getPhdProgramsSet()) {
focusAreaSet.addAll(phdProgram.getPhdProgramFocusAreasSet());
}
List<PhdProgramFocusArea> focusAreaList = new ArrayList<PhdProgramFocusArea>();
focusAreaList.addAll(focusAreaSet);
return focusAreaList;
} else if (source instanceof PhdIndividualProgramProcessBean) {
PhdIndividualProgramProcessBean bean = (PhdIndividualProgramProcessBean) source;
Set<PhdProgramFocusArea> focusAreaSet = new HashSet<PhdProgramFocusArea>();
InstitutionPhdCandidacyPeriod phdCandidacyPeriod =
(InstitutionPhdCandidacyPeriod) bean.getIndividualProgramProcess().getCandidacyProcess()
.getPublicPhdCandidacyPeriod();
for (PhdProgram phdProgram : phdCandidacyPeriod.getPhdProgramsSet()) {
focusAreaSet.addAll(phdProgram.getPhdProgramFocusAreasSet());
}
List<PhdProgramFocusArea> focusAreaList = new ArrayList<PhdProgramFocusArea>();
focusAreaList.addAll(focusAreaSet);