public Set<Sport> getSports() { Set<Sport> sports = new HashSet<Sport>(); for (SeasonalTeam st : getSeasonalTeams()) { Sport sport = Sport.getInstance(st); if (!ObjectUtils.isBlank(sport)) { sports.add(sport); } } return sports; }
public Long getEventsPlayedCount(Sport sport) { if (ObjectUtils.isBlank(sport)) { return null; } ObjectType seasonalAthleteType = ObjectType.getInstance(sport.getSeasonalAthleteClass()); Query<SeasonalAthlete> seasonalAthleteQuery = Query.from(SeasonalAthlete.class) .where("typeId = ? && athlete = ?", seasonalAthleteType, this); return Query.from(Event.class).where("seasonalAthletes = ?", seasonalAthleteQuery).count(); }
public List<SeasonalAthlete> findSeasonalAthletes(Sport sport) { if (ObjectUtils.isBlank(sport)) { return null; } ObjectType seasonalAthleteType = ObjectType.getInstance(sport.getSeasonalAthleteClass()); return Query.from(SeasonalAthlete.class) .where("typeId = ? && athlete = ?", seasonalAthleteType, this) .selectAll(); }