Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.RuntimeCollective.sitemap.bean
Class ImageCategory  view ImageCategory download ImageCategory.java

java.lang.Object
  extended bycom.RuntimeCollective.sitemap.bean.ImageCategory
All Implemented Interfaces:
com.RuntimeCollective.webapps.bean.EntityBean, java.io.Serializable

public class ImageCategory
extends java.lang.Object
implements com.RuntimeCollective.webapps.bean.EntityBean

The ImageCategory class is used to group Images, for use in an image library.

Version:
$Id: ImageCategory.java,v 1.7 2003/09/30 15:12:59 joe Exp $

Field Summary
static java.lang.String DATABASE_TABLE
          The name of the database table for this bean type.
protected  int id
          This ImageCategory's id
protected  java.util.HashSet Images
          Internal representation of Images in this ImageCategory
static int RESULTS_PER_PAGE
          How many results per page to display
protected  java.lang.String Title
          The title of the ImageCategory
 
Fields inherited from interface com.RuntimeCollective.webapps.bean.EntityBean
INTERFACE_BEAN, NULL_ID
 
Constructor Summary
ImageCategory()
          Construct a new blank ImageCategory, giving it a new unique ID.
ImageCategory(int id)
          Get a ImageCategory from the database, given an id.
 
Method Summary
 boolean addImage(com.RuntimeCollective.content.bean.Image image)
          Add an Image to this ImageCategory.
 void delete()
          Delete this ImageCategory from the database.
 int getId()
          Get the unique id of this ImageCategory.
 java.util.Collection getImages()
          Return all Images that belong to this ImageCategory, unsorted
 java.util.List getImages(java.util.Comparator comp)
          Return all Images that belong to this ImageCategory, sorted by the given Comparator
 java.util.List getImagesByDate()
          Return all Images that belong to this ImageCategory, sorted by last modified date (newest first)
 java.util.List getImagesByPage(int pageNumber)
          Return RESULTS_PER_PAGE number of results.
 java.util.List getImageSubset(int startPos, int number)
          Get number of images, sorted by date, starting from startPos (inclusive).
 int getLastPageNumber()
          Return the maximum page number
 int getNumberOfImages()
          Return the number of Images belonging to this ImageCategory
 java.lang.String getTitle()
          Get the title
private  boolean reallyAddImage(com.RuntimeCollective.content.bean.Image image)
          Update the internal representation of which Images are part of this category
private  boolean reallyRemoveImage(com.RuntimeCollective.content.bean.Image image)
          Update the internal representation of which Images are part of this category
 boolean removeImage(com.RuntimeCollective.content.bean.Image image)
          Remove an Image from this ImageCategory, if it's in this ImageCategory.
 void save()
          Save this ImageCategory to the database.
 void setId(int id)
          Set the unique id of this ImageCategory.
 void setTitle(java.lang.String title)
          Set the title
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DATABASE_TABLE

public static final java.lang.String DATABASE_TABLE
The name of the database table for this bean type.

See Also:
Constant Field Values

id

protected int id
This ImageCategory's id


RESULTS_PER_PAGE

public static final int RESULTS_PER_PAGE
How many results per page to display

See Also:
Constant Field Values

Title

protected java.lang.String Title
The title of the ImageCategory


Images

protected java.util.HashSet Images
Internal representation of Images in this ImageCategory

Constructor Detail

ImageCategory

public ImageCategory()
              throws java.sql.SQLException
Construct a new blank ImageCategory, giving it a new unique ID.


ImageCategory

public ImageCategory(int id)
              throws java.sql.SQLException
Get a ImageCategory from the database, given an id.

Method Detail

setId

public void setId(int id)
Set the unique id of this ImageCategory.

Specified by:
setId in interface com.RuntimeCollective.webapps.bean.EntityBean

getId

public int getId()
Get the unique id of this ImageCategory.

Specified by:
getId in interface com.RuntimeCollective.webapps.bean.EntityBean

save

public void save()
          throws java.sql.SQLException
Save this ImageCategory to the database.

Specified by:
save in interface com.RuntimeCollective.webapps.bean.EntityBean

delete

public void delete()
            throws java.sql.SQLException
Delete this ImageCategory from the database. This will delete the ImageCategory's attributes. The Images contained in this category will NOT be deleted.

Specified by:
delete in interface com.RuntimeCollective.webapps.bean.EntityBean

setTitle

public void setTitle(java.lang.String title)
Set the title


getTitle

public java.lang.String getTitle()
Get the title


getImages

public java.util.Collection getImages()
Return all Images that belong to this ImageCategory, unsorted


getImages

public java.util.List getImages(java.util.Comparator comp)
Return all Images that belong to this ImageCategory, sorted by the given Comparator


getImagesByDate

public java.util.List getImagesByDate()
Return all Images that belong to this ImageCategory, sorted by last modified date (newest first)


getNumberOfImages

public int getNumberOfImages()
Return the number of Images belonging to this ImageCategory


getImageSubset

public java.util.List getImageSubset(int startPos,
                                     int number)
Get number of images, sorted by date, starting from startPos (inclusive).


getImagesByPage

public java.util.List getImagesByPage(int pageNumber)
Return RESULTS_PER_PAGE number of results.


getLastPageNumber

public int getLastPageNumber()
Return the maximum page number


addImage

public boolean addImage(com.RuntimeCollective.content.bean.Image image)
Add an Image to this ImageCategory.

This method will inform the Image of its new ImageCategory (by calling setImageCategory on it), then save the image.

(It also makes sure the image knows it uses the image library)


removeImage

public boolean removeImage(com.RuntimeCollective.content.bean.Image image)
Remove an Image from this ImageCategory, if it's in this ImageCategory.

This method will inform the image that it no longer belongs to this ImageCategory, then save it.

Note: The image is not told that it does not use the image library any more.


reallyAddImage

private boolean reallyAddImage(com.RuntimeCollective.content.bean.Image image)
Update the internal representation of which Images are part of this category


reallyRemoveImage

private boolean reallyRemoveImage(com.RuntimeCollective.content.bean.Image image)
Update the internal representation of which Images are part of this category