sfs2x.client.requests
Class FindUsersRequest

java.lang.Object
  extended by sfs2x.client.requests.BaseRequest
      extended by sfs2x.client.requests.FindUsersRequest
All Implemented Interfaces:
sfs2x.client.requests.IRequest

public class FindUsersRequest
extends BaseRequest

Retrieves a list of users from the server which match the specified criteria.

By providing a matching expression and a search scope (a Room, a Group or the entire Zone), SmartFoxServer can find those users matching the passed criteria and return them by means of the userFindResult event.

Example
The following example looks for all the users whose "age" User Variable is greater than 29:

 private void someMethod() {
     sfs.addEventListener(SFSEvent.USER_FIND_RESULT, new IEventListener() {
         public void dispatch(BaseEvent evt) throws SFSException {
             System.out.println("Users found: " + evt.getArguments().get("users"));
         }
     });
     
     // Create a matching expression to find users with an "age" variable greater than 29:
     MatchExpression exp = new MatchExpression("age", NumberMatch.GREATER_THAN, 29);
     
     // Find the users
     sfs.send(new FindUsersRequest(exp));
 }
 

See Also:
MatchExpression, SFSEvent.USER_FIND_RESULT

Field Summary
static java.lang.String KEY_EXPRESSION
          * API internal usage only *
static java.lang.String KEY_FILTERED_USERS
          * API internal usage only *
static java.lang.String KEY_GROUP
          * API internal usage only *
static java.lang.String KEY_LIMIT
          * API internal usage only *
static java.lang.String KEY_ROOM
          * API internal usage only *
 
Fields inherited from class sfs2x.client.requests.BaseRequest
AddBuddy, AdminMessage, AutoJoin, BanUser, BlockBuddy, CallExtension, ChangeRoomCapacity, ChangeRoomName, ChangeRoomPassword, CreateRoom, CreateSFSGame, FindRooms, FindUsers, GenericMessage, GetRoomList, GoOnline, Handshake, InitBuddyList, InvitationReply, InviteUser, JoinRoom, JoinRoomInvite, KEY_ERROR_CODE, KEY_ERROR_PARAMS, KickUser, LeaveRoom, Login, Logout, ManualDisconnection, ModeratorMessage, ObjectMessage, PingPong, PlayerToSpectator, PrivateMessage, PublicMessage, QuickJoinGame, RemoveBuddy, SetBuddyVariables, SetRoomVariables, SetUserPosition, SetUserVariables, SpectatorToPlayer, SubscribeRoomGroup, UnsubscribeRoomGroup
 
Constructor Summary
FindUsersRequest(MatchExpression matchExpr)
           
FindUsersRequest(MatchExpression matchExpr, java.lang.Object target)
           
FindUsersRequest(MatchExpression matchExpr, java.lang.Object target, short limit)
          Creates a new FindUsersRequest instance.
 
Method Summary
 void execute(ISmartFox sfs)
          * API internal usage only *
 void validate(ISmartFox sfs)
          * API internal usage only *
 
Methods inherited from class sfs2x.client.requests.BaseRequest
getId, getMessage, getTargetController, isEncrypted, setEncrypted, setId, setTargetController
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

KEY_EXPRESSION

public static final java.lang.String KEY_EXPRESSION
* API internal usage only *

See Also:
Constant Field Values

KEY_GROUP

public static final java.lang.String KEY_GROUP
* API internal usage only *

See Also:
Constant Field Values

KEY_ROOM

public static final java.lang.String KEY_ROOM
* API internal usage only *

See Also:
Constant Field Values

KEY_LIMIT

public static final java.lang.String KEY_LIMIT
* API internal usage only *

See Also:
Constant Field Values

KEY_FILTERED_USERS

public static final java.lang.String KEY_FILTERED_USERS
* API internal usage only *

See Also:
Constant Field Values
Constructor Detail

FindUsersRequest

public FindUsersRequest(MatchExpression matchExpr,
                        java.lang.Object target,
                        short limit)
Creates a new FindUsersRequest instance. The instance must be passed to the SmartFox.send() method for the request to be performed.

Parameters:
matchExpr - A matching expression that the system will use to retrieve the users.
target - The name of a Group or a single Room object where to search for matching users; if null, the search is performed in the whole Zone.
limit - The maximum size of the list of users that will be returned by the userFindResult event. If 0, all the found users are returned.
See Also:
SmartFox.send(sfs2x.client.requests.IRequest), Room, SFSEvent.USER_FIND_RESULT

FindUsersRequest

public FindUsersRequest(MatchExpression matchExpr)
See Also:
FindUsersRequest(MatchExpression, Object, short)

FindUsersRequest

public FindUsersRequest(MatchExpression matchExpr,
                        java.lang.Object target)
See Also:
FindUsersRequest(MatchExpression, Object, short)
Method Detail

validate

public void validate(ISmartFox sfs)
              throws sfs2x.client.exceptions.SFSValidationException
* API internal usage only *

Throws:
sfs2x.client.exceptions.SFSValidationException

execute

public void execute(ISmartFox sfs)
* API internal usage only *