org.jickr
Class User

java.lang.Object
  extended by org.jickr.User

public class User
extends java.lang.Object

Information on a User of Flickr.


Constructor Summary
User(java.lang.String id)
          Creates a new instance of User with the given ID.
 
Method Summary
 boolean equals(java.lang.Object o)
          Check for equality of two User objects.
static User findByEmail(java.lang.String emailAddr)
          Return a new User object that corresponds to the stated Email Address.
static User findByID(java.lang.String id)
          Return a new User object that corresponds to the stated user ID.
static User findByURL(java.lang.String userURL)
          Return a new User object that corresponds to the stated URL.
static User findByUsername(java.lang.String username)
          Return a new User object that corresponds to the stated username.
static java.util.List<User> getContacts()
          Get a list of users that are contacts for the authenticated user.
 java.util.List<Photo> getFavoritePhotos()
          Get a list of all favorite photos for this user.
 java.lang.String getID()
          Gets the value of User's ID, the flickr unique identifier used in most of their URLs.
 java.lang.String getLocation()
          Get the location listed for this user in Flickr.
 int getPhotoCount()
          Gets the number of photos the user owns.
 java.util.List<PhotoSet> getPhotoSets()
          Get a list of the PhotoSets for this user.
 java.net.URL getPhotosURL()
          Gets the URL for photos for this user.
 java.util.Map<java.lang.String,java.lang.Integer> getPopularTags(int count)
          Get a list of the popular tags associated with this User's Photos, and how many times they are used.
 java.net.URL getProfileURL()
          Gets the URL of the user profile.
 java.util.List<Photo> getPublicContactPhotos()
          Get a list of all public photos for this user's contacts.
 java.util.List<Photo> getPublicContactPhotos(boolean justFriends, int count)
          Get a list of all public photos for this user's contacts.
 java.util.List<User> getPublicContacts()
          Get a list of users who are listed as contacts for this User.
 java.util.List<Photo> getPublicFavoritePhotos()
          Get a list of all public favorite photos for this user.
 java.util.List<Photo> getPublicPhotos()
          Get a list of all public photos for this user.
 java.lang.String getRealName()
          Get the real name.
 java.util.List<java.lang.String> getTags()
          Get a list of all the tags associated with this User's Photos.
 java.lang.String getUserName()
          Get the User Name
 int hashCode()
          Create a hashcode for the User object, based on ID.
 boolean isPro()
          Gets whether the User is registered with a Pro account.
 java.lang.String toString()
          Return a String rendition of this object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

User

public User(java.lang.String id)
Creates a new instance of User with the given ID. Note: Will not query Flickr before creating object. This is done for performance reasons, but it does lead to odd behavior - like getting a message that the ID is invalid the next time you use it. To create an object with validation, use User.findByID(String)

See Also:
findByID(String)
Method Detail

findByUsername

public static User findByUsername(java.lang.String username)
                           throws FlickrException
Return a new User object that corresponds to the stated username.

Parameters:
username - Username of the User. Must not be null.
Throws:
FlickrException - for almost anything, including not found errors

findByEmail

public static User findByEmail(java.lang.String emailAddr)
                        throws FlickrException
Return a new User object that corresponds to the stated Email Address.

Parameters:
emailAddr - Email address &qt;user@domain.com&qt;
Returns:
user A User object that corresponds to that email address. Must not be null.
Throws:
FlickrException - for almost anything, including not found errors

findByID

public static User findByID(java.lang.String id)
Return a new User object that corresponds to the stated user ID. A user ID is a Flickr specific unique identifier.

Note: this call creates a new User object without querying Flickr, so there is no guarentee that this object is valid. Validity will be checked once other calls are made to request data. This was done for performance reasons in other parts of the API.

Parameters:
id - Flickr specific identifier. Must not be null.
Returns:
User object that corresponds to that email address.

findByURL

public static User findByURL(java.lang.String userURL)
                      throws FlickrException
Return a new User object that corresponds to the stated URL.

Parameters:
userURL - Flickr URL for this user.
Returns:
User object that corresponds to the stated URL.
Throws:
FlickrException

getUserName

public java.lang.String getUserName()
                             throws FlickrException
Get the User Name

Returns:
username Flickr user name
Throws:
FlickrException

getRealName

public java.lang.String getRealName()
                             throws FlickrException
Get the real name.

Returns:
realname The user's real name, as listed in Flickr.
Throws:
FlickrException

getLocation

public java.lang.String getLocation()
                             throws FlickrException
Get the location listed for this user in Flickr.

Returns:
location Location of this user, as listed in Flickr.
Throws:
FlickrException

getPhotosURL

public java.net.URL getPhotosURL()
                          throws FlickrException
Gets the URL for photos for this user.

Returns:
URL of the user's photos
Throws:
FlickrException

getProfileURL

public java.net.URL getProfileURL()
                           throws FlickrException
Gets the URL of the user profile.

Returns:
URL of the user profile
Throws:
FlickrException

getPhotoCount

public int getPhotoCount()
                  throws FlickrException
Gets the number of photos the user owns.

Returns:
photocount - count of photos the user owns
Throws:
FlickrException

isPro

public boolean isPro()
              throws FlickrException
Gets whether the User is registered with a Pro account.

Returns:
If the user has a Pro account.
Throws:
FlickrException - on any error.

getID

public java.lang.String getID()
Gets the value of User's ID, the flickr unique identifier used in most of their URLs.

Returns:
id - Unique identifier used in FJickrURLs.

getPublicContacts

public java.util.List<User> getPublicContacts()
                                       throws FlickrException
Get a list of users who are listed as contacts for this User.

Returns:
userlist A list of FlickrUsers.
Throws:
FlickrException

getContacts

public static java.util.List<User> getContacts()
                                        throws FlickrException
Get a list of users that are contacts for the authenticated user. Requires READ privlege.

Returns:
userlist A list of users who are contacts for the authenticated user.
Throws:
FlickrException - on any error, including not being authenticated.

getPublicPhotos

public java.util.List<Photo> getPublicPhotos()
                                      throws FlickrException
Get a list of all public photos for this user.

Returns:
photolist A list of all public photos belonging to this user.
Throws:
FlickrException - in the event of any error.

getPublicFavoritePhotos

public java.util.List<Photo> getPublicFavoritePhotos()
                                              throws FlickrException
Get a list of all public favorite photos for this user.

Returns:
photolist A list of all public favorite photos for this user.
Throws:
FlickrException - in the event of any error.

getFavoritePhotos

public java.util.List<Photo> getFavoritePhotos()
                                        throws FlickrException
Get a list of all favorite photos for this user. This call requires READ Permissions.

Returns:
photolist A list of all favorite photos for this user.
Throws:
FlickrException - in the event of any error.

getPublicContactPhotos

public java.util.List<Photo> getPublicContactPhotos()
                                             throws FlickrException
Get a list of all public photos for this user's contacts.

Returns:
photolist A list of 10 publicly viewable photos for this user's contacts.
Throws:
FlickrException - in the event of any error.

getPublicContactPhotos

public java.util.List<Photo> getPublicContactPhotos(boolean justFriends,
                                                    int count)
                                             throws FlickrException
Get a list of all public photos for this user's contacts.

Parameters:
justFriends - Return only friends' photos, or all contacts' photos.
count - How many photos to return - default is 10, max is 50.
Returns:
photolist A list of all public photos for this user's contacts.
Throws:
FlickrException - in the event of any error.

getPhotoSets

public java.util.List<PhotoSet> getPhotoSets()
                                      throws FlickrException
Get a list of the PhotoSets for this user.

Returns:
photosetlist A list of all PhotoSets for this user
Throws:
FlickrException - in the event of any error

getTags

public java.util.List<java.lang.String> getTags()
                                         throws FlickrException
Get a list of all the tags associated with this User's Photos.

Returns:
A list of tags in String form.
Throws:
FlickrException - on any error.

getPopularTags

public java.util.Map<java.lang.String,java.lang.Integer> getPopularTags(int count)
                                                                 throws FlickrException
Get a list of the popular tags associated with this User's Photos, and how many times they are used.

Parameters:
count - The number of popular tags to return. Must be greater than 0.
Returns:
An unordered Map of tags in String form, with # of uses in Integer form.
Throws:
FlickrException - on any error.

toString

public java.lang.String toString()
Return a String rendition of this object. Use the User ID for this purpose.

Overrides:
toString in class java.lang.Object
Returns:
A String representation of this object.

equals

public boolean equals(java.lang.Object o)
Check for equality of two User objects. Uses User ID interally.

Overrides:
equals in class java.lang.Object
Parameters:
o - - Object to compare.
Returns:
Whether the object is equal to this object.

hashCode

public int hashCode()
Create a hashcode for the User object, based on ID.

Overrides:
hashCode in class java.lang.Object
Returns:
A hashcode for this object.