Class SFSInvitationManager
java.lang.Object
com.smartfoxserver.entities.invitation.SFSInvitationManager
- All Implemented Interfaces:
com.smartfoxserver.bitswarm.service.IService,InvitationManager
public class SFSInvitationManager
extends Object
implements com.smartfoxserver.bitswarm.service.IService, InvitationManager
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected IDGeneratorprotected final Map<Integer, Invitation> protected final Map<User, List<Invitation>> protected final org.slf4j.Loggerprotected intprotected Stringprotected final SmartFoxServer -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidfindById(int id) Find an invitation from its idintgetName()protected voidhandleAcceptedInvitation(Invitation invitation, ISFSObject params) voidprotected voidhandleRefusedInvitation(Invitation invitation, ISFSObject params) voidprotected voidvoidonInvitationResult(int invitationId, InvitationResponse result, ISFSObject params) Handle the response to an invitationvoidonInvitationResult(Invitation invitation, InvitationResponse result, ISFSObject params) Handle the response to an invitationprotected List<Invitation> prepareStartInvitation(Invitation invitation, InvitationCallback callBack) protected voidremoveInvitation(Invitation invitation) voidsetMaxInvitationsPerUser(int value) voidvoidstartInvitation(Invitation invitation, InvitationCallback callBack) Start a new invitationvoidsuppressInvitation(Invitation invitation) Stop an invitation that is running
-
Field Details
-
serviceName
-
sfs
-
log
protected final org.slf4j.Logger log -
invitationsById
-
invitationsByOwner
-
maxInvitationsPerUser
protected int maxInvitationsPerUser -
idGen
-
-
Constructor Details
-
SFSInvitationManager
public SFSInvitationManager()
-
-
Method Details
-
init
- Specified by:
initin interfacecom.smartfoxserver.bitswarm.service.IService
-
destroy
- Specified by:
destroyin interfacecom.smartfoxserver.bitswarm.service.IService
-
getName
- Specified by:
getNamein interfacecom.smartfoxserver.bitswarm.service.IService
-
setName
- Specified by:
setNamein interfacecom.smartfoxserver.bitswarm.service.IService
-
handleMessage
- Specified by:
handleMessagein interfacecom.smartfoxserver.bitswarm.service.IService
-
findById
Description copied from interface:InvitationManagerFind an invitation from its id- Specified by:
findByIdin interfaceInvitationManager- Returns:
- the invitation object
-
getMaxInvitationsPerUser
public int getMaxInvitationsPerUser()- Specified by:
getMaxInvitationsPerUserin interfaceInvitationManager- Returns:
- the max amount of invitations a User can run simultaneously
-
setMaxInvitationsPerUser
public void setMaxInvitationsPerUser(int value) - Specified by:
setMaxInvitationsPerUserin interfaceInvitationManager- Parameters:
value- the max amount of invitations a User can run simultaneously
-
startInvitation
Description copied from interface:InvitationManagerStart a new invitation- Specified by:
startInvitationin interfaceInvitationManager- Parameters:
invitation- the invitation objectcallBack- the response handler
-
prepareStartInvitation
protected List<Invitation> prepareStartInvitation(Invitation invitation, InvitationCallback callBack) -
suppressInvitation
Description copied from interface:InvitationManagerStop an invitation that is running- Specified by:
suppressInvitationin interfaceInvitationManager- Parameters:
invitation- the invitation
-
onInvitationResult
public void onInvitationResult(int invitationId, InvitationResponse result, ISFSObject params) throws SFSInvitationException Description copied from interface:InvitationManagerHandle the response to an invitation- Specified by:
onInvitationResultin interfaceInvitationManager- Parameters:
invitationId- the id of the invitationresult- the resultparams- optional params- Throws:
SFSInvitationException
-
onInvitationResult
public void onInvitationResult(Invitation invitation, InvitationResponse result, ISFSObject params) throws SFSInvitationException Description copied from interface:InvitationManagerHandle the response to an invitation- Specified by:
onInvitationResultin interfaceInvitationManager- Parameters:
invitation- the invitationresult- the resultparams- optional params- Throws:
SFSInvitationException
-
getIDGenerator
- Specified by:
getIDGeneratorin interfaceInvitationManager
-
initCleanUpTask
protected void initCleanUpTask() -
handleAcceptedInvitation
-
handleRefusedInvitation
-
removeInvitation
-