Exemplo n.º 1
0
  public byte[] createEmptySheets(Long categoryid, Locale locale) {
    Category category = em.find(Category.class, categoryid);
    if (category == null) {
      throw new IllegalArgumentException();
    }
    Series series = em.find(Series.class, category.getSeries_id());
    if (series == null) {
      throw new IllegalArgumentException();
    }
    Athlete template = new Athlete();
    template.setCategory(category);

    Sheets sheet = new Sheets(template, series.getLogo(), locale);
    return sheet.create();
  }
Exemplo n.º 2
0
  public byte[] createSheets(Long competitionId, String order, Locale locale) {
    Competition competition = em.find(Competition.class, competitionId);
    if (competition == null) {
      return null;
    } else {
      TypedQuery<Athlete> query;
      if (order != null && order.equals("club")) {
        query = em.createNamedQuery("Athlete.findBySeriesOrderByClub", Athlete.class);
      } else {
        query = em.createNamedQuery("Athlete.findBySeries", Athlete.class);
      }
      query.setParameter("series_id", competition.getSeries_id());
      List<Athlete> athletes = query.getResultList();

      Sheets sheet =
          new Sheets(
              competition,
              athletes,
              get(Series.class, competition.getSeries_id()).getLogo(),
              locale);
      return sheet.create();
    }
  }