com.thirtyboxes.api
Class User

java.lang.Object
  extended by com.thirtyboxes.api.User

public class User
extends java.lang.Object

Represents a 30 Boxes User.

The User object can contain varying amounts of data, depending on how it was created. User objects created as part of the Buddy list of the logged-in user will initially only have ID and name. If you want to learn more about a particular buddy, you can use the user.FindById API Method. Users returned by that or user.FindByEmail will have more information, and those returned by user.GetAllInfo will have all information. You can query what information a particular User object has with the hasBasicInfo(), hasPublicInfo() and hasPrivateInfo() functions.

Version:
1.0
Author:
keith@kludge.co.uk
See Also:
ThirtyBoxes.userFindByEmail(String), ThirtyBoxes.userFindById(int), ThirtyBoxes.userGetAllInfo(AuthorizedUserToken)

Constructor Summary
protected User(org.w3c.dom.Node userNode)
          XML Node constructor.
 
Method Summary
 java.net.URL getAvatar()
          Returns the URL of this User's avatar, if they have specified one.
 java.util.List<User> getBuddies()
          Returns a List of User objects representing the user's buddies.
 java.util.List<Email> getEmails()
          Returns a List of Email objects representing the user's buddies.
 java.util.List<Feed> getFeeds()
          Returns a List of Feed objects representing the user's RSS feeds.
 java.lang.String getFirstName()
          Returns this user's first name.
 int getID()
          Returns this user's unique ID.
 java.util.List<IM> getIMs()
          Returns a List of IM objects representing the user's Instant Messaging identities.
 java.lang.String getLastName()
          Returns this user's last name.
 java.net.URL getPersonalSite()
          Returns the URL of this User's personal website, if they have specified one.
 Email getPrimaryEmail()
          Returns the primary email for this user.
 int getStartDay()
          Returns the day of the week this User's calendar should start on.
 boolean hasBasicInfo()
          Returns whether this User object has (at least) basic info for this user.
 boolean hasPrivateInfo()
          Returns whether this User object has private info for this user.
 boolean hasPublicInfo()
          Returns whether this User object has (at least) public info for this user.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

User

protected User(org.w3c.dom.Node userNode)
XML Node constructor. Creates the object from a object in the REST XML.

Parameters:
userNode - XML node containing user data
Method Detail

getID

public int getID()
Returns this user's unique ID. This is basic information, and will always be returned.

Returns:
User's unique ID

getFirstName

public java.lang.String getFirstName()
Returns this user's first name. This is basic information, and will always be returned.

Returns:
User's first name.

getLastName

public java.lang.String getLastName()
Returns this user's last name. This is basic information, and will always be returned.

Returns:
User's last name.

getAvatar

public java.net.URL getAvatar()
Returns the URL of this User's avatar, if they have specified one. Avatar information will only be returned if hasPublicInfo() is true.

Returns:
URL of this user's avatar (or null).
See Also:
hasPublicInfo()

getStartDay

public int getStartDay()
Returns the day of the week this User's calendar should start on. Start Day information will only be returned if hasPublicInfo() is true. 0 is sunday, and so forth. If this is not specified, -1 will be returned.

Returns:
The user's start day (or -1).
See Also:
hasPublicInfo()

getPersonalSite

public java.net.URL getPersonalSite()
Returns the URL of this User's personal website, if they have specified one. Personal Site information will only be returned if hasPublicInfo() is true.

Returns:
URL of this user's website (or null).
See Also:
hasPublicInfo()

getFeeds

public java.util.List<Feed> getFeeds()
Returns a List of Feed objects representing the user's RSS feeds. This function will not return a null - if there are no feeds, if will return an empty List, so it is safe to use in for ( X x : xs ) -style loops without checking for null. Feed information will only be returned if hasPublicInfo() is true.

Returns:
A List of this users's RSS feeds (or an empty list).
See Also:
hasPublicInfo()

getEmails

public java.util.List<Email> getEmails()
Returns a List of Email objects representing the user's buddies. This function will not return a null - if there are no email addresses, if will return an empty List, so it is safe to use in for ( X x : xs ) -style loops without checking for null. Email information will only be returned if hasPrivateInfo() is true.

Returns:
A List of this users's email addresses (or an empty list).
See Also:
hasPrivateInfo()

getIMs

public java.util.List<IM> getIMs()
Returns a List of IM objects representing the user's Instant Messaging identities. This function will not return a null - if there are no identities, if will return an empty List, so it is safe to use in for ( X x : xs ) -style loops without checking for null. IM information will only be returned if hasPrivateInfo() is true.

Returns:
A List of this users's IM identities (or an empty list).
See Also:
hasPrivateInfo()

getBuddies

public java.util.List<User> getBuddies()
Returns a List of User objects representing the user's buddies. This function will not return a null - if there are no buddies, if will return an empty List, so it is safe to use in for ( X x : xs ) -style loops without checking for null. Buddy information will only be returned if hasPrivateInfo() is true.

Returns:
A List of this users's buddies (or an empty list).
See Also:
hasPrivateInfo()

getPrimaryEmail

public Email getPrimaryEmail()
Returns the primary email for this user. Email information will only be returned if hasPrivateInfo() is true.

Returns:
An email object (or null if there is no primary email)
See Also:
hasPrivateInfo()

hasBasicInfo

public boolean hasBasicInfo()
Returns whether this User object has (at least) basic info for this user.

Basic info is firstName, lastName, and id - this is the least information that can be returned from 30 Boxes (for instance, a person's buddy list has this information).

Returns:
True if this object has basic info (at least).

hasPublicInfo

public boolean hasPublicInfo()
Returns whether this User object has (at least) public info for this user.

Public info is Basic info plus avatar, createDate, startDay, use24HourClock, personalSite, and feed(s) - this is the information that will be returned by calling the user.FindByEmail or user.FindById API methods.

Returns:
True if this object has public info (at least).
See Also:
ThirtyBoxes.userFindByEmail(String), ThirtyBoxes.userFindById(int)

hasPrivateInfo

public boolean hasPrivateInfo()
Returns whether this User object has private info for this user.

Private info is Public info plus email addresses, IM identities, and buddy list - this is the information that will be returned by calling the user.GetAllInfo API method.

Returns:
True if this object has private info.
See Also:
ThirtyBoxes.userGetAllInfo(AuthorizedUserToken)