org.jickr
Class Group

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

public class Group
extends java.lang.Object

Encapsulates information about a Flickr Group. Create a new Group object with the Group.search(String) method, the Group.findByURL(URL) method, or the Group.getGroups() method.

See Also:
search(String), findByURL(URL), getGroups()

Constructor Summary
Group(java.lang.String groupID)
          Create a new Group object corresponding to the Flickr Group.
 
Method Summary
 void add(Photo photo)
          Add a photo to the Group's pool.
 boolean equals(java.lang.Object o)
          Check if this Group is equal to the object supplied.
static Group findByURL(java.net.URL groupURL)
          Get a new group by searching on the URL of that group.
 java.lang.String getDescription()
          Get the Description of this Group.
static java.util.List<Group> getGroups()
          Get the list of groups that the authenticated user can add photos to.
 java.lang.String getID()
          Get the ID of this group.
 java.lang.String getName()
          Get the Title of this Group.
 int getNumMembers()
          Get the number of Members who belong to this group.
 java.util.List<Photo> getPhotos()
          Get the photos available in this Group's pool.
 java.net.URL getURL()
          Get the URL associated with this group.
 int hashCode()
          Return the HashCode of this Group, based on ID.
 void remove(Photo photo)
          Remove a photo to the Group's pool.
static java.util.List<Group> search(java.lang.String searchText)
          Full text search for groups which contain searchText.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Group

public Group(java.lang.String groupID)
Create a new Group object corresponding to the Flickr Group. More usually, Group objects are created by a Group.search(String).

Parameters:
groupID - Unique Flickr ID of the Group.
See Also:
search(String)
Method Detail

findByURL

public static Group findByURL(java.net.URL groupURL)
                       throws FlickrException
Get a new group by searching on the URL of that group.

Parameters:
groupURL - URL for this group
Returns:
Group specified by the supplied URL.
Throws:
FlickrException - on any error.

search

public static java.util.List<Group> search(java.lang.String searchText)
                                    throws FlickrException
Full text search for groups which contain searchText. Note that this is an extremely expensive call, and may take many seconds (>5 seconds) to return.

Parameters:
searchText - The String to search for. Must not be null.
Returns:
A list of Groups.
Throws:
FlickrException - on any error.

getGroups

public static java.util.List<Group> getGroups()
                                       throws FlickrException
Get the list of groups that the authenticated user can add photos to. Requires READ level authentication.

Returns:
A list of Groups
Throws:
FlickrException - on any error.

getID

public java.lang.String getID()
Get the ID of this group. Note that this value is cached at the time of the Group object creation.

Returns:
ID String that uniquely identifies this group on Flickr.

getName

public java.lang.String getName()
                         throws FlickrException
Get the Title of this Group. Note that this value is cached, it's only checked once in the lifetime of the Group object. In practice, this should rarely be an issue.

Returns:
The name of the group.
Throws:
FlickrException - on any error.

getDescription

public java.lang.String getDescription()
                                throws FlickrException
Get the Description of this Group. Note that this value is cached, it's only checked once for the lifetime of the Group object. In practice, this should rarely be an issue.

Returns:
The description of the Group.
Throws:
FlickrException - on any error.

getNumMembers

public int getNumMembers()
                  throws FlickrException
Get the number of Members who belong to this group. Note that this response is cached - it's only checked once. Create a new Group object to repeatedly query the number of users.

Returns:
The count of the members in this group.
Throws:
FlickrException - on any error.

getPhotos

public java.util.List<Photo> getPhotos()
                                throws FlickrException
Get the photos available in this Group's pool.

Returns:
A list of Photos for this Group.
Throws:
FlickrException - on any error.

getURL

public java.net.URL getURL()
                    throws FlickrException
Get the URL associated with this group.

Returns:
The URL to reach this group.
Throws:
FlickrException - on any error.

add

public void add(Photo photo)
         throws FlickrException
Add a photo to the Group's pool. Requires WRITE authentication.

Parameters:
photo - Photo to add.
Throws:
FlickrException

remove

public void remove(Photo photo)
            throws FlickrException
Remove a photo to the Group's pool. Requires WRITE authentication.

Parameters:
photo - Photo to remove.
Throws:
FlickrException

equals

public boolean equals(java.lang.Object o)
Check if this Group is equal to the object supplied. Uses id for comparison.

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

hashCode

public int hashCode()
Return the HashCode of this Group, based on ID.

Overrides:
hashCode in class java.lang.Object
Returns:
int value representing a fairly unique hashcode.