Class SimpleTournamentService
- java.lang.Object
-
- at.stefangeyer.challonge.service.implementation.SimpleTournamentService
-
- All Implemented Interfaces:
TournamentService
public class SimpleTournamentService extends java.lang.Object implements TournamentService
Tournament Service Implementation
-
-
Constructor Summary
Constructors Constructor Description SimpleTournamentService(TournamentRestClient restClient)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TournamentabortCheckIn(Tournament tournament, boolean includeParticipants, boolean includeMatches)When your tournament is in a 'checking_in' or 'checked_in' state, there's no way to edit the tournament's start time (start_at) or check-in duration (check_in_duration).voidabortCheckIn(Tournament tournament, boolean includeParticipants, boolean includeMatches, Callback<Tournament> onSuccess, Callback<DataAccessException> onFailure)When your tournament is in a 'checking_in' or 'checked_in' state, there's no way to edit the tournament's start time (start_at) or check-in duration (check_in_duration).TournamentcreateTournament(TournamentQuery data)Create a new tournament.voidcreateTournament(TournamentQuery data, Callback<Tournament> onSuccess, Callback<DataAccessException> onFailure)Create a new tournament.TournamentdeleteTournament(Tournament tournament)Deletes a tournament along with all its associated records.voiddeleteTournament(Tournament tournament, Callback<Tournament> onSuccess, Callback<DataAccessException> onFailure)Deletes a tournament along with all its associated records.TournamentfinalizeTournament(Tournament tournament, boolean includeParticipants, boolean includeMatches)Finalize a tournament that has had all match scores submitted, rendering its results permanent.voidfinalizeTournament(Tournament tournament, boolean includeParticipants, boolean includeMatches, Callback<Tournament> onSuccess, Callback<DataAccessException> onFailure)Finalize a tournament that has had all match scores submitted, rendering its results permanent.TournamentgetTournament(java.lang.String tournament, boolean includeParticipants, boolean includeMatches)Retrieve a single tournament record created with your account.voidgetTournament(java.lang.String tournament, boolean includeParticipants, boolean includeMatches, Callback<Tournament> onSuccess, Callback<DataAccessException> onFailure)Retrieve a single tournament record created with your account.java.util.List<Tournament>getTournaments(TournamentQueryState state, TournamentType type, java.time.OffsetDateTime createdAfter, java.time.OffsetDateTime createdBefore, java.lang.String subdomain)Retrieve a set of tournaments created with your account.voidgetTournaments(TournamentQueryState state, TournamentType type, java.time.OffsetDateTime createdAfter, java.time.OffsetDateTime createdBefore, java.lang.String subdomain, Callback<java.util.List<Tournament>> onSuccess, Callback<DataAccessException> onFailure)Retrieve a set of tournaments created with your account.TournamentopenTournamentForPredictions(Tournament tournament, boolean includeParticipants, boolean includeMatches)Sets the state of the tournament to start accepting predictions.voidopenTournamentForPredictions(Tournament tournament, boolean includeParticipants, boolean includeMatches, Callback<Tournament> onSuccess, Callback<DataAccessException> onFailure)Sets the state of the tournament to start accepting predictions.TournamentprocessCheckIns(Tournament tournament, boolean includeParticipants, boolean includeMatches)This should be invoked after a tournament's check-in window closes before the tournament is started.voidprocessCheckIns(Tournament tournament, boolean includeParticipants, boolean includeMatches, Callback<Tournament> onSuccess, Callback<DataAccessException> onFailure)This should be invoked after a tournament's check-in window closes before the tournament is started.TournamentresetTournament(Tournament tournament, boolean includeParticipants, boolean includeMatches)Reset a tournament, clearing all of its scores and attachments.voidresetTournament(Tournament tournament, boolean includeParticipants, boolean includeMatches, Callback<Tournament> onSuccess, Callback<DataAccessException> onFailure)Reset a tournament, clearing all of its scores and attachments.TournamentstartTournament(Tournament tournament, boolean includeParticipants, boolean includeMatches)Start a tournament, opening up first round matches for score reporting.voidstartTournament(Tournament tournament, boolean includeParticipants, boolean includeMatches, Callback<Tournament> onSuccess, Callback<DataAccessException> onFailure)Start a tournament, opening up first round matches for score reporting.TournamentupdateTournament(Tournament tournament, TournamentQuery data)Update a tournament's attributes.voidupdateTournament(Tournament tournament, TournamentQuery data, Callback<Tournament> onSuccess, Callback<DataAccessException> onFailure)Update a tournament's attributes.
-
-
-
Constructor Detail
-
SimpleTournamentService
public SimpleTournamentService(TournamentRestClient restClient)
-
-
Method Detail
-
getTournaments
public java.util.List<Tournament> getTournaments(TournamentQueryState state, TournamentType type, java.time.OffsetDateTime createdAfter, java.time.OffsetDateTime createdBefore, java.lang.String subdomain) throws DataAccessException
Description copied from interface:TournamentServiceRetrieve a set of tournaments created with your account.- Specified by:
getTournamentsin interfaceTournamentService- Parameters:
state- Only get tournaments with this statetype- Only get tournaments with this typecreatedAfter- Get tournaments created after this datecreatedBefore- Get tournaments created before this datesubdomain- Only get tournaments with this subdomain- Returns:
- The filtered tournaments
- Throws:
DataAccessException- Exchange with the rest api or validation failed
-
getTournaments
public void getTournaments(TournamentQueryState state, TournamentType type, java.time.OffsetDateTime createdAfter, java.time.OffsetDateTime createdBefore, java.lang.String subdomain, Callback<java.util.List<Tournament>> onSuccess, Callback<DataAccessException> onFailure)
Description copied from interface:TournamentServiceRetrieve a set of tournaments created with your account.- Specified by:
getTournamentsin interfaceTournamentService- Parameters:
state- Only get tournaments with this statetype- Only get tournaments with this typecreatedAfter- Get tournaments created after this datecreatedBefore- Get tournaments created before this datesubdomain- Only get tournaments with this subdomainonSuccess- Called with result if call was successfulonFailure- Called with exception if call was not successful
-
getTournament
public Tournament getTournament(java.lang.String tournament, boolean includeParticipants, boolean includeMatches) throws DataAccessException
Description copied from interface:TournamentServiceRetrieve a single tournament record created with your account.- Specified by:
getTournamentin interfaceTournamentService- Parameters:
tournament- Tournament ID (e.g. 10230) or URL (e.g. 'single_elim' for challonge.com/single_elim). If assigned to a subdomain, URL format must be :subdomain-:tournament_url (e.g. 'test-mytourney' for test.challonge.com/mytourney)includeParticipants- Include a list of participants in the responseincludeMatches- Include a list of matches in the response- Returns:
- The matching tournament
- Throws:
DataAccessException- Exchange with the rest api or validation failed
-
getTournament
public void getTournament(java.lang.String tournament, boolean includeParticipants, boolean includeMatches, Callback<Tournament> onSuccess, Callback<DataAccessException> onFailure)Description copied from interface:TournamentServiceRetrieve a single tournament record created with your account.- Specified by:
getTournamentin interfaceTournamentService- Parameters:
tournament- Tournament ID (e.g. 10230) or URL (e.g. 'single_elim' for challonge.com/single_elim). If assigned to a subdomain, URL format must be :subdomain-:tournament_url (e.g. 'test-mytourney' for test.challonge.com/mytourney)includeParticipants- Include a list of participants in the responseincludeMatches- Include a list of matches in the responseonSuccess- Called with result if call was successfulonFailure- Called with exception if call was not successful
-
createTournament
public Tournament createTournament(TournamentQuery data) throws DataAccessException
Description copied from interface:TournamentServiceCreate a new tournament.- Specified by:
createTournamentin interfaceTournamentService- Parameters:
data- An object with all the necessary information to create the tournament- Returns:
- The created tournament
- Throws:
DataAccessException- Exchange with the rest api or validation failed
-
createTournament
public void createTournament(TournamentQuery data, Callback<Tournament> onSuccess, Callback<DataAccessException> onFailure)
Description copied from interface:TournamentServiceCreate a new tournament.- Specified by:
createTournamentin interfaceTournamentService- Parameters:
data- An object with all the necessary information to create the tournamentonSuccess- Called with result if call was successfulonFailure- Called with exception if call was not successful
-
updateTournament
public Tournament updateTournament(Tournament tournament, TournamentQuery data) throws DataAccessException
Description copied from interface:TournamentServiceUpdate a tournament's attributes.- Specified by:
updateTournamentin interfaceTournamentService- Parameters:
tournament- The tournament to update. Must contain tournament iddata- An object with all the necessary information to update the tournament- Returns:
- The updated tournament
- Throws:
DataAccessException- Exchange with the rest api or validation failed
-
updateTournament
public void updateTournament(Tournament tournament, TournamentQuery data, Callback<Tournament> onSuccess, Callback<DataAccessException> onFailure)
Description copied from interface:TournamentServiceUpdate a tournament's attributes.- Specified by:
updateTournamentin interfaceTournamentService- Parameters:
tournament- The tournament to update. Must contain tournament iddata- An object with all the necessary information to update the tournamentonSuccess- Called with result if call was successfulonFailure- Called with exception if call was not successful
-
deleteTournament
public Tournament deleteTournament(Tournament tournament) throws DataAccessException
Description copied from interface:TournamentServiceDeletes a tournament along with all its associated records. There is no undo, so use with care!- Specified by:
deleteTournamentin interfaceTournamentService- Parameters:
tournament- The tournament to delete. Must contain tournament id- Returns:
- The deleted tournament
- Throws:
DataAccessException- Exchange with the rest api or validation failed
-
deleteTournament
public void deleteTournament(Tournament tournament, Callback<Tournament> onSuccess, Callback<DataAccessException> onFailure)
Description copied from interface:TournamentServiceDeletes a tournament along with all its associated records. There is no undo, so use with care!- Specified by:
deleteTournamentin interfaceTournamentService- Parameters:
tournament- The tournament to delete. Must contain tournament idonSuccess- Called with result if call was successfulonFailure- Called with exception if call was not successful
-
processCheckIns
public Tournament processCheckIns(Tournament tournament, boolean includeParticipants, boolean includeMatches) throws DataAccessException
Description copied from interface:TournamentServiceThis should be invoked after a tournament's check-in window closes before the tournament is started.1. Marks participants who have not checked in as inactive. 2. Moves inactive participants to bottom seeds (ordered by original seed). 3. Transitions the tournament state from 'checking_in' to 'checked_in'
NOTE: Checked in participants on the waiting list will be promoted if slots become available.
- Specified by:
processCheckInsin interfaceTournamentService- Parameters:
tournament- The tournament to process check ins for. Must contain tournament idincludeParticipants- Include a list of participants in the responseincludeMatches- Include a list of matches in the response- Returns:
- The updated tournament
- Throws:
DataAccessException- Exchange with the rest api or validation failed
-
processCheckIns
public void processCheckIns(Tournament tournament, boolean includeParticipants, boolean includeMatches, Callback<Tournament> onSuccess, Callback<DataAccessException> onFailure)
Description copied from interface:TournamentServiceThis should be invoked after a tournament's check-in window closes before the tournament is started.1. Marks participants who have not checked in as inactive. 2. Moves inactive participants to bottom seeds (ordered by original seed). 3. Transitions the tournament state from 'checking_in' to 'checked_in'
NOTE: Checked in participants on the waiting list will be promoted if slots become available.
- Specified by:
processCheckInsin interfaceTournamentService- Parameters:
tournament- The tournament to process check ins for. Must contain tournament idincludeParticipants- Include a list of participants in the responseincludeMatches- Include a list of matches in the responseonSuccess- Called with result if call was successfulonFailure- Called with exception if call was not successful
-
abortCheckIn
public Tournament abortCheckIn(Tournament tournament, boolean includeParticipants, boolean includeMatches) throws DataAccessException
Description copied from interface:TournamentServiceWhen your tournament is in a 'checking_in' or 'checked_in' state, there's no way to edit the tournament's start time (start_at) or check-in duration (check_in_duration). You must first abort check-in, then you may edit those attributes.1. Makes all participants active and clears their checked_in_at times. 2. Transitions the tournament state from 'checking_in' or 'checked_in' to 'pending'
- Specified by:
abortCheckInin interfaceTournamentService- Parameters:
tournament- The tournament to abort check in for. Must contain tournament idincludeParticipants- Include a list of participants in the responseincludeMatches- Include a list of matches in the response- Returns:
- The updated tournament
- Throws:
DataAccessException- Exchange with the rest api or validation failed
-
abortCheckIn
public void abortCheckIn(Tournament tournament, boolean includeParticipants, boolean includeMatches, Callback<Tournament> onSuccess, Callback<DataAccessException> onFailure)
Description copied from interface:TournamentServiceWhen your tournament is in a 'checking_in' or 'checked_in' state, there's no way to edit the tournament's start time (start_at) or check-in duration (check_in_duration). You must first abort check-in, then you may edit those attributes.1. Makes all participants active and clears their checked_in_at times. 2. Transitions the tournament state from 'checking_in' or 'checked_in' to 'pending'
- Specified by:
abortCheckInin interfaceTournamentService- Parameters:
tournament- The tournament to abort check in for. Must contain tournament idincludeParticipants- Include a list of participants in the responseincludeMatches- Include a list of matches in the responseonSuccess- Called with result if call was successfulonFailure- Called with exception if call was not successful
-
startTournament
public Tournament startTournament(Tournament tournament, boolean includeParticipants, boolean includeMatches) throws DataAccessException
Description copied from interface:TournamentServiceStart a tournament, opening up first round matches for score reporting. The tournament must have at least 2 participants.- Specified by:
startTournamentin interfaceTournamentService- Parameters:
tournament- The tournament to start. Must contain tournament idincludeParticipants- Include a list of participants in the responseincludeMatches- Include a list of matches in the response- Returns:
- The started tournament
- Throws:
DataAccessException- Exchange with the rest api or validation failed
-
startTournament
public void startTournament(Tournament tournament, boolean includeParticipants, boolean includeMatches, Callback<Tournament> onSuccess, Callback<DataAccessException> onFailure)
Description copied from interface:TournamentServiceStart a tournament, opening up first round matches for score reporting. The tournament must have at least 2 participants.- Specified by:
startTournamentin interfaceTournamentService- Parameters:
tournament- The tournament to start. Must contain tournament idincludeParticipants- Include a list of participants in the responseincludeMatches- Include a list of matches in the responseonSuccess- Called with result if call was successfulonFailure- Called with exception if call was not successful
-
finalizeTournament
public Tournament finalizeTournament(Tournament tournament, boolean includeParticipants, boolean includeMatches) throws DataAccessException
Description copied from interface:TournamentServiceFinalize a tournament that has had all match scores submitted, rendering its results permanent.- Specified by:
finalizeTournamentin interfaceTournamentService- Parameters:
tournament- The tournament to finalize. Must contain tournament idincludeParticipants- Include a list of participants in the responseincludeMatches- Include a list of matches in the response- Returns:
- The finalized tournament
- Throws:
DataAccessException- Exchange with the rest api or validation failed
-
finalizeTournament
public void finalizeTournament(Tournament tournament, boolean includeParticipants, boolean includeMatches, Callback<Tournament> onSuccess, Callback<DataAccessException> onFailure)
Description copied from interface:TournamentServiceFinalize a tournament that has had all match scores submitted, rendering its results permanent.- Specified by:
finalizeTournamentin interfaceTournamentService- Parameters:
tournament- The tournament to finalize. Must contain tournament idincludeParticipants- Include a list of participants in the responseincludeMatches- Include a list of matches in the responseonSuccess- Called with result if call was successfulonFailure- Called with exception if call was not successful
-
resetTournament
public Tournament resetTournament(Tournament tournament, boolean includeParticipants, boolean includeMatches) throws DataAccessException
Description copied from interface:TournamentServiceReset a tournament, clearing all of its scores and attachments. You can then add/remove/edit participants before starting the tournament again.- Specified by:
resetTournamentin interfaceTournamentService- Parameters:
tournament- The tournament to reset. Must contain tournament idincludeParticipants- Include a list of participants in the responseincludeMatches- Include a list of matches in the response- Returns:
- The reset tournament
- Throws:
DataAccessException- Exchange with the rest api or validation failed
-
resetTournament
public void resetTournament(Tournament tournament, boolean includeParticipants, boolean includeMatches, Callback<Tournament> onSuccess, Callback<DataAccessException> onFailure)
Description copied from interface:TournamentServiceReset a tournament, clearing all of its scores and attachments. You can then add/remove/edit participants before starting the tournament again.- Specified by:
resetTournamentin interfaceTournamentService- Parameters:
tournament- The tournament to reset. Must contain tournament idincludeParticipants- Include a list of participants in the responseincludeMatches- Include a list of matches in the responseonSuccess- Called with result if call was successfulonFailure- Called with exception if call was not successful
-
openTournamentForPredictions
public Tournament openTournamentForPredictions(Tournament tournament, boolean includeParticipants, boolean includeMatches) throws DataAccessException
Description copied from interface:TournamentServiceSets the state of the tournament to start accepting predictions. Your tournament's 'prediction_method' attribute must be set to 1 (exponential scoring) or 2 (linear scoring) to use this option. Note: Once open for predictions, match records will be persisted, so participant additions and removals will no longer be permitted.- Specified by:
openTournamentForPredictionsin interfaceTournamentService- Parameters:
tournament- The tournament to open predictions for. Must contain tournament idincludeParticipants- Include a list of participants in the responseincludeMatches- Include a list of matches in the response- Returns:
- The reset tournament
- Throws:
DataAccessException- Exchange with the rest api or validation failed
-
openTournamentForPredictions
public void openTournamentForPredictions(Tournament tournament, boolean includeParticipants, boolean includeMatches, Callback<Tournament> onSuccess, Callback<DataAccessException> onFailure)
Description copied from interface:TournamentServiceSets the state of the tournament to start accepting predictions. Your tournament's 'prediction_method' attribute must be set to 1 (exponential scoring) or 2 (linear scoring) to use this option. Note: Once open for predictions, match records will be persisted, so participant additions and removals will no longer be permitted.- Specified by:
openTournamentForPredictionsin interfaceTournamentService- Parameters:
tournament- The tournament to open predictions for. Must contain tournament idincludeParticipants- Include a list of participants in the responseincludeMatches- Include a list of matches in the responseonSuccess- Called with result if call was successfulonFailure- Called with exception if call was not successful
-
-