Class Image

All Implemented Interfaces:
Serializable, Comparable<Object>, AuthoredBean, ComboAlias, IDBean, Cacheable

public class Image extends ImageBean implements AuthoredBean, ComboAlias
A class to store Image Gallery images.
Since:
1.0
Version:
11.0
Author:
Luke
See Also:
  • Constructor Details

    • Image

      public Image(String name, String desc)
      Create a new Image with a particular name.
      Parameters:
      name - the name of the Image
      desc - a description of the Image
      Throws:
      NullPointerException - if name or desc are null
  • Method Details

    • getName

      public String getName()
      Returns the name of the image.
      Returns:
      the name of the image
      See Also:
    • getAuthorID

      public int getAuthorID()
      Description copied from interface: AuthoredBean
      Returns the Author of this bean.
      Specified by:
      getAuthorID in interface AuthoredBean
      Returns:
      the author's database ID
      See Also:
    • getImageType

      public ImageType getImageType()
      Description copied from class: ImageBean
      Returns the database image type.
      Specified by:
      getImageType in class ImageBean
      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

      public String getDescription()
      Returns a description of the image.
      Returns:
      the image's description
      See Also:
    • getComboName

      public String getComboName()
      Description copied from interface: ComboAlias
      Returns the visible name to use in the HTML <OPTION> element.
      Specified by:
      getComboName in interface ComboAlias
      Returns:
      The visible name for this entry
    • getComboAlias

      public String getComboAlias()
      Description copied from interface: ComboAlias
      Returns the alias to use in the HTML <OPTION> element.
      Specified by:
      getComboAlias in interface ComboAlias
      Returns:
      The alias for this entry
    • getCreatedOn

      public Instant 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

      public void setCreatedOn(Instant dt)
      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:
      setAuthorID in interface AuthoredBean
      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

      public void setName(String name)
      Updates the name of this Image.
      Parameters:
      name - the new Image name
      Throws:
      NullPointerException - if name is null
      See Also:
    • setDescription

      public void setDescription(String desc)
      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

      public boolean hasLiked(Person p)
      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

      public Collection<Integer> 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: