View Javadoc
1   /*
2    * ============================================================================
3    * Project betoffice-storage Copyright (c) 2000-2016 by Andre Winkler. All
4    * rights reserved.
5    * ============================================================================
6    * GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND
7    * MODIFICATION
8    * 
9    * This program is free software; you can redistribute it and/or modify it under
10   * the terms of the GNU General Public License as published by the Free Software
11   * Foundation; either version 2 of the License, or (at your option) any later
12   * version.
13   * 
14   * This program is distributed in the hope that it will be useful, but WITHOUT
15   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16   * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
17   * details.
18   * 
19   * You should have received a copy of the GNU General Public License along with
20   * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
21   * Place, Suite 330, Boston, MA 02111-1307 USA
22   */
23  
24  package de.winkler.betoffice.dao;
25  
26  import java.util.List;
27  import java.util.Optional;
28  
29  import de.winkler.betoffice.storage.GroupType;
30  import de.winkler.betoffice.storage.Season;
31  import de.winkler.betoffice.storage.TeamResult;
32  
33  /**
34   * DAO Klasse für den Zugriff auf {@link de.winkler.betoffice.storage.Season}
35   * Objekte.
36   *
37   * @author by Andre Winkler
38   */
39  public interface SeasonDao extends CommonDao<Season> {
40  
41      /**
42       * Liefert eine Liste aller Meisterschaften.
43       *
44       * @return Eine Liste aller Meisterschaften.
45       */
46      public List<Season> findAll();
47  
48      /**
49       * Liefert eine Meisterschaft mit gesuchten Namen und Jahrgang.
50       *
51       * @param name
52       *            Der gesuchte Name.
53       * @param year
54       *            Der gesuchte Jahrgang
55       * @return Eine Meisterschaft.
56       */
57      public Optional<Season> findByName(String name, String year);
58  
59      /**
60       * Sucht nach den Gruppen-, Mannschafts- und Teilnehmerbeziehungen zu der
61       * übegebenen Meisterschaft.
62       *
63       * @param season
64       *            Die betreffende Meisterschaft.
65       * @return Eine Meisterschaft mit gesetzten Referenzen zu allen Spieltagen,
66       *         Gruppen, Mannschaften und Teilnehmern.
67       */
68      public Season findRoundGroupTeamUser(Season season);
69  
70      /**
71       * Sucht nach den Gruppen-, Mannschafts- und Teilnehmerbeziehungen zu der
72       * übegebenen Meisterschaft, sowie alle Tipps für alle Teilnehmer.
73       *
74       * @param season
75       *            Die betreffende Meisterschaft.
76       * @return Eine Meisterschaft mit gesetzten Referenzen zu allen Spieltagen,
77       *         Gruppen, Mannschaften und Teilnehmern, sowie alle Tipps für alle
78       *         Teilnehmer.
79       */
80      public Season findRoundGroupTeamUserTipp(Season season);
81  
82      /**
83       * Legt eine neue Meisterschaft an.
84       *
85       * @param season
86       *            Eine Meisterschaft.
87       */
88      public void save(Season season);
89  
90      /**
91       * Eine Update-Operation.
92       *
93       * @param season
94       *            Eine Season.
95       */
96      public void update(Season season);
97  
98      /**
99       * Löscht eine Meisterschaft.
100      *
101      * @param season
102      *            Eine Meisterschaft.
103      */
104     public void delete(Season season);
105 
106     /**
107      * Startet die Tabellenberechnung der Mannschaften einer Meisterschaft.
108      *
109      * @param season
110      *            Die Meisterschaft.
111      * @param groupType
112      *            Die Liga/Gruppe die berechnet werden soll.
113      * @return Eine sortierte Liste der Tabelle.
114      */
115     public List<TeamResult> calculateTeamRanking(Season season,
116             GroupType groupType);
117 
118     /**
119      * Startet die Tabellenberechnung der Mannschaften einer Meisterschaft über
120      * bestimmte Spielrunden.
121      *
122      * @param season
123      *            Die Meisterschaft.
124      * @param groupType
125      *            Die Liga/Gruppe die berechnet werden soll.
126      * @param startIndex
127      *            Index des Start-Spieltags (0..N-1).
128      * @param endIndex
129      *            Index des End-Spieltags (0..N-1).
130      * @return Eine sortierte Liste der Tabelle.
131      */
132     public List<TeamResult> calculateTeamRanking(Season season,
133             GroupType groupType, int startIndex, int endIndex);
134 
135 }