public List<SeasonalTeam> getSeasonalTeams() { List<SeasonalTeam> seasonalTeams = new ArrayList<SeasonalTeam>(); for (SeasonalAthlete a : getAllSeasonalAthletes()) { if (!ObjectUtils.isBlank(a) && !ObjectUtils.isBlank(a.getTeam())) { seasonalTeams.add(a.getTeam()); } } return seasonalTeams; }
public List<Integer> getYearsPlayed() { List<Integer> yearsPlayed = new ArrayList<Integer>(); for (SeasonalAthlete sa : getAllSeasonalAthletes()) { if (!yearsPlayed.contains(sa.getYear())) { yearsPlayed.add(sa.getYear()); } } Collections.sort(yearsPlayed); Collections.reverse(yearsPlayed); return yearsPlayed; }
public Object calculateStat(String stat, SeasonalAthlete seasonalAthlete, String aggregator) { Object ret = null; if (SortParam.GAMES_PLAYED.fieldName.equalsIgnoreCase(stat)) { ret = calculateGamesPlayed(seasonalAthlete); ret = convertToNumber(ret, Integer.class); } else if (SortParam.LAST_NAME.fieldName.equalsIgnoreCase(stat)) { ret = calculateAthleteLastName(seasonalAthlete); } else if (SortParam.FIRST_NAME.fieldName.equalsIgnoreCase(stat)) { ret = calculateAthleteFirstName(seasonalAthlete); } else if (AVG.equalsIgnoreCase(aggregator)) { ret = seasonalAthlete.averageStat(stat, predicate); ret = convertToNumber(ret, Double.class); } else { ret = seasonalAthlete.sumStat(stat, predicate); ret = convertToNumber(ret, Integer.class); } return ret; }
public Object calculateGamesPlayed(SeasonalAthlete seasonalAthlete) { Object ret = seasonalAthlete.getEventsPlayedCount(predicate); return convertToNumber(ret, Integer.class); }
public Object calculateSchoolName(SeasonalAthlete seasonalAthlete) { return seasonalAthlete.getAthlete().getSchool().getName(); }
public Object calculateAthleteFirstName(SeasonalAthlete seasonalAthlete) { return seasonalAthlete.getAthlete().getFirstName(); }