Package com.syzygy.events.database
Class Event.LotteryResult
java.lang.Object
com.syzygy.events.database.Database.Querrier.QueryResult<EventAssociation.Methods<Event>>
com.syzygy.events.database.Event.LotteryResult
- All Implemented Interfaces:
Database.Dissolvable
- Enclosing class:
- Event
@Dissolves
public class Event.LotteryResult
extends Database.Querrier.QueryResult<EventAssociation.Methods<Event>>
implements Database.Dissolvable
The random selected list user and unselected users returned by a lottery call along with a method to execute the lottery.
This acts as a confirmation stage for the lottery.
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal int
The count of users that should have been selectedprivate boolean
private boolean
final EventAssociation.Methods<Event>
Fields inherited from class com.syzygy.events.database.Database.Querrier.QueryResult
result
-
Constructor Summary
ConstructorsConstructorDescriptionLotteryResult
(EventAssociation.Methods<Event> chosen, EventAssociation.Methods<Event> notChosen, int count) Assumes all instances of User have already been fetched -
Method Summary
Modifier and TypeMethodDescriptionvoid
dissolve()
Cancels the result.void
execute
(Database.Querrier.DataListener<Event, EventAssociation.NotificationResult> listener, boolean notifyRejected) Executes a lottery result.boolean
getEvent()
-
Field Details
-
count
public final int countThe count of users that should have been selected -
notChosen
-
dissolved
private boolean dissolved -
executed
private boolean executed
-
-
Constructor Details
-
LotteryResult
public LotteryResult(@Stirs EventAssociation.Methods<Event> chosen, @Stirs EventAssociation.Methods<Event> notChosen, int count) Assumes all instances of User have already been fetched- Parameters:
chosen
- The list of chosen usersnotChosen
- The list of notChosen userscount
- The count of users that should have been selected
-
-
Method Details
-
filledAllSpots
public boolean filledAllSpots()- Returns:
true
if a user was selected for all spots asked to be filled
-
getEvent
-
execute
@Stirred @AutoStir public void execute(Database.Querrier.DataListener<Event, EventAssociation.NotificationResult> listener, boolean notifyRejected) throws IllegalStateExceptionExecutes a lottery result. Sets all selected users to Invited and notifies them of their invitation. Notifies all unselected users of their rejection. Dissolves the lottery result on completion- Parameters:
listener
- The listener. Only the on success method is called. The on success method receives aEventAssociation.NotificationResult
with the successful notifications and any notifications that failed to sendnotifyRejected
- If the rejected users should be notified TODO if an update errors- Throws:
IllegalStateException
-
dissolve
Cancels the result. Returns all references and does not notify users- Specified by:
dissolve
in interfaceDatabase.Dissolvable
-