org.jickr
Class PhotoSet

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

public class PhotoSet
extends java.lang.Object

A Flickr PhotoSet. Created by calls that get a List<PhotoSet>, such as User.getPhotoSets() and PhotoSet.findByID(id)

See Also:
User.getPhotoSets(), findByID(String)

Method Summary
 void add(Photo photo)
          Adds a photo to a PhotoSet.
 java.lang.String addComment(java.lang.String commentText)
          Adds a comment to this Photo, returns the new comment ID.
static PhotoSet create(java.lang.String title, java.lang.String description, Photo primaryPhoto)
          Create a new PhotoSet.
 void delete()
          Delete the current PhotoSet.
 boolean equals(java.lang.Object o)
          Check equality.
static PhotoSet findByID(java.lang.String id)
          Get a new PhotoSet identified by the supplied ID.
 java.util.List<Comment> getComments()
          Get a list of comments for this PhotoSet.
 java.lang.String getDescription()
          Get the Description of the PhotoSet.
 java.lang.String getID()
          Get the ID of the PhotoSet.
 int getNumPhotos()
          Get the number of Photos in the PhotoSet.
 org.jickr.PhotoList getPhotos()
          Retrieve the list of photos associated with this PhotoSet.
 Photo getPrimaryPhoto()
          Get the primary Photo associated with this PhotoSet.
 java.lang.String getTitle()
          Get the Title of the PhotoSet.
 int hashCode()
          Return the HashCode of this PhotoSet, based on ID.
static void orderSets(java.util.List<PhotoSet> setlist)
          Order the PhotoSets for display on Flickr.
 void remove(Photo photo)
          Removes a photo to a PhotoSet.
 void setPhotos(Photo primaryPhoto, java.util.List<Photo> photolist)
          Sets up all the photos in a PhotoSet.
 java.lang.String toString()
          Convert this PhotoSet to a String.
 void updateTitleDesc(java.lang.String titleText, java.lang.String descText)
          Update the Title and Description of the PhotoSet.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

findByID

public static PhotoSet findByID(java.lang.String id)
                         throws FlickrException
Get a new PhotoSet identified by the supplied ID.

Parameters:
id - - The unique ID of the PhotoSet in Flickr.
Returns:
A PhotoSet that is identified by the supplied ID.
Throws:
FlickrException

create

public static PhotoSet create(java.lang.String title,
                              java.lang.String description,
                              Photo primaryPhoto)
                       throws FlickrException
Create a new PhotoSet. Returns PhotoSet created. Requires WRITE authentication.

NOTE: Flickr may take a few moments to register the new PhotoSet, and it may not immediately be found, though it will eventually be there.

Parameters:
title - Title of the PhotoSet. May not be null.
description - Description of the PhotoSet. If left null, this will be left blank.
primaryPhoto - The primary photo associated with this PhotoSet. May not be null.
Returns:
The newly created PhotoSet.
Throws:
FlickrException - on any error.

orderSets

public static void orderSets(java.util.List<PhotoSet> setlist)
                      throws FlickrException
Order the PhotoSets for display on Flickr. A list of PhotoSets are passed to this method, and the authenticated user's PhotoSets are ordered via that list. PhotoSets that are not on the list are put at the end of the list in ID order. Request WRITE level authentication and permissions.

Parameters:
setlist - List of PhotoSets, in the order that you wish them to appear on Flickr. Must not be null.
Throws:
FlickrException - on any error.

setPhotos

public void setPhotos(Photo primaryPhoto,
                      java.util.List<Photo> photolist)
               throws FlickrException
Sets up all the photos in a PhotoSet. Requires WRITE level authentication and permissions.

Parameters:
primaryPhoto - The main photo to associate with this PhotoSet.
photolist - The list of Photos that the PhotoSet should contain.
Throws:
FlickrException - on any error.

delete

public void delete()
            throws FlickrException
Delete the current PhotoSet. Requires WRITE authentication.

NOTE: Flickr may take a few moments to register the deletion, and it may still be found momentarily in a search, though it will eventually be gone.

No other calls may be made on this object after deletion.

Throws:
FlickrException

getTitle

public java.lang.String getTitle()
                          throws FlickrException
Get the Title of the PhotoSet.

Returns:
Title of the PhotoSet.
Throws:
FlickrException

getDescription

public java.lang.String getDescription()
                                throws FlickrException
Get the Description of the PhotoSet.

Returns:
The description of the PhotoSet.
Throws:
FlickrException

getNumPhotos

public int getNumPhotos()
                 throws FlickrException
Get the number of Photos in the PhotoSet. Note: this value is cached, and is not updated once checked. Use PhotoSet.getPhotos().size() to get an up to date value, though note that this is an expensive call.

Returns:
The number of photos in the PhotoSet.
Throws:
FlickrException

getID

public java.lang.String getID()
Get the ID of the PhotoSet. This value is unique.

Returns:
The ID of this PhotoSet on Flickr.

getPrimaryPhoto

public Photo getPrimaryPhoto()
                      throws FlickrException
Get the primary Photo associated with this PhotoSet.

Returns:
Primary Photo associated with this PhotoSet.
Throws:
FlickrException

getPhotos

public org.jickr.PhotoList getPhotos()
                              throws FlickrException
Retrieve the list of photos associated with this PhotoSet. This value is not cached, and may be expensive to execute, depending on how many Photos are in the PhotoSet.

Returns:
photoset A list of photos for this Photoset.
Throws:
FlickrException - for almost any error.

getComments

public java.util.List<Comment> getComments()
                                    throws FlickrException
Get a list of comments for this PhotoSet.

Returns:
A list of comments for this PhotoSet.
Throws:
FlickrException - in the event of any error.

addComment

public java.lang.String addComment(java.lang.String commentText)
                            throws FlickrException

Adds a comment to this Photo, returns the new comment ID. Since Flickr doesn't offer a way to search for a comment via ID, the user will have to do a getComments() and search for the comment with Comment.getID() if they want a Comment object representing this added comment.

This call requires that the user be authenticated at the WRITE level.

Returns:
The comment's ID string
Throws:
FlickrException - in the event of a failure. Note that if an exception is thrown, it's possible (thought unlikely) that a comment was added anyway.
See Also:
Photo.getComments(), Comment.getID()

updateTitleDesc

public void updateTitleDesc(java.lang.String titleText,
                            java.lang.String descText)
                     throws FlickrException
Update the Title and Description of the PhotoSet. Requires WRITE authentication.

Parameters:
titleText - New title of the PhotoSet. May not be null.
descText - New description of the PhotoSet. If null, description is not updated.
Throws:
FlickrException - on any error.

add

public void add(Photo photo)
         throws FlickrException
Adds a photo to a PhotoSet. Requires WRITE authentication.

Parameters:
photo - Photo to add to the PhotoSet.
Throws:
FlickrException

remove

public void remove(Photo photo)
            throws FlickrException
Removes a photo to a PhotoSet. Requires WRITE authentication.

Parameters:
photo - Photo to remove from the PhotoSet.
Throws:
FlickrException

toString

public java.lang.String toString()
Convert this PhotoSet to a String.

Overrides:
toString in class java.lang.Object
Returns:
The photoset title.

equals

public boolean equals(java.lang.Object o)
Check equality. Uniqueness based on ID.

Overrides:
equals in class java.lang.Object
Parameters:
o - - Object to compare.
Returns:
true if these objects have the same ID string.

hashCode

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

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