Class Image
java.lang.Object
org.deltava.beans.DatabaseBean
org.deltava.beans.DatabaseBlobBean
org.deltava.beans.ImageBean
org.deltava.beans.gallery.Image
- All Implemented Interfaces:
Serializable, Comparable<Object>, AuthoredBean, ComboAlias, IDBean, Cacheable
A class to store Image Gallery images.
- Since:
- 1.0
- Version:
- 11.0
- Author:
- Luke
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class ImageBean
ImageBean.ImageFormat -
Field Summary
Fields inherited from class DatabaseBlobBean
_buffer -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddLike(int userID) Adds a like for this image.intReturns the Author of this bean.Returns the alias to use in the HTML <OPTION> element.Returns the visible name to use in the HTML <OPTION> element.Returns the date this Image was created.Returns a description of the image.booleangetFleet()Returns if this image is part of the Fleet Gallery.Returns the database image type.intReturns the number of Votes cast for this Image.getLikes()Returns all votes for this image.getName()Returns the name of the image.intReturns the database ID of the Water Cooler discussion thread associated with this Gallery Image.booleanChecks if a particular person has cast a vote for this imagevoidsetAuthorID(int id) Updates the Author of this Image.voidsetCreatedOn(Instant dt) Updates the date this Image was created.voidsetDescription(String desc) Updates the Image's description.voidsetFleet(boolean fleet) Updates if this image is part of the Fleet Gallery.voidsetLikeCount(int count) Updates the number of Likes for this Image.voidUpdates the name of this Image.voidsetThreadID(int id) Updates the Water Cooler discussion thread associated with this Image.Methods inherited from class ImageBean
checkParam, getFormat, getHasImage, getHeight, getSize, getWidth, load, load, setFormat, setHeight, setSize, setWidthModifier and TypeMethodDescriptionprotected static voidcheckParam(int param, String msg) Helper method to check for negative numeric parameters.Returns the type of image.booleanQueries if the bean has an associated Image.intReturns the height of the image.intgetSize()Returns the size of the image.intgetWidth()Returns the width of the image.final voidload(byte[] buffer) Updates the image buffer.final voidload(InputStream is) Loads an image into the buffer.voidUpdates the image format.voidsetHeight(int y) Updates the height of this image.voidsetSize(int newSize) Updates the size of this image.voidsetWidth(int x) Updates the width of this image.Methods inherited from class DatabaseBlobBean
clear, getInputStream, isLoadedMethods inherited from class DatabaseBean
cacheKey, compareTo, equals, getHexID, getID, hashCode, setID, validateID, validateIDModifier and TypeMethodDescriptioncacheKey()Returns the cache key for this object.intbooleangetHexID()Returns the hexadecimal database ID of this object.intgetID()Returns the database ID of this object.inthashCode()voidsetID(int id) Update the database row ID of this bean.static voidvalidateID(int oldID, int newID) Validates a database ID.static voidvalidateID(int oldID, int newID, boolean allowZero) Validates a database ID.
-
Constructor Details
-
Image
Create a new Image with a particular name.- Parameters:
name- the name of the Imagedesc- a description of the Image- Throws:
NullPointerException- if name or desc are null
-
-
Method Details
-
getName
-
getAuthorID
public int getAuthorID()Description copied from interface:AuthoredBeanReturns the Author of this bean.- Specified by:
getAuthorIDin interfaceAuthoredBean- Returns:
- the author's database ID
- See Also:
-
getImageType
Description copied from class:ImageBeanReturns the database image type.- Specified by:
getImageTypein classImageBean- Returns:
- an ImageType
-
getThreadID
public int getThreadID()Returns the database ID of the Water Cooler discussion thread associated with this Gallery Image.- Returns:
- the Database ID of the Thread linked to this Image
- See Also:
-
getDescription
Returns a description of the image.- Returns:
- the image's description
- See Also:
-
getComboName
Description copied from interface:ComboAliasReturns the visible name to use in the HTML <OPTION> element.- Specified by:
getComboNamein interfaceComboAlias- Returns:
- The visible name for this entry
-
getComboAlias
Description copied from interface:ComboAliasReturns the alias to use in the HTML <OPTION> element.- Specified by:
getComboAliasin interfaceComboAlias- Returns:
- The alias for this entry
-
getCreatedOn
Returns the date this Image was created.- Returns:
- the date/time this Image was created on
- See Also:
-
getFleet
public boolean getFleet()Returns if this image is part of the Fleet Gallery.- Returns:
- TRUE if the image is in the Fleet Gallery, otherwise FALSE
- See Also:
-
setCreatedOn
Updates the date this Image was created.- Parameters:
dt- the date/time this Image was created on- See Also:
-
setAuthorID
public void setAuthorID(int id) Updates the Author of this Image.- Specified by:
setAuthorIDin interfaceAuthoredBean- Parameters:
id- the Database ID of the author of this Image- Throws:
IllegalArgumentException- if id is zero or negative- See Also:
-
setThreadID
public void setThreadID(int id) Updates the Water Cooler discussion thread associated with this Image.- Parameters:
id- the Database ID of the discussion thread- Throws:
IllegalArgumentException- if id is negative- See Also:
-
setName
Updates the name of this Image.- Parameters:
name- the new Image name- Throws:
NullPointerException- if name is null- See Also:
-
setDescription
Updates the Image's description.- Parameters:
desc- the new Image description- Throws:
NullPointerException- if desc is null- See Also:
-
setFleet
public void setFleet(boolean fleet) Updates if this image is part of the Fleet Gallery.- Parameters:
fleet- TRUE if the image is part of the Fleet Gallery, otherwise FALSE- See Also:
-
addLike
public void addLike(int userID) Adds a like for this image.- Parameters:
userID- the database ID of the liking user
-
setLikeCount
public void setLikeCount(int count) Updates the number of Likes for this Image.- Parameters:
count- the number of Likes- Throws:
IllegalStateException- if the Votes have already been loaded- See Also:
-
hasLiked
Checks if a particular person has cast a vote for this image- Parameters:
p- the Person to check for- Returns:
- TRUE if the person has voted, otherwise FALSE
- See Also:
-
getLikes
Returns all votes for this image.- Returns:
- a Collection of votes for this image
- See Also:
-
getLikeCount
public int getLikeCount()Returns the number of Votes cast for this Image.- Returns:
- the number of Votes
- See Also:
-