public class OutboundMobilityCandidacyGroupProvider implements DataProvider {
@Override
public Object provide(final Object source, final Object currentValue) {
final OutboundMobilityContextBean contextBean = (OutboundMobilityContextBean) source;
if (contextBean.getCandidacyPeriods().size() == 1) {
return getCandidacyContestGroupSet(contextBean.getCandidacyPeriods().iterator().next());
}
final SortedSet<OutboundMobilityCandidacyContestGroup> result = new TreeSet<OutboundMobilityCandidacyContestGroup>();
for (final OutboundMobilityCandidacyPeriod candidacyPeriod : contextBean.getCandidacyPeriods()) {
result.addAll(getCandidacyContestGroupSet(candidacyPeriod));
}
return result;
}