@Override public Collection<League> retrievePublicLeagues() { logger.debug("In retrievePublicLeagues"); Collection<League> publicLeagues = leagueDao.retrievePublicLeagues(); return publicLeagues; }
@Override public Collection<League> retrievePublicLeaguesAvailableForUser(Integer userId) { logger.debug("In retrievePublicLeaguesAvailableForUser"); Collection<League> result = new HashSet<>(); Collection<League> publicLeagues = leagueDao.retrievePublicLeagues(); User user = this.userService.findUserById(userId); for (League publicLeague : publicLeagues) { if (!user.isInvolvedInLeague(publicLeague.getId())) { result.add(publicLeague); } } return result; }