Class SFSInvitationManager
- java.lang.Object
-
- com.smartfoxserver.v2.entities.invitation.SFSInvitationManager
-
- All Implemented Interfaces:
com.smartfoxserver.bitswarm.service.IService,InvitationManager
public class SFSInvitationManager extends java.lang.Object implements com.smartfoxserver.bitswarm.service.IService, InvitationManager
-
-
Field Summary
Fields Modifier and Type Field Description protected IDGeneratoridGenprotected java.util.Map<java.lang.Integer,Invitation>invitationsByIdprotected java.util.Map<User,java.util.List<Invitation>>invitationsByOwnerprotected org.slf4j.Loggerlogprotected intmaxInvitationsPerUserprotected java.lang.StringserviceNameprotected SmartFoxServersfs
-
Constructor Summary
Constructors Constructor Description SFSInvitationManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddestroy(java.lang.Object o)Destroy serviceInvitationfindById(int id)Find an invitation from its idIDGeneratorgetIDGenerator()intgetMaxInvitationsPerUser()java.lang.StringgetName()Get the service nameprotected voidhandleAcceptedInvitation(Invitation invitation, ISFSObject params)voidhandleMessage(java.lang.Object o)Send message to serviceprotected voidhandleRefusedInvitation(Invitation invitation, ISFSObject params)voidinit(java.lang.Object o)Initialize serviceprotected voidinitCleanUpTask()voidonInvitationResult(int invitationId, InvitationResponse result, ISFSObject params)Handle the response to an invitationvoidonInvitationResult(Invitation invitation, InvitationResponse result, ISFSObject params)Handle the response to an invitationprotected java.util.List<Invitation>prepareStartInvitation(Invitation invitation, InvitationCallback callBack)protected voidremoveInvitation(Invitation invitation)voidsetMaxInvitationsPerUser(int value)voidsetName(java.lang.String name)Set the service namevoidstartInvitation(Invitation invitation, InvitationCallback callBack)Start a new invitationvoidsuppressInvitation(Invitation invitation)Stop an invitation that is running
-
-
-
Field Detail
-
serviceName
protected java.lang.String serviceName
-
sfs
protected final SmartFoxServer sfs
-
log
protected final org.slf4j.Logger log
-
invitationsById
protected final java.util.Map<java.lang.Integer,Invitation> invitationsById
-
invitationsByOwner
protected final java.util.Map<User,java.util.List<Invitation>> invitationsByOwner
-
maxInvitationsPerUser
protected int maxInvitationsPerUser
-
idGen
protected IDGenerator idGen
-
-
Method Detail
-
init
public void init(java.lang.Object o)
Description copied from interface:com.smartfoxserver.bitswarm.service.IServiceInitialize service- Specified by:
initin interfacecom.smartfoxserver.bitswarm.service.IService- Parameters:
o- custom parameters
-
destroy
public void destroy(java.lang.Object o)
Description copied from interface:com.smartfoxserver.bitswarm.service.IServiceDestroy service- Specified by:
destroyin interfacecom.smartfoxserver.bitswarm.service.IService- Parameters:
o- custom parameters
-
getName
public java.lang.String getName()
Description copied from interface:com.smartfoxserver.bitswarm.service.IServiceGet the service name- Specified by:
getNamein interfacecom.smartfoxserver.bitswarm.service.IService- Returns:
- the service name
-
setName
public void setName(java.lang.String name)
Description copied from interface:com.smartfoxserver.bitswarm.service.IServiceSet the service name- Specified by:
setNamein interfacecom.smartfoxserver.bitswarm.service.IService- Parameters:
name- the service name
-
handleMessage
public void handleMessage(java.lang.Object o)
Description copied from interface:com.smartfoxserver.bitswarm.service.IServiceSend message to service- Specified by:
handleMessagein interfacecom.smartfoxserver.bitswarm.service.IService- Parameters:
o- the message
-
findById
public Invitation findById(int id)
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
public void startInvitation(Invitation invitation, InvitationCallback callBack)
Description copied from interface:InvitationManagerStart a new invitation- Specified by:
startInvitationin interfaceInvitationManager- Parameters:
invitation- the invitation objectcallBack- the response handler
-
prepareStartInvitation
protected java.util.List<Invitation> prepareStartInvitation(Invitation invitation, InvitationCallback callBack)
-
suppressInvitation
public void suppressInvitation(Invitation invitation)
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 SFSInvitationExceptionDescription 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
public IDGenerator getIDGenerator()
- Specified by:
getIDGeneratorin interfaceInvitationManager
-
initCleanUpTask
protected void initCleanUpTask()
-
handleAcceptedInvitation
protected void handleAcceptedInvitation(Invitation invitation, ISFSObject params)
-
handleRefusedInvitation
protected void handleRefusedInvitation(Invitation invitation, ISFSObject params)
-
removeInvitation
protected void removeInvitation(Invitation invitation)
-
-