org.starhope.appius.user
Class User

java.lang.Object
  extended by org.starhope.appius.util.ManagedReferenceHolder
      extended by org.starhope.appius.sql.SQLPeerDatum
          extended by org.starhope.appius.user.Person
              extended by org.starhope.appius.user.User

public class User
extends Person

User objects refer only to actual users, who may or may not be signed into the game right now. This is the persistent information pertinent to an actual human being or to a software agent which acts as a user under certain circumstances, such as a payment gateway.

Author:
brpocock

Field Summary
private  AgeBracket ageGroup
          The age bracket to which this user belongs: currently kid (0-12), teen (13-17), or adult (18+).
private  Date approvedDate
          The date on which the account was approved (by parent) or eMail was validated (by self).
private  AvatarClass avatarClass
          The type of avatar in play
private  Colour baseColor
          The base colour of the avatar
private  int basic8Choice
          The Toot from the Basic 8 that they originally chose.
private  Date birthDate
          The user's date of birth.
private  com.tootsville.braque.UserList buddyList
           
private  boolean canEnterChatZone
          True if the user can enter a zone where people can chat freely.
private  boolean canEnterMenuZone
          True if the user can enter a zone where dialogue is chosen from menus.
private  boolean canTalk
          True if the user is allowed to type chat.
private  Date emailPlusDate
          For kids, this is the date on which eMail Plus secondary eMail is sent out.
private  Colour extraColor
          The extra colour of the avatar.
private  int houseTypeID
          House type ID
private  com.tootsville.braque.UserList ignoreList
           
private  HashSet<InventoryItem> inventory
          All types of inventory in a single set.
private  boolean isActive
          If true, the account is active (not canceled nor banned)
private  boolean isBanned
          If true, the account is banned (not active nor canceled)
private  boolean isCanceled
          If true, the account is canceled (not active nor banned)
private  int kickedByUserID
          The user ID who kicked this user offline.
private  String kickedReasonCode
          The reason that this user is kicked offline or banned.
private  Timestamp kickedUntil
          The date at which the user is no longer kicked offline.
private  Timestamp lastActive
          the time at which the user last was logged on, or the current time (plus 5 seconds) if they're on now.
private  String lastZoneName
          the last zone on which the user had been logged on; or, their current zone, if we can see Smartfox from here.
private  int lotID
          Lot (neighborhood) ID
static int MAX_LOGIN_LENGTH
          Maximum length of a login/username (in characters)
static int MAX_PW_LENGTH
          Maximum length of a password (in characters)
static int MIN_LOGIN_LENGTH
          Minimum length of a login/username (in characters)
static int MIN_PW_LENGTH
          Minimum length of a password (in characters)
private  Timestamp nameApprovedAt
          The timestamp of Lifeguard approval of the user's name (or null, if it hasn't been approved yet)
private  long nameApprovedByUserID
          The user ID of the moderator who approved this user's name
private  Timestamp nameRequestedAt
          The time at which this user entered his/her request for a new name.
private  boolean needsNaming
          If true, the user hasn't picked a name for this account (but it may have a system-assigned random one), so we need to nag them to pick a name.
private  boolean parentApprovedName
          Whether the user's parent has approved the name yet.
private  int parentID
          Pointer to the parent of this user, if the user's age bracket is "kid"
private  BigDecimal peanuts
          The number of peanuts (currency) that this user has.
private  String requestedName
          The user name which the user has requested, but has not yet been approved.
private  HashSet<Integer> rooms
           
private static it.gotoandplay.smartfoxserver.SmartFoxServer sfs
          The Smart Fox Server that we might be able to talk to.
static int STAFF_LEVEL_ACCOUNT_SERVICE
          Staff level for users able to view account (subscription) data
static int STAFF_LEVEL_DESIGNER
          Staff level for users able to edit the game world
static int STAFF_LEVEL_DEVELOPER
          Staff level for software developers
static int STAFF_LEVEL_MODERATOR
          Staff level for moderators (including life guards and tour guides)
static int STAFF_LEVEL_PUBLIC
          Staff level for public users (free or paid users)
static int STAFF_LEVEL_STAFF_MEMBER
          Staff level for all members of the staff (Sidereal employees)
private  int staffLevel
          The level of staff authority possessed by this user.
private  int tootTimeLeft
          The number of hours remaining of this user's Toot Timer
private  int tootTimeLeftMinutes
          The number of minutes (beyond the hour) remaining of this user's Toot Timer
private  boolean tootTimerDay
          If true, the user's Toot Timer will refill every day CV tootTimerMonth
private  int tootTimeRefill
          The number of hours which are added to the Toot Timer on each refill.
private  boolean tootTimerMonth
          If true, the user's Toot Timer will refill every month.
private  int userID
          The user's numeric ID, for database purposes.
private  String userName
          The user's current, active login name.
 
Fields inherited from class org.starhope.appius.user.Person
canContact, dialect, forgotPasswordAnswer, forgotPasswordQuestion, givenName, language, mail, mailConfirmed, password
 
Constructor Summary
  User(Date birthDate, String avatarTitle, String userNameRequest)
          Create a new user account
  User(int id)
          Instantiate a user object from an existing user account ID
private User(ResultSet rs)
          Instantiate a User object based upon the contents of a ResultSet.
  User(String login)
          Instantiate a user object from an existing user account ID
 
Method Summary
 String acceptPeanutCode(String peanut)
          WRITEM: document this method (brpocock, Aug 31, 2009)
 void addBuddy(User newBuddy)
          Adds a user to this user's buddy list.
 void addDefaultFreeItem(int id)
          TODO: document this method (brpocock, Sep 8, 2009)
protected  void addFreeClothing(ClothingItem clothingItem)
           
 void addItem(int itemID)
           
 void addItem(InventoryItem item)
          WRITEME: document this method (brpocock, Aug 31, 2009)
 void addRoom(int roomNumber)
           
 void approveName(User nameApprovedBy)
          Approve the user's requested name, and make it active
 void assertStaffLevel(int staffLevelNeeded)
          Assert that this user must have the given staff level (or greater).
static void assertUserNameAvailable(String userNameRequested)
           Make the assertion that the user name supplied is available to be requested or assigned to this user.
 void attend(User otherGuy)
          WRITEME: document this method (brpocock, Aug 31, 2009)
 void ban(User bannedBy, String bannedReason)
          Ban a user, preventing any future access to the server.
 boolean canApproveSelf()
          If the user is a teen (13+) or adult, they are allowed to approve their own account.
 void cancelEvent(int eventID)
           
 boolean canLogIn(String passGuess)
          Determine whether the user can log in with the given password.
 boolean canMakePurchase()
           Only adults are allowed to make purchases.
static boolean canSeeSmartFoxServer()
          Check whether the SmartFox Server is available and visible to us (sharing this VM).
static void dangerous__removeTestUsers()
          Delete test users: test???? accounts with email of testing@tootsville.com will be DESTROYED from the database.
 void doff(ClothingItem item)
           
 void doffClothes()
          Get naked
 void doffPivitz()
          Remove Pivitz
 org.json.JSONObject endEvent(int eventID, String moniker, BigDecimal rawScore, String medalMoniker)
          Close out an event started with startEvent(String).
 void endEventPurchaseRaw(int eventID, int itemID)
          WRITEME: document this method (brpocock, Aug 31, 2009)
 void endEventPurchaseRaw(int eventID, com.tootsville.braque.StoreItem item)
          WRITEME: document this method (brpocock, Aug 24, 2009)
 void flush()
          Write any changes to database
 void generateSystemName()
          Generate a new "anonymous user name" for the user.
static User get(org.json.JSONObject object)
           
 org.json.JSONObject getActiveClothing()
           
 HomeDecorItem[] getActiveDecorations(int roomNumber)
          WRITEME: document this method (brpocock, Aug 28, 2009)
 int getAge()
          Get the current age of the user.
 AgeBracket getAgeGroup()
           
 String getApprovalCookie()
           
 Date getApprovedDate()
           
 String getApprovedDateString()
           
 AvatarClass getAvatarClass()
           
 Colour getBaseColor()
           
 int getBasic8Choice()
           
 Date getBirthDate()
           
 com.tootsville.braque.UserList getBuddyList()
          Get the user's buddy list (a UserList)
 Set<String> getBuddyListNames()
          Get the names of everyone on the user's buddy list.
 User getByApprovalCookie(String cookie)
           
static User getByID(int id)
          Instantiate a user object from an existing user account ID
static User getByLogin(String login)
           
static User[] getByMail(String mail)
          Returns an array of all users associated with a given eMail address.
static User getByPeer(User u)
          Get a Braque User object for the respective Smart Fox Server user object
static User getByRequestedName(String userNameRequested)
          Get the user who has requested a certain name, if any.
protected  String getCacheUniqueID()
          This is an overriding method.
 String getConnectedFrom()
          Get the IP address or hostname from which the user is connected (if we can tell).
 String getDialect()
           
 String getDisplayName()
          This method's only use is for more closely aligning User and Parent classes.
 Date getEmailPlusDate()
           
 String getEmailPlusDateString()
           
 Colour getExtraColor()
           
 HomeDecorItem getFurnitureBySlot(int slotNumber)
           
 String getGivenName()
           
 HashMap<Timestamp,HashMap<String,String>> getHistory(Date after, int limit)
          Returns the historical contents of this user's record.
 int getHouseTypeID()
           
 com.tootsville.braque.UserList getIgnoreList()
          WRITEME: document this method (brpocock, Aug 31, 2009)
 int getInboxCount()
           
 InventoryItem[] getItemsByType(String typeString)
          WRITEME: document this method (brpocock, Aug 28, 2009)
 InventoryItem[] getItemsByType(String[] types)
          WRITEME: document this method (brpocock, Aug 28, 2009)
 long getKickedByUserID()
           
 String getKickedMessage()
           
 String getKickedReasonCode()
           
 Timestamp getKickedUntil()
           
 Timestamp getLastActive()
           
 String getLastZone()
           
 int getLotID()
           
private  com.tootsville.braque.mail.MailBox getMailBox(String title)
           
 com.tootsville.braque.mail.MailBox[] getMailboxes()
           
 com.tootsville.braque.mail.MailMessage[] getMailInBox(String boxName)
           
 Timestamp getNameApprovedAt()
           
 long getNameApprovedByUserID()
           
static String getNameForID(int id)
           
 Timestamp getNameRequestedAt()
           
 Parent getParent()
           
 boolean getParentApprovedName()
           
 int getParentID()
           
 org.json.JSONObject getPassport_JSON()
           
 BigDecimal getPeanuts()
           
 org.json.JSONObject getPublicInfo()
           
 String getRequestedName()
           
 String getResponsibleMail()
          Get the eMail address of a responsible person: either the player, or the parent.
private  User getSFSPeer()
          If we can see the SmartFox Server, and if this user has a peer "User" signed in to that server now, then get that peer user object so that we can do things to them in real time (in the game).
 int getStaffLevel()
           
private  String getSystemNameAdjective()
           
private  String getSystemNameNoun()
           
static User getSystemUser()
          Get the System user object (the user which represents the system program itself).
 int getTootTimeLeft()
           
 String getTootTimeLeft$()
           
 int getTootTimeLeftMinutes()
           
 int getTootTimeRefill()
           
 UserEnrolment[] getUserEnrolments()
           
 int getUserID()
           
 String getUserName()
           
 String getUserNameOrRequest()
          WRITEME: document this method (brpocock, Sep 2, 2009)
static User[] getUsersAwaitingNameApproval()
          Get up to 20 users who are awaiting approval of their names.
 boolean hasItem(int id)
           
 boolean hasItem(InventoryItem item)
           
 boolean hasStaffLevel(int staffLevelNeeded)
           
 void ignore(User otherUser)
          Calling this method indicates that this user wants to ignore the other specified user.
 boolean isActive()
           
 boolean isApproved()
          See approvedDate for discussion
 boolean isBanned()
           
 boolean isBirthday()
           
 boolean isCanceled()
           
 boolean isCanContact()
           
 boolean isCanEnterChatZone()
           
 boolean isCanEnterMenuZone()
           
 boolean isCanTalk()
           
 boolean isKicked()
          Returns true if the user has been kicked offline (and the time has not yet elapsed).
static boolean isNameAvailable(String name)
          Determine whether the given name is potentially available for use.
static boolean isNameForbidden(String userNameRequested)
          Determine whether a name is forbidden
static boolean isNameValid(String userName)
          Determines whether the name provided contains allowed characters for an user name.
 boolean isNeedsNaming()
          Returns whether this account has a system-provided (not user-provided) name, or no name at all, and we need to prompt the user (or parent) to name it.
 boolean isNeedsParentAttention()
           
 boolean isOnline()
           
 boolean isPaidMember()
           
 boolean isTootTimerDay()
           
 boolean isTootTimerMonth()
           
 void kick(User kickedBy, String kickedReason, long kickedMinutes)
          Kick a user offline for a number of minutes.
 void kick(User kickedBy, String kickedReason, Timestamp allowBack)
          Kick the user offline, until a certain date & time.
private  void loadHouseFromDB()
           
private  void loadInventoryFromDB()
          WRITEME: document this method (brpocock, Sep 4, 2009)
 String login(String chapSeed, String passwordGuess)
          Validate the user's login attempt, returning a failure message if it could not happen (e.g.
 boolean nameNeedsApproval()
          Returns true if this user has requested a name but it hasn't yet been approved by a Lifeguard
 boolean nameNeedsParentalApproval()
           
 boolean needsNaming()
          Returns whether this account has a system-provided (not user-provided) name, or no name at all, and we need to prompt the user (or parent) to name it.
 boolean needsParent()
          Kid accounts (under 13) require parental confirmation.
 void parentApprovedAccount(boolean whether)
          Call this method when the parent determines whether to approve or disapprove this account.
 void parentApprovedName(boolean whether)
           
private  void populateByID(int id)
          Private method used to look up User in the database and fill in the attributes
private  void populateByLogin(String login)
          Fetch a user record out of the database based upon its login name
 void purchase(com.tootsville.braque.StoreItem item)
          WRITEME: document this method (brpocock, Aug 28, 2009)
protected  void remindPassword()
          WRITEME: document this method (brpocock, Aug 12, 2009) method to send e-mail to account owner (parent account or user account) with a reset password.
 void removeBuddy(User otherGuy)
          Don't want for him to be my buddy any more
 void rename(String newName)
           Rename the user account, updating all necessary related records.
 void reportedToModeratorBy(User u)
          WRITEME: document this method (brpocock, Aug 31, 2009)
 void requestNewUserName(String userNameRequested)
          WRITEME: document this method (brpocock, Jul 14, 2009)
 void requestParentApproval()
          WRITEME: document this method (brpocock, Jul 8, 2009)
(package private)  void sendConfirmationMail()
          Send the parental- or self- confirmation message, depending upon the user's age
 boolean sendMail(String to, String subject, String body)
           
private  boolean sendMail(User to, String subject, String body)
           
protected  void set(ResultSet resultSet)
           
 void setActive(boolean isActive)
           
 AgeBracket setAgeGroup()
          Sets the age group based upon the user's date of birth.
 void setAgeGroupToSystem()
          Declares this to be an inhuman, ergo ageless, user account.
 void setApprovedDate(Date date)
           
 void setAvatarClass(AvatarClass avatarClass)
           
 void setBaseColor(Colour newBaseColor)
           
 void setBasic8Choice(int basic8Choice)
           
 void setBirthDate(Date birthDate)
           
 void setCanceled(boolean isCanceled)
           
 void setCanContact(boolean canContact)
           
 void setCanEnterChatZone(boolean canEnterChatZone)
           
 void setCanEnterMenuZone(boolean canEnterMenuZone)
           
 void setCanTalk(boolean canTalk)
           
 void setEmailPlusDate(Date emailPlusDate)
           
 void setExtraColor(Colour extraColor)
           
 void setGivenName(String givenName)
           
 void setHouseTypeID(int houseTypeID)
           
 void setLot(int newLotID)
           
 void setLotID(int lotID)
           
 void setMail(String mail)
           
 void setMailConfirmed(Timestamp mailConfirmed)
           
 void setNeedsNaming(boolean needsNaming)
           
 void setParent(Parent parent)
          Set this to be a child account with the specified parent.
 void setPassport(String moniker)
           
private  void setPeanuts(BigDecimal add)
          WRITEME: document this method (brpocock, Sep 2, 2009)
 void setStaffLevel(int staffLevel)
           
 void setTootTimerDay(boolean tootTimerDay)
           
 void setTootTimeRefill(int tootTimeRefill)
           
 void setTootTimerMonth(boolean tootTimerMonth)
           
 void setUserID(int userID)
           
 void setUserName(String userName)
           
 void setUserNameFromUser(String userName)
           Set a user name, requested by the user.
 void stampPassport(String moniker)
          TODO: document this method (brpocock, Sep 8, 2009)
 org.json.JSONObject startEvent(String moniker)
           Start an event, and return the results as a partial JSON Object.
 int startEventRaw(String moniker)
          Register a new event.
 org.json.JSONObject toJSON()
          Sends a limited subset of data for the client to know.
 String toString()
           
 void wear(ClothingItem item)
           
 void wear(ClothingItem item, int color)
           
 
Methods inherited from class org.starhope.appius.user.Person
checkPassword, forgotPassword, getForgotPasswordAnswer, getForgotPasswordQuestion, getLanguage, getMail, getMailConfirmed, getPassword, getResponsiblePerson, setPassword, setPasswordRecovery
 
Methods inherited from class org.starhope.appius.sql.SQLPeerDatum
changed, findInCache, get, prepare, prepare, saveInCache, set
 
Methods inherited from class org.starhope.appius.util.ManagedReferenceHolder
deref, setRef
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MAX_LOGIN_LENGTH

public static final int MAX_LOGIN_LENGTH
Maximum length of a login/username (in characters)

See Also:
Constant Field Values

MAX_PW_LENGTH

public static final int MAX_PW_LENGTH
Maximum length of a password (in characters)

See Also:
Constant Field Values

MIN_LOGIN_LENGTH

public static final int MIN_LOGIN_LENGTH
Minimum length of a login/username (in characters)

See Also:
Constant Field Values

MIN_PW_LENGTH

public static final int MIN_PW_LENGTH
Minimum length of a password (in characters)

See Also:
Constant Field Values

sfs

private static it.gotoandplay.smartfoxserver.SmartFoxServer sfs
The Smart Fox Server that we might be able to talk to.


STAFF_LEVEL_ACCOUNT_SERVICE

public static final int STAFF_LEVEL_ACCOUNT_SERVICE
Staff level for users able to view account (subscription) data

See Also:
Constant Field Values

STAFF_LEVEL_DESIGNER

public static final int STAFF_LEVEL_DESIGNER
Staff level for users able to edit the game world

See Also:
Constant Field Values

STAFF_LEVEL_DEVELOPER

public static final int STAFF_LEVEL_DEVELOPER
Staff level for software developers

See Also:
Constant Field Values

STAFF_LEVEL_MODERATOR

public static final int STAFF_LEVEL_MODERATOR
Staff level for moderators (including life guards and tour guides)

See Also:
Constant Field Values

STAFF_LEVEL_PUBLIC

public static final int STAFF_LEVEL_PUBLIC
Staff level for public users (free or paid users)

See Also:
Constant Field Values

STAFF_LEVEL_STAFF_MEMBER

public static final int STAFF_LEVEL_STAFF_MEMBER
Staff level for all members of the staff (Sidereal employees)

See Also:
Constant Field Values

ageGroup

private AgeBracket ageGroup
The age bracket to which this user belongs: currently kid (0-12), teen (13-17), or adult (18+). Computed from birth date periodically and cached.


approvedDate

private Date approvedDate
The date on which the account was approved (by parent) or eMail was validated (by self). Either way, it's basically eMail validation, but just differs in who gets the mail. The date on which the account was approved (by parent) or eMail was validated (by self). Either way, it's basically eMail validation, but just differs in who gets the mail.


avatarClass

private AvatarClass avatarClass
The type of avatar in play


baseColor

private Colour baseColor
The base colour of the avatar


basic8Choice

private int basic8Choice
The Toot from the Basic 8 that they originally chose.


birthDate

private Date birthDate
The user's date of birth. Required, COPPA.


buddyList

private com.tootsville.braque.UserList buddyList

canEnterChatZone

private boolean canEnterChatZone
True if the user can enter a zone where people can chat freely. Lightning in Tootsville.


canEnterMenuZone

private boolean canEnterMenuZone
True if the user can enter a zone where dialogue is chosen from menus. Hearts in Tootsville.


canTalk

private boolean canTalk
True if the user is allowed to type chat.


emailPlusDate

private Date emailPlusDate
For kids, this is the date on which eMail Plus secondary eMail is sent out. This may be past or future.


extraColor

private Colour extraColor
The extra colour of the avatar. For Master Toot (Amphibious) this is the nose/highlight colour


houseTypeID

private int houseTypeID
House type ID


ignoreList

private com.tootsville.braque.UserList ignoreList

inventory

private final HashSet<InventoryItem> inventory
All types of inventory in a single set.


isActive

private boolean isActive
If true, the account is active (not canceled nor banned)


isBanned

private boolean isBanned
If true, the account is banned (not active nor canceled)


isCanceled

private boolean isCanceled
If true, the account is canceled (not active nor banned)


kickedByUserID

private int kickedByUserID
The user ID who kicked this user offline. (or -1)


kickedReasonCode

private String kickedReasonCode
The reason that this user is kicked offline or banned.


kickedUntil

private Timestamp kickedUntil
The date at which the user is no longer kicked offline. For banned users, this is Timestamp ( Long.MAX_LONG ), which means the universe should end first.


lastActive

private Timestamp lastActive
the time at which the user last was logged on, or the current time (plus 5 seconds) if they're on now.


lastZoneName

private String lastZoneName
the last zone on which the user had been logged on; or, their current zone, if we can see Smartfox from here.


lotID

private int lotID
Lot (neighborhood) ID


nameApprovedAt

private Timestamp nameApprovedAt
The timestamp of Lifeguard approval of the user's name (or null, if it hasn't been approved yet)


nameApprovedByUserID

private long nameApprovedByUserID
The user ID of the moderator who approved this user's name


nameRequestedAt

private Timestamp nameRequestedAt
The time at which this user entered his/her request for a new name.


needsNaming

private boolean needsNaming
If true, the user hasn't picked a name for this account (but it may have a system-assigned random one), so we need to nag them to pick a name.


parentApprovedName

private boolean parentApprovedName
Whether the user's parent has approved the name yet.


parentID

private int parentID
Pointer to the parent of this user, if the user's age bracket is "kid"


peanuts

private BigDecimal peanuts
The number of peanuts (currency) that this user has.


requestedName

private String requestedName
The user name which the user has requested, but has not yet been approved.


rooms

private final HashSet<Integer> rooms

staffLevel

private int staffLevel
The level of staff authority possessed by this user.


tootTimeLeft

private int tootTimeLeft
The number of hours remaining of this user's Toot Timer


tootTimeLeftMinutes

private int tootTimeLeftMinutes
The number of minutes (beyond the hour) remaining of this user's Toot Timer


tootTimerDay

private boolean tootTimerDay
If true, the user's Toot Timer will refill every day CV tootTimerMonth


tootTimeRefill

private int tootTimeRefill
The number of hours which are added to the Toot Timer on each refill.


tootTimerMonth

private boolean tootTimerMonth
If true, the user's Toot Timer will refill every month. CV tootTimerDay


userID

private int userID
The user's numeric ID, for database purposes.


userName

private String userName
The user's current, active login name.

Constructor Detail

User

public User(Date birthDate,
            String avatarTitle,
            String userNameRequest)
     throws AlreadyUsedException,
            ForbiddenUserException
Create a new user account

Parameters:
birthDate - The player's date of birth
avatarTitle - The name of the avatar (class) which the player wants to use.
userNameRequest -
Throws:
ForbiddenUserException
AlreadyUsedException

User

public User(int id)
     throws NotFoundException
Instantiate a user object from an existing user account ID

Parameters:
id - user ID value
Throws:
NotFoundException - if the user can't be found in the database.

User

private User(ResultSet rs)
Instantiate a User object based upon the contents of a ResultSet. This is used internally by some of the static methods that return sets of users based upon database queries; e.g. see getUsersAwaitingNameApproval()

Parameters:
rs - The ResultSet object (with the cursor at the current row to be instantiated). Note that this implies that rs.next() has been called at least once.

User

public User(String login)
     throws NotFoundException
Instantiate a user object from an existing user account ID

Parameters:
login - user login name
Throws:
NotFoundException - if the user can't be found in the database.
Method Detail

assertUserNameAvailable

public static void assertUserNameAvailable(String userNameRequested)
                                    throws AlreadyUsedException,
                                           ForbiddenUserException

Make the assertion that the user name supplied is available to be requested or assigned to this user.

Note that having another user request the name, which has not been either permitted or denied, will still throw an AlreadyUsedException.

This routine returns void, because it throws exceptions if the name is forbidden or already used. For a boolean version, see isNameAvailable(String)

Parameters:
userNameRequested - The name which is being requested
Throws:
AlreadyUsedException - if the user name has been requested or accepted already
ForbiddenUserException - if the user name is forbidden from use (obscene, gives away personal information, or so forth). See isNameForbidden(String)

canSeeSmartFoxServer

public static boolean canSeeSmartFoxServer()
Check whether the SmartFox Server is available and visible to us (sharing this VM). If so, the static member variable "sfs" will be set to it.

Returns:
true, if we have access to Smart Fox Server.

dangerous__removeTestUsers

public static void dangerous__removeTestUsers()
                                       throws SQLException
Delete test users: test???? accounts with email of testing@tootsville.com will be DESTROYED from the database.

Throws:
SQLException - if it can't be done.

get

public static User get(org.json.JSONObject object)
Parameters:
object -
Returns:

getByID

public static User getByID(int id)
Instantiate a user object from an existing user account ID

Parameters:
id - The user ID to instantiate
Returns:
the instantiated user record, or null if the user ID doesn't represent a user record (too high, or the record was destroyed somehow) — not returned for deleted or banned accounts, though.

getByLogin

public static User getByLogin(String login)
Parameters:
login - the user login name
Returns:
the User record, or null if no user currently has that login name

getByMail

public static User[] getByMail(String mail)
Returns an array of all users associated with a given eMail address. This includes all users who report it as being their own eMail address, as well as the children of any parents using it.

Parameters:
mail - The eMail address for which we are searching
Returns:
An array of any/all such users. If the array consists only of one element, which is the value "null," then there are too many results and special effort is required to recall the list.

getByPeer

public static User getByPeer(User u)
Get a Braque User object for the respective Smart Fox Server user object

Parameters:
u - The Smart Fox Server user object
Returns:
the parallel Braque user object

getByRequestedName

public static User getByRequestedName(String userNameRequested)
Get the user who has requested a certain name, if any.

Parameters:
userNameRequested - the user name for which we're searching
Returns:
null, if no user has requested the name; otherwise, the user who requested it. (Note that the name might have been approved, or might not have been.)

getNameForID

public static String getNameForID(int id)
Parameters:
id -
Returns:

getSystemUser

public static User getSystemUser()
Get the System user object (the user which represents the system program itself). In particular, the System object's eMail address and givenName are used to address mail to users.

Returns:
the System user object

getUsersAwaitingNameApproval

public static User[] getUsersAwaitingNameApproval()
Get up to 20 users who are awaiting approval of their names. Will not return more than 20 users in a set, but could return an empty set.

Returns:
A set of users who are awaiting name approval

isNameAvailable

public static boolean isNameAvailable(String name)
Determine whether the given name is potentially available for use. Returns false if the name has already been forbidden (by virtue of matching a negative filter rule, or having been previously denied to another user), or if the name is currently either in use or requested by another user.

Parameters:
name - The user name being checked
Returns:
true, if the name can potentially be tried.

isNameForbidden

public static boolean isNameForbidden(String userNameRequested)
Determine whether a name is forbidden

... A user name is “forbidden” if it matches a negative filter (if it contains forbidden word(s) or phrase(s)), or if it has previously been banned for some reason

Parameters:
userNameRequested - The name to be checked
Returns:
True, if the requested name is forbidden

isNameValid

public static boolean isNameValid(String userName)
Determines whether the name provided contains allowed characters for an user name.

Parameters:
userName - the user name to be checked
Returns:
true, if the name consists of valid characters

acceptPeanutCode

public String acceptPeanutCode(String peanut)
                        throws NotFoundException,
                               AlreadyUsedException
WRITEM: document this method (brpocock, Aug 31, 2009)

Parameters:
peanut -
Returns:
user-visible message
Throws:
NotFoundException
AlreadyUsedException

addBuddy

public void addBuddy(User newBuddy)
Adds a user to this user's buddy list. Note that this does not implement the buddy-request functionality at this level, that's implemented by the client at present.

Parameters:
newBuddy - the user to be the new buddy

addDefaultFreeItem

public void addDefaultFreeItem(int id)
TODO: document this method (brpocock, Sep 8, 2009)

Parameters:
id -

addFreeClothing

protected void addFreeClothing(ClothingItem clothingItem)
Parameters:
clothingItem - The item to be added to the user's inventory as a free gift (or prize)

addItem

public void addItem(int itemID)

addItem

public void addItem(InventoryItem item)
WRITEME: document this method (brpocock, Aug 31, 2009)

Parameters:
item -

addRoom

public void addRoom(int roomNumber)
Parameters:
roomNumber -

approveName

public void approveName(User nameApprovedBy)
                 throws PrivilegeRequiredException
Approve the user's requested name, and make it active

Parameters:
nameApprovedBy - the user approving the name (requires moderator privileges)
Throws:
PrivilegeRequiredException - if the user approving the name does not have moderator privileges

assertStaffLevel

public void assertStaffLevel(int staffLevelNeeded)
                      throws PrivilegeRequiredException
Assert that this user must have the given staff level (or greater). Throws an exception if this is untrue.

Parameters:
staffLevelNeeded - The minimum staff level which is being asserted
Throws:
PrivilegeRequiredException - if the minimum staff level is not met.

attend

public void attend(User otherGuy)
WRITEME: document this method (brpocock, Aug 31, 2009)

Parameters:
otherGuy -

ban

public void ban(User bannedBy,
                String bannedReason)
         throws PrivilegeRequiredException
Ban a user, preventing any future access to the server.

Parameters:
bannedBy - The moderator by which the user was banned.
bannedReason - the reason for which the user was banned
Throws:
PrivilegeRequiredException - if the user does not have moderator-level (or better) privileges

canApproveSelf

public boolean canApproveSelf()
If the user is a teen (13+) or adult, they are allowed to approve their own account. This is a boolean test for that fact.

Returns:
true, if the user is permitted to approve their own account (via their own eMail address). False, if they require parent approval.

cancelEvent

public void cancelEvent(int eventID)
Parameters:
eventID - the event ID to be canceled

canLogIn

public boolean canLogIn(String passGuess)
Determine whether the user can log in with the given password.

Parameters:
passGuess - The user's attempted password
Returns:
true, if the user gave the correct password, and is allowed to log in. False, if any of these is not true (but does not give any information why)

canMakePurchase

public boolean canMakePurchase()

Only adults are allowed to make purchases. Determine whether this user is allowed to make purchases, or if we should ask them to get their parents to buy things for them.

In the future, this might not be just a test to check whether the user is an adult. We might, for example, have kids with gift cards that will be able to make some purchases on their own.

Returns:
true, if this user is allowed to purchase things. False, if they have to get their parents' permission.

doff

public void doff(ClothingItem item)
Parameters:
item -
See Also:
wear(ClothingItem)

doffClothes

public void doffClothes()
Get naked


doffPivitz

public void doffPivitz()
Remove Pivitz


endEvent

public org.json.JSONObject endEvent(int eventID,
                                    String moniker,
                                    BigDecimal rawScore,
                                    String medalMoniker)
                             throws org.json.JSONException
Close out an event started with startEvent(String). Handles "fountain" events specially by giving a random score from 1..100.

Parameters:
eventID - The ID of the event
moniker -
rawScore - The earned score (points, not peanuts). Ignored for fountains.
medalMoniker - The moniker of the medal earned, if any
Returns:
JSON data describing the completed event and high score data for that type of event.
Throws:
org.json.JSONException - if the JSON data can't be represented correctly.

endEventPurchaseRaw

public void endEventPurchaseRaw(int eventID,
                                int itemID)
                         throws NotFoundException,
                                NonSufficientFundsException,
                                AlreadyExistsException
WRITEME: document this method (brpocock, Aug 31, 2009)

Parameters:
eventID -
itemID -
Throws:
NotFoundException
NonSufficientFundsException
AlreadyExistsException

endEventPurchaseRaw

public void endEventPurchaseRaw(int eventID,
                                com.tootsville.braque.StoreItem item)
                         throws NotFoundException,
                                NonSufficientFundsException,
                                AlreadyExistsException
WRITEME: document this method (brpocock, Aug 24, 2009)

Parameters:
eventID -
item -
Throws:
NotFoundException
NonSufficientFundsException
AlreadyExistsException

flush

public void flush()
Write any changes to database

Specified by:
flush in class Person
See Also:
SQLPeerDatum.flush()

generateSystemName

public void generateSystemName()
Generate a new "anonymous user name" for the user.


getActiveClothing

public org.json.JSONObject getActiveClothing()
Returns:
A JSON array of clothing being worn (including pattern and Pivitz) in the order preferred by the client

getActiveDecorations

public HomeDecorItem[] getActiveDecorations(int roomNumber)
                                     throws NotFoundException
WRITEME: document this method (brpocock, Aug 28, 2009)

Parameters:
roomNumber - which room of the user's house
Returns:
Throws:
NotFoundException

getAge

public int getAge()
Get the current age of the user. This is set up such that the user's age will increment on their birthday.

Returns:
The user's legal age, in years.

getAgeGroup

public AgeBracket getAgeGroup()
Returns:
the ageGroup

getApprovalCookie

public String getApprovalCookie()
Returns:

getApprovedDate

public Date getApprovedDate()
Returns:
the approvedDate

getApprovedDateString

public String getApprovedDateString()
Returns:
Returns a displayable string describing whether the user has been approved, and if so, when
See Also:
getApprovedDate()

getAvatarClass

public AvatarClass getAvatarClass()
Returns:
the avatarClassID

getBaseColor

public Colour getBaseColor()
Returns:
the baseColor

getBasic8Choice

public int getBasic8Choice()
Returns:
the basic8Choice

getBirthDate

public Date getBirthDate()
Returns:
the birthDate

getBuddyList

public com.tootsville.braque.UserList getBuddyList()
Get the user's buddy list (a UserList)

Returns:
the user's buddy list

getBuddyListNames

public Set<String> getBuddyListNames()
Get the names of everyone on the user's buddy list. See getBuddyList()

Returns:
set of user strings

getByApprovalCookie

public User getByApprovalCookie(String cookie)
                         throws IOException,
                                NotFoundException
Parameters:
cookie -
Returns:
Throws:
IOException
NotFoundException

getCacheUniqueID

protected String getCacheUniqueID()
This is an overriding method.

Specified by:
getCacheUniqueID in class SQLPeerDatum
Returns:
The local (Stringified) version of an unique ID; usually the database ID column
See Also:
SQLPeerDatum.getCacheUniqueID()

getConnectedFrom

public String getConnectedFrom()
Get the IP address or hostname from which the user is connected (if we can tell). See isOnline() for the usual caveats (also getSFSPeer()

Returns:
What SmartFox Server claims will be the string of an IP address, but could actually be a hostname (DNS domain record).

getDialect

public String getDialect()
Overrides:
getDialect in class Person
Returns:
the dialect

getDisplayName

public String getDisplayName()
Description copied from class: Person
This method's only use is for more closely aligning User and Parent classes. Since Parent class does not have a user name, it returns null.

Specified by:
getDisplayName in class Person
Returns:
null
See Also:
Person.getDisplayName()

getEmailPlusDate

public Date getEmailPlusDate()
Returns:
the emailPlusDate

getEmailPlusDateString

public String getEmailPlusDateString()
Returns:
Returns a user-displayable English string describing when the eMail Plus confirmation happened, if it has.
See Also:
getEmailPlusDate()

getExtraColor

public Colour getExtraColor()
Returns:
the extraColor

getFurnitureBySlot

public HomeDecorItem getFurnitureBySlot(int slotNumber)
                                 throws NotFoundException
Parameters:
slotNumber -
Returns:
Throws:
NotFoundException

getGivenName

public String getGivenName()
Overrides:
getGivenName in class Person
Returns:
the givenName

getHistory

public HashMap<Timestamp,HashMap<String,String>> getHistory(Date after,
                                                            int limit)
Returns the historical contents of this user's record.

Specified by:
getHistory in class Person
Parameters:
after - If non-null, specifies the date after which we want to view records. To see all records, back to the creation of the user record, supply a null.
limit - If this is a positive number, it limits the results to this number of records.
Returns:
A map of timestamps to key/value pairs. All values are expressed as strings (even though they may have numeric, enumerative, or date / datetime types in the database), since this is primarily (only?) for human-viewable auditing.

getHouseTypeID

public int getHouseTypeID()

getIgnoreList

public com.tootsville.braque.UserList getIgnoreList()
WRITEME: document this method (brpocock, Aug 31, 2009)

Returns:

getInboxCount

public int getInboxCount()
Returns:

getItemsByType

public InventoryItem[] getItemsByType(String typeString)
WRITEME: document this method (brpocock, Aug 28, 2009)

Parameters:
typeString - @see InventoryItem.identifiesAs(String)
Returns:

getItemsByType

public InventoryItem[] getItemsByType(String[] types)
WRITEME: document this method (brpocock, Aug 28, 2009)

Parameters:
types - @see InventoryItem.identifiesAs(String)
Returns:

getKickedByUserID

public long getKickedByUserID()
Returns:
the user ID by which this user was kicked (or banned)

getKickedMessage

public String getKickedMessage()
Returns:
the message explaining the user being kicked (or banned)

getKickedReasonCode

public String getKickedReasonCode()
Returns:
the kickedReasonCode

getKickedUntil

public Timestamp getKickedUntil()
Returns:
the kickedUntil

getLastActive

public Timestamp getLastActive()
Returns:
* the time at which the user last was logged on, or the current time (plus 5 seconds) if they're on now.

getLastZone

public String getLastZone()
Returns:

getLotID

public int getLotID()

getMailBox

private com.tootsville.braque.mail.MailBox getMailBox(String title)
Parameters:
title -
Returns:

getMailboxes

public com.tootsville.braque.mail.MailBox[] getMailboxes()
Returns:

getMailInBox

public com.tootsville.braque.mail.MailMessage[] getMailInBox(String boxName)
Parameters:
boxName -
Returns:

getNameApprovedAt

public Timestamp getNameApprovedAt()
Returns:
The time at which the user's name was approved, if it has been (null if not).

getNameApprovedByUserID

public long getNameApprovedByUserID()
Returns:
the user ID of the moderator who approved this user's name, if approved. (-1 if not)

getNameRequestedAt

public Timestamp getNameRequestedAt()
Returns:
the date & time at which the moderator approved this user's name, if approved (null if not).

getParent

public Parent getParent()
Returns:
this user's parent (if any) — null if none.

getParentApprovedName

public boolean getParentApprovedName()
Returns:
true, if the parent has approved this user's name

getParentID

public int getParentID()
Returns:
the ID number of this user's parent, if any (-1 if none)

getPassport_JSON

public org.json.JSONObject getPassport_JSON()
                                     throws SQLException,
                                            org.json.JSONException
Returns:
Throws:
SQLException
org.json.JSONException

getPeanuts

public BigDecimal getPeanuts()
Returns:
the amount of peanuts (currency) that this user has

getPublicInfo

public org.json.JSONObject getPublicInfo()
Returns:
JSONObject 'self' including userName and avatarClass

getRequestedName

public String getRequestedName()
Returns:
the name that the user requested

getResponsibleMail

public String getResponsibleMail()
Get the eMail address of a responsible person: either the player, or the parent. Currently, kids 13-17 return their own mail.

Specified by:
getResponsibleMail in class Person
Returns:
the eMail address

getSFSPeer

private User getSFSPeer()
If we can see the SmartFox Server, and if this user has a peer "User" signed in to that server now, then get that peer user object so that we can do things to them in real time (in the game).

Returns:
The SmartFox Server's peer User object (if any), or null if we can't obtain it (if we can't see the SFS or if the user isn't logged in right now)

getStaffLevel

public int getStaffLevel()
Returns:
the staffLevel

getSystemNameAdjective

private String getSystemNameAdjective()
Returns:
an adjective usable as part of a system-generated name

getSystemNameNoun

private String getSystemNameNoun()
Returns:
a noun usable as part of a system-generated name

getTootTimeLeft

public int getTootTimeLeft()
Returns:
the tootTimeLeft

getTootTimeLeft$

public String getTootTimeLeft$()
Returns:
the toot time remaining as hours & minutes delimited by "hr " and "min"

getTootTimeLeftMinutes

public int getTootTimeLeftMinutes()
Returns:
the tootTimeLeftMinutes

getTootTimeRefill

public int getTootTimeRefill()
Returns:
the tootTimeRefill

getUserEnrolments

public UserEnrolment[] getUserEnrolments()
Returns:
all enrolments for this user

getUserID

public int getUserID()
Returns:
the userID

getUserName

public String getUserName()
Returns:
the userName

getUserNameOrRequest

public String getUserNameOrRequest()
WRITEME: document this method (brpocock, Sep 2, 2009)

Returns:

hasItem

public boolean hasItem(int id)

hasItem

public boolean hasItem(InventoryItem item)

hasStaffLevel

public boolean hasStaffLevel(int staffLevelNeeded)

ignore

public void ignore(User otherUser)
Calling this method indicates that this user wants to ignore the other specified user.

Parameters:
otherUser - The user, whom this user wishes to ignore

isActive

public boolean isActive()
Returns:
true, if this is an active user account (able to sign in, potentially)

isApproved

public boolean isApproved()
See approvedDate for discussion

Returns:
true, if this account has been approved, and is still active

isBanned

public boolean isBanned()
Returns:
true, if the account is banned (neither active nor canceled)

isBirthday

public boolean isBirthday()
Returns:
true, if today is the user's birthday

isCanceled

public boolean isCanceled()
Returns:
true if the user account was canceled (not active, nor banned)

isCanContact

public boolean isCanContact()
Returns:
the canContact

isCanEnterChatZone

public boolean isCanEnterChatZone()
Returns:
the canEnterChatZone

isCanEnterMenuZone

public boolean isCanEnterMenuZone()
Returns:
the canEnterMenuZone

isCanTalk

public boolean isCanTalk()
Returns:
the canTalk

isKicked

public boolean isKicked()
Returns true if the user has been kicked offline (and the time has not yet elapsed). Returns false otherwise. This does not check the status as to whether the user might have been banned.

Returns:
true, if the user is kicked offline.

isNeedsNaming

public boolean isNeedsNaming()
Returns whether this account has a system-provided (not user-provided) name, or no name at all, and we need to prompt the user (or parent) to name it.

Returns:
true if this user needs to be named

isNeedsParentAttention

public boolean isNeedsParentAttention()
Returns:
true if there is a flag of some kind on this user, that the parent needs to pay attention to.

isOnline

public boolean isOnline()
Returns:
true, if the user is online; false, if they're offline (or we can't tell for certain, e.g. we can't see the SmartFox Server)

isPaidMember

public boolean isPaidMember()
Returns:
true, if the user is a paid member (or staff member)

isTootTimerDay

public boolean isTootTimerDay()
Returns:
true, if the Toot Timer resets every day for this user.

isTootTimerMonth

public boolean isTootTimerMonth()
Returns:
true, if the Toot Timer resets every week for this user.

kick

public void kick(User kickedBy,
                 String kickedReason,
                 long kickedMinutes)
          throws PrivilegeRequiredException
Kick a user offline for a number of minutes.

Parameters:
kickedBy - The user who is kicking this user offline
kickedReason - The reason for which s/he is being kicked
kickedMinutes - The duration for which s/he should be kicked, in minutes. Read that again: minutes — not msec!
Throws:
PrivilegeRequiredException - if the person trying to kick this user off doesn't have moderator privileges

kick

public void kick(User kickedBy,
                 String kickedReason,
                 Timestamp allowBack)
          throws PrivilegeRequiredException
Kick the user offline, until a certain date & time.

Parameters:
kickedBy - The user who is kicking this user offline
kickedReason - The reason for which s/he is being kicked
allowBack - The time at which this user is permitted to be online again.
Throws:
PrivilegeRequiredException - if the person trying to kick this user off doesn't have moderator privileges

loadHouseFromDB

private void loadHouseFromDB()
                      throws SQLException
Throws:
SQLException

loadInventoryFromDB

private void loadInventoryFromDB()
                          throws SQLException
WRITEME: document this method (brpocock, Sep 4, 2009)

Throws:
SQLException

login

public String login(String chapSeed,
                    String passwordGuess)
Validate the user's login attempt, returning a failure message if it could not happen (e.g. the user is kicked). Returns null if the user CAN log in. DOES NOT log the user in to SFS though!

Parameters:
chapSeed - The CHAP random seed (or null, if no seed was used)
passwordGuess - The guessed password. This should be an MD5sum if CHAP is being used (if the seed is not null), or the plaintext password otherwise
Returns:
an error string for the user, or null, if successful.

nameNeedsApproval

public boolean nameNeedsApproval()
Returns true if this user has requested a name but it hasn't yet been approved by a Lifeguard

Returns:
true, if user has requested a new name and it hasn't yet been approved

nameNeedsParentalApproval

public boolean nameNeedsParentalApproval()
Returns:
true if the name hasn't been approved by the parent yet

needsNaming

public boolean needsNaming()
Returns whether this account has a system-provided (not user-provided) name, or no name at all, and we need to prompt the user (or parent) to name it.

Returns:
true if this user needs to be named

needsParent

public boolean needsParent()
Kid accounts (under 13) require parental confirmation. In order to get that, we have to get a parental contact. If this field is false, then the user is either a teenager or adult, or they have a parent on file. It does not mean that they have had their account approved: only that they have given us the parental information (if we needed it). If we ever encounter a user for whom this flag is true, ask them “who's your daddy?”

Returns:
true, if this is a kid account without a known parent (yet)

parentApprovedAccount

public void parentApprovedAccount(boolean whether)
Call this method when the parent determines whether to approve or disapprove this account.

Parameters:
whether - the parent has approved the account; true = approved; false = disapproved

parentApprovedName

public void parentApprovedName(boolean whether)
Parameters:
whether - True if the parent has approved the name; false if they disapprove and want a system suggested name.

populateByID

private void populateByID(int id)
                   throws NotFoundException
Private method used to look up User in the database and fill in the attributes

Parameters:
id - The database ID to load
Throws:
NotFoundException - if the ID isn't found in the database.

populateByLogin

private void populateByLogin(String login)
                      throws NotFoundException
Fetch a user record out of the database based upon its login name

Parameters:
login - The login name (user name)
Throws:
NotFoundException - if there is no user named that *right now*. (There may have been one in the past. Login names are maleable.)

purchase

public void purchase(com.tootsville.braque.StoreItem item)
              throws AlreadyExistsException,
                     NotFoundException,
                     NonSufficientFundsException
WRITEME: document this method (brpocock, Aug 28, 2009)

Parameters:
item -
Throws:
AlreadyExistsException
NotFoundException
NonSufficientFundsException

remindPassword

protected void remindPassword()
Description copied from class: Person
WRITEME: document this method (brpocock, Aug 12, 2009) method to send e-mail to account owner (parent account or user account) with a reset password.

Specified by:
remindPassword in class Person
See Also:
Person.remindPassword()

removeBuddy

public void removeBuddy(User otherGuy)
Don't want for him to be my buddy any more

Parameters:
otherGuy - who?

rename

public void rename(String newName)

Rename the user account, updating all necessary related records. Note, in particular, that Smartfox is wholly dependant upon user names, so all records related to Smartfox must be updated!

If the user is currently online, this will fuck up hilariously, I think.

This is an overriding method.

Specified by:
rename in class Person
Parameters:
newName - The new user name
See Also:
Person.rename(java.lang.String)

reportedToModeratorBy

public void reportedToModeratorBy(User u)
WRITEME: document this method (brpocock, Aug 31, 2009)

Parameters:
u -

requestNewUserName

public void requestNewUserName(String userNameRequested)
                        throws AlreadyUsedException,
                               ForbiddenUserException
WRITEME: document this method (brpocock, Jul 14, 2009)

Post a request to the lifeguards to get approval of a user name

Parameters:
userNameRequested - The user name which the user has requested
Throws:
ForbiddenUserException - if the user name is forbidden (e.g. obscene or previously denied for any reason)
AlreadyUsedException - if someone has already requested or used it

requestParentApproval

public void requestParentApproval()
WRITEME: document this method (brpocock, Jul 8, 2009)


sendConfirmationMail

void sendConfirmationMail()
Send the parental- or self- confirmation message, depending upon the user's age


sendMail

public boolean sendMail(String to,
                        String subject,
                        String body)
Parameters:
to -
subject -
body -
Returns:

sendMail

private boolean sendMail(User to,
                         String subject,
                         String body)
Parameters:
to -
subject -
body -
Returns:

set

protected void set(ResultSet resultSet)
            throws SQLException
Specified by:
set in class SQLPeerDatum
Throws:
SQLException - if the database fails somehow
See Also:
SQLPeerDatum.set(java.sql.ResultSet)

setActive

public void setActive(boolean isActive)
Parameters:
isActive - the isActive to set

setAgeGroup

public AgeBracket setAgeGroup()
Sets the age group based upon the user's date of birth.

Returns:
The age group computed for this user

setAgeGroupToSystem

public void setAgeGroupToSystem()
Declares this to be an inhuman, ergo ageless, user account.


setApprovedDate

public void setApprovedDate(Date date)
Parameters:
date - the approvedDate to set

setAvatarClass

public void setAvatarClass(AvatarClass avatarClass)
Parameters:
avatarClass - the avatarClass to set

setBaseColor

public void setBaseColor(Colour newBaseColor)
Parameters:
newBaseColor - the baseColor to set

setBasic8Choice

public void setBasic8Choice(int basic8Choice)
Parameters:
basic8Choice - the basic8Choice to set

setBirthDate

public void setBirthDate(Date birthDate)
Parameters:
birthDate - the birthDate to set

setCanceled

public void setCanceled(boolean isCanceled)
Parameters:
isCanceled - the isCanceled to set

setCanContact

public void setCanContact(boolean canContact)
Overrides:
setCanContact in class Person
Parameters:
canContact - the canContact to set

setCanEnterChatZone

public void setCanEnterChatZone(boolean canEnterChatZone)
Parameters:
canEnterChatZone - the canEnterChatZone to set

setCanEnterMenuZone

public void setCanEnterMenuZone(boolean canEnterMenuZone)
Parameters:
canEnterMenuZone - the canEnterMenuZone to set

setCanTalk

public void setCanTalk(boolean canTalk)
Parameters:
canTalk - the canTalk to set

setEmailPlusDate

public void setEmailPlusDate(Date emailPlusDate)
Parameters:
emailPlusDate - the emailPlusDate to set

setExtraColor

public void setExtraColor(Colour extraColor)
Parameters:
extraColor - the extraColor to set

setGivenName

public void setGivenName(String givenName)
Overrides:
setGivenName in class Person
Parameters:
givenName - the givenName to set

setHouseTypeID

public void setHouseTypeID(int houseTypeID)

setLot

public void setLot(int newLotID)
Parameters:
newLotID -

setLotID

public void setLotID(int lotID)

setMail

public void setMail(String mail)
             throws GameLogicException
Overrides:
setMail in class Person
Parameters:
mail - the mail to set
Throws:
GameLogicException

setMailConfirmed

public void setMailConfirmed(Timestamp mailConfirmed)
Overrides:
setMailConfirmed in class Person
Parameters:
mailConfirmed - the mailConfirmed to set

setNeedsNaming

public void setNeedsNaming(boolean needsNaming)
Parameters:
needsNaming - the needsNaming to set

setParent

public void setParent(Parent parent)
               throws GameLogicException
Set this to be a child account with the specified parent.

Parameters:
parent - the parent to set
Throws:
GameLogicException - if this user is an adult

setPassport

public void setPassport(String moniker)

setPeanuts

private void setPeanuts(BigDecimal add)
WRITEME: document this method (brpocock, Sep 2, 2009)

Parameters:
add -

setStaffLevel

public void setStaffLevel(int staffLevel)
Parameters:
staffLevel - the staffLevel to set

setTootTimerDay

public void setTootTimerDay(boolean tootTimerDay)
Parameters:
tootTimerDay - the tootTimerDay to set

setTootTimeRefill

public void setTootTimeRefill(int tootTimeRefill)
Parameters:
tootTimeRefill - the tootTimeRefill to set

setTootTimerMonth

public void setTootTimerMonth(boolean tootTimerMonth)
Parameters:
tootTimerMonth - the tootTimerMonth to set

setUserID

public void setUserID(int userID)
Parameters:
userID - the userID to set

setUserName

public void setUserName(String userName)
                 throws AlreadyUsedException,
                        ForbiddenUserException
Parameters:
userName - the userName to set
Throws:
ForbiddenUserException - if the user name is not allowed
AlreadyUsedException - if the user name is in-use

setUserNameFromUser

public void setUserNameFromUser(String userName)
                         throws AlreadyUsedException,
                                ForbiddenUserException

Set a user name, requested by the user. (Sends to lifeguards for approval)

Clears needsNaming.

Parameters:
userName - the userName to set
Throws:
ForbiddenUserException - if the user name isn't allowed
AlreadyUsedException - if the user name has already been used (or requested)

stampPassport

public void stampPassport(String moniker)
TODO: document this method (brpocock, Sep 8, 2009)

Parameters:
moniker -

startEvent

public org.json.JSONObject startEvent(String moniker)
                               throws SQLException

Start an event, and return the results as a partial JSON Object.

If the event has already been completed, then there will be an element "alreadyDone" set to "true". This currently only applies to wishing fountains, which can only be visited once per day.

If the event is started successfully, this will return the event ID in "eventID".

Java-native callers who aren't trying to talk JSON with strangers can use startEventRaw(String), which this routine is syntactic sugar around.

Parameters:
moniker - The event moniker to be created
Returns:
a JSON object, containing one of "eventID" (int) or "alreadyDone" (Boolean true)
Throws:
SQLException - generally meaning that the moniker was probably invalid

startEventRaw

public int startEventRaw(String moniker)
                  throws AlreadyExistsException
Register a new event. Closes out (cancels) any existing events for this user (with zero score) as a side-effect.

Parameters:
moniker - The event moniker to register
item - The item being purchased, or null.
Returns:
The integer event ID of the new event.
Throws:
AlreadyExistsException - if this is a fountain that has already been visited today, and can't be revisited until midnight.

toJSON

public org.json.JSONObject toJSON()
Sends a limited subset of data for the client to know.

Overrides:
toJSON in class SQLPeerDatum
Returns:
A subset of the user record as an ActionScript object

toString

public String toString()
Overrides:
toString in class Object
See Also:
Object.toString()

wear

public void wear(ClothingItem item)
Parameters:
item - The clothing item to be worn

wear

public void wear(ClothingItem item,
                 int color)
Parameters:
item -
color -