Пример #1
0
  public List<Season> getCurrentSeasons() {
    List<Season> s = new ArrayList<Season>();
    Calendar calendar = Calendar.getInstance();
    calendar.setTimeInMillis(System.currentTimeMillis());
    int currentYear = calendar.get(Calendar.YEAR);

    for (LeagueType lt : LeagueType.values()) {
      Iterable<Season> seasons = seasonRepository.getSeasonsByLeagueType(lt.toString());
      for (Season season : seasons) {
        if (season.getStartYear() >= currentYear) s.add(season);
      }
    }

    return s;
  }
Пример #2
0
  public Season createSeason(Season season) {

    String id = UUID.randomUUID().toString();

    season.setId(id);

    return seasonRepository.save(season);
  }