Jive API (3.0.13) Core Javadocs

com.jivesoftware.community
Interface ImageContentResource

All Known Subinterfaces:
BlogPost, Comment, Document, ForumMessage

public interface ImageContentResource

A base interface defining images methods.


Method Summary
 void addImage(Image image)
          Adds an already existing (temporary) image to the object.
 Image createImage(String name, String contentType, InputStream data)
          Creates a new image for the object.
 void deleteImage(Image image)
          Deletes an image that belongs to the object.
 Image getImage(long imageID)
          Returns the image corresponding to the imageID.
 int getImageCount()
          Returns the number of images the object has.
 JiveIterator<Image> getImages()
          Returns an Iterable for the object's images.
 

Method Detail

getImageCount

int getImageCount()
Returns the number of images the object has.

Returns:
the number of images the object has.

getImages

JiveIterator<Image> getImages()
Returns an Iterable for the object's images.

Returns:
an Iterable of Image objects for the object.
See Also:
Image

getImage

Image getImage(long imageID)
               throws IllegalArgumentException,
                      ImageException
Returns the image corresponding to the imageID.

Parameters:
imageID - the id of the image to retrieve.
Returns:
the image.
Throws:
IllegalArgumentException - if the image doesn't belong to the object.
ImageException - if the image doesn't exist.

createImage

Image createImage(String name,
                  String contentType,
                  InputStream data)
                  throws IllegalStateException,
                         ImageException,
                         UnauthorizedException
Creates a new image for the object. Each image has a name, content type and binary data. Rules about who can create image and what kind image are allowed are controlled via an ImageManager.

Parameters:
name - the name of the new image, usually the file name.
contentType - the content type of the image.
data - an InputStream that contains the binary data of the image. The stream will never be closed so you must close it manually after calling this method.
Returns:
an Image object representing the new image created.
Throws:
ImageException - if an error occurred while creating the image.
UnauthorizedException - if not allowed to create images.
IllegalStateException - if the object hasn't yet been saved.
See Also:
Image, ImageManager

addImage

void addImage(Image image)
              throws IllegalStateException,
                     ImageException,
                     UnauthorizedException
Adds an already existing (temporary) image to the object. If the image is already associated with another object this method will throw an IllegalStateException. This method's primary use is to associate images saved as part of a draft with a new container object when recovering a draft.

Parameters:
image - the image to add
Throws:
ImageException - if an error occurred while adding the image.
IllegalStateException - if the object hasn't yet been saved.
UnauthorizedException - if not allowed to add images

deleteImage

void deleteImage(Image image)
                 throws ImageException,
                        UnauthorizedException
Deletes an image that belongs to the object. Only administrators or the creator of the object are allowed to call this method.

Parameters:
image - the image to delete.
Throws:
IllegalArgumentException - if the image doesn't belong to the object.
UnauthorizedException - if not authorized to delete the image.
ImageException - if there was an error deleting the image.

Jive Product Page

Copyright © 1999-2007 Jive Software.