filter.add(Restrictions.isNotNull("birthday"));
final List<AddressDO> list = getList(filter);
// Uses not Collections.sort because every comparison needs Calendar.getDayOfYear().
final Set<BirthdayAddress> set = new TreeSet<BirthdayAddress>();
final Set<Integer> favorites = getFavorites();
final DateHolder from = new DateHolder(fromDate);
final DateHolder to = new DateHolder(toDate);
DateHolder dh;
final int fromMonth = from.getMonth();
final int fromDayOfMonth = from.getDayOfMonth();
final int toMonth = to.getMonth();
final int toDayOfMonth = to.getDayOfMonth();
for (final AddressDO address : list) {
if (all == false && favorites.contains(address.getId()) == false) {
// Address is not a favorite address, so ignore it.
continue;
}
dh = new DateHolder(address.getBirthday());
final int month = dh.getMonth();
final int dayOfMonth = dh.getDayOfMonth();
if (DateHelper.dateOfYearBetween(month, dayOfMonth, fromMonth, fromDayOfMonth, toMonth, toDayOfMonth) == false) {
continue;
}
final BirthdayAddress ba = new BirthdayAddress(address);
if (favorites.contains(address.getId()) == true) {