Class SimpleParticipantService
- java.lang.Object
-
- at.stefangeyer.challonge.service.implementation.SimpleParticipantService
-
- All Implemented Interfaces:
ParticipantService
public class SimpleParticipantService extends java.lang.Object implements ParticipantService
Participant Service Implementation
-
-
Constructor Summary
Constructors Constructor Description SimpleParticipantService(ParticipantRestClient restClient)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ParticipantaddParticipant(Tournament tournament, ParticipantQuery data)Add a participant to a tournament (up until it is started).voidaddParticipant(Tournament tournament, ParticipantQuery data, Callback<Participant> onSuccess, Callback<DataAccessException> onFailure)Add a participant to a tournament (up until it is started).java.util.List<Participant>bulkAddParticipants(Tournament tournament, java.util.List<ParticipantQuery> data)Bulk add participants to a tournament (up until it is started).voidbulkAddParticipants(Tournament tournament, java.util.List<ParticipantQuery> data, Callback<java.util.List<Participant>> onSuccess, Callback<DataAccessException> onFailure)Bulk add participants to a tournament (up until it is started).ParticipantcheckInParticipant(Participant participant)Checks a participant in, setting checked_in_at to the current time.voidcheckInParticipant(Participant participant, Callback<Participant> onSuccess, Callback<DataAccessException> onFailure)Checks a participant in, setting checked_in_at to the current time.ParticipantdeleteParticipant(Participant participant)If the tournament has not started, delete a participant, automatically filling in the abandoned seed number.voiddeleteParticipant(Participant participant, Callback<Participant> onSuccess, Callback<DataAccessException> onFailure)If the tournament has not started, delete a participant, automatically filling in the abandoned seed number.ParticipantgetParticipant(Tournament tournament, long participantId, boolean includeMatches)Retrieve a single participant record for a tournament.voidgetParticipant(Tournament tournament, long participantId, boolean includeMatches, Callback<Participant> onSuccess, Callback<DataAccessException> onFailure)Retrieve a single participant record for a tournament.java.util.List<Participant>getParticipants(Tournament tournament)Retrieve a tournament's participant list.voidgetParticipants(Tournament tournament, Callback<java.util.List<Participant>> onSuccess, Callback<DataAccessException> onFailure)Retrieve a tournament's participant list.java.util.List<Participant>randomizeParticipants(Tournament tournament)Randomize seeds among participants.voidrandomizeParticipants(Tournament tournament, Callback<java.util.List<Participant>> onSuccess, Callback<DataAccessException> onFailure)Randomize seeds among participants.ParticipantundoCheckInParticipant(Participant participant)Marks a participant as having not checked in, setting checked_in_at to nil.voidundoCheckInParticipant(Participant participant, Callback<Participant> onSuccess, Callback<DataAccessException> onFailure)Marks a participant as having not checked in, setting checked_in_at to nil.ParticipantupdateParticipant(Participant participant, ParticipantQuery data)Update the attributes of a tournament participant.voidupdateParticipant(Participant participant, ParticipantQuery data, Callback<Participant> onSuccess, Callback<DataAccessException> onFailure)Update the attributes of a tournament participant.
-
-
-
Constructor Detail
-
SimpleParticipantService
public SimpleParticipantService(ParticipantRestClient restClient)
-
-
Method Detail
-
getParticipants
public java.util.List<Participant> getParticipants(Tournament tournament) throws DataAccessException
Description copied from interface:ParticipantServiceRetrieve a tournament's participant list.- Specified by:
getParticipantsin interfaceParticipantService- Parameters:
tournament- The tournament to get the participants from. Must contain tournament id- Returns:
- The tournaments participants
- Throws:
DataAccessException- Exchange with the rest api or validation failed
-
getParticipants
public void getParticipants(Tournament tournament, Callback<java.util.List<Participant>> onSuccess, Callback<DataAccessException> onFailure)
Description copied from interface:ParticipantServiceRetrieve a tournament's participant list.- Specified by:
getParticipantsin interfaceParticipantService- Parameters:
tournament- The tournament to get the participants from. Must contain tournament idonSuccess- Called with result if call was successfulonFailure- Called with exception if call was not successful
-
getParticipant
public Participant getParticipant(Tournament tournament, long participantId, boolean includeMatches) throws DataAccessException
Description copied from interface:ParticipantServiceRetrieve a single participant record for a tournament.- Specified by:
getParticipantin interfaceParticipantService- Parameters:
tournament- The tournament to get the participant from. Must contain tournament idparticipantId- The participant's unique IDincludeMatches- Includes an array of associated match records- Returns:
- The requested participant
- Throws:
DataAccessException- Exchange with the rest api or validation failed
-
getParticipant
public void getParticipant(Tournament tournament, long participantId, boolean includeMatches, Callback<Participant> onSuccess, Callback<DataAccessException> onFailure)
Description copied from interface:ParticipantServiceRetrieve a single participant record for a tournament.- Specified by:
getParticipantin interfaceParticipantService- Parameters:
tournament- The tournament to get the participant from. Must contain tournament idparticipantId- The participant's unique IDincludeMatches- Includes an array of associated match recordsonSuccess- Called with result if call was successfulonFailure- Called with exception if call was not successful
-
addParticipant
public Participant addParticipant(Tournament tournament, ParticipantQuery data) throws DataAccessException
Description copied from interface:ParticipantServiceAdd a participant to a tournament (up until it is started).- Specified by:
addParticipantin interfaceParticipantService- Parameters:
tournament- The tournament to add the participant to. Must contain tournament iddata- The participant data- Returns:
- The added participant
- Throws:
DataAccessException- Exchange with the rest api or validation failed
-
addParticipant
public void addParticipant(Tournament tournament, ParticipantQuery data, Callback<Participant> onSuccess, Callback<DataAccessException> onFailure)
Description copied from interface:ParticipantServiceAdd a participant to a tournament (up until it is started).- Specified by:
addParticipantin interfaceParticipantService- Parameters:
tournament- The tournament to add the participant to. Must contain tournament iddata- The participant dataonSuccess- Called with result if call was successfulonFailure- Called with exception if call was not successful
-
bulkAddParticipants
public java.util.List<Participant> bulkAddParticipants(Tournament tournament, java.util.List<ParticipantQuery> data) throws DataAccessException
Description copied from interface:ParticipantServiceBulk add participants to a tournament (up until it is started). If an invalid participant is detected, bulk participant creation will halt and any previously added participants (from this API request) will be rolled back.- Specified by:
bulkAddParticipantsin interfaceParticipantService- Parameters:
tournament- The tournament to add the participants to. Must contain tournament iddata- The participant data- Returns:
- The added participants
- Throws:
DataAccessException- Exchange with the rest api or validation failed
-
bulkAddParticipants
public void bulkAddParticipants(Tournament tournament, java.util.List<ParticipantQuery> data, Callback<java.util.List<Participant>> onSuccess, Callback<DataAccessException> onFailure)
Description copied from interface:ParticipantServiceBulk add participants to a tournament (up until it is started). If an invalid participant is detected, bulk participant creation will halt and any previously added participants (from this API request) will be rolled back.- Specified by:
bulkAddParticipantsin interfaceParticipantService- Parameters:
tournament- The tournament to add the participants to. Must contain tournament iddata- The participant dataonSuccess- Called with result if call was successfulonFailure- Called with exception if call was not successful
-
updateParticipant
public Participant updateParticipant(Participant participant, ParticipantQuery data) throws DataAccessException
Description copied from interface:ParticipantServiceUpdate the attributes of a tournament participant.- Specified by:
updateParticipantin interfaceParticipantService- Parameters:
participant- The participant to update. Must contain the tournament id and the participant's iddata- The participant data- Returns:
- The updates participant
- Throws:
DataAccessException- Exchange with the rest api or validation failed
-
updateParticipant
public void updateParticipant(Participant participant, ParticipantQuery data, Callback<Participant> onSuccess, Callback<DataAccessException> onFailure)
Description copied from interface:ParticipantServiceUpdate the attributes of a tournament participant.- Specified by:
updateParticipantin interfaceParticipantService- Parameters:
participant- The participant to update. Must contain the tournament id and the participant's iddata- The participant dataonSuccess- Called with result if call was successfulonFailure- Called with exception if call was not successful
-
checkInParticipant
public Participant checkInParticipant(Participant participant) throws DataAccessException
Description copied from interface:ParticipantServiceChecks a participant in, setting checked_in_at to the current time.- Specified by:
checkInParticipantin interfaceParticipantService- Parameters:
participant- The participant to check in. Must contain the tournament id and the participant's id- Returns:
- The checked in participant
- Throws:
DataAccessException- Exchange with the rest api or validation failed
-
checkInParticipant
public void checkInParticipant(Participant participant, Callback<Participant> onSuccess, Callback<DataAccessException> onFailure)
Description copied from interface:ParticipantServiceChecks a participant in, setting checked_in_at to the current time.- Specified by:
checkInParticipantin interfaceParticipantService- Parameters:
participant- The participant to check in. Must contain the tournament id and the participant's idonSuccess- Called with result if call was successfulonFailure- Called with exception if call was not successful
-
undoCheckInParticipant
public Participant undoCheckInParticipant(Participant participant) throws DataAccessException
Description copied from interface:ParticipantServiceMarks a participant as having not checked in, setting checked_in_at to nil.- Specified by:
undoCheckInParticipantin interfaceParticipantService- Parameters:
participant- The participant to check in. Must contain the tournament id and the participant's id- Returns:
- The checked out participant
- Throws:
DataAccessException- Exchange with the rest api or validation failed
-
undoCheckInParticipant
public void undoCheckInParticipant(Participant participant, Callback<Participant> onSuccess, Callback<DataAccessException> onFailure)
Description copied from interface:ParticipantServiceMarks a participant as having not checked in, setting checked_in_at to nil.- Specified by:
undoCheckInParticipantin interfaceParticipantService- Parameters:
participant- The participant to check in. Must contain the tournament id and the participant's idonSuccess- Called with result if call was successfulonFailure- Called with exception if call was not successful
-
deleteParticipant
public Participant deleteParticipant(Participant participant) throws DataAccessException
Description copied from interface:ParticipantServiceIf the tournament has not started, delete a participant, automatically filling in the abandoned seed number. If tournament is underway, mark a participant inactive, automatically forfeiting his/her remaining matches.- Specified by:
deleteParticipantin interfaceParticipantService- Parameters:
participant- The participant to delete. Must contain the tournament id and the participant's id- Returns:
- The deleted participant
- Throws:
DataAccessException- Exchange with the rest api or validation failed
-
deleteParticipant
public void deleteParticipant(Participant participant, Callback<Participant> onSuccess, Callback<DataAccessException> onFailure)
Description copied from interface:ParticipantServiceIf the tournament has not started, delete a participant, automatically filling in the abandoned seed number. If tournament is underway, mark a participant inactive, automatically forfeiting his/her remaining matches.- Specified by:
deleteParticipantin interfaceParticipantService- Parameters:
participant- The participant to delete. Must contain the tournament id and the participant's idonSuccess- Called with result if call was successfulonFailure- Called with exception if call was not successful
-
randomizeParticipants
public java.util.List<Participant> randomizeParticipants(Tournament tournament) throws DataAccessException
Description copied from interface:ParticipantServiceRandomize seeds among participants. Only applicable before a tournament has started.- Specified by:
randomizeParticipantsin interfaceParticipantService- Parameters:
tournament- The tournament to randomize. Must contain the tournament id- Returns:
- The randomized participants
- Throws:
DataAccessException- Exchange with the rest api or validation failed
-
randomizeParticipants
public void randomizeParticipants(Tournament tournament, Callback<java.util.List<Participant>> onSuccess, Callback<DataAccessException> onFailure)
Description copied from interface:ParticipantServiceRandomize seeds among participants. Only applicable before a tournament has started.- Specified by:
randomizeParticipantsin interfaceParticipantService- Parameters:
tournament- The tournament to randomize. Must contain the tournament idonSuccess- Called with result if call was successfulonFailure- Called with exception if call was not successful
-
-