Interface ThumbnailManager

All Known Implementing Classes:
DefaultThumbnailManager, DisabledThumbNailManager

@PublicApi public interface ThumbnailManager
Provides key services for small-sized images representing image attachments on issues.
  • Field Details

    • MIME_TYPE

      static final com.atlassian.core.util.thumbnail.Thumbnail.MimeType MIME_TYPE
      The JIRA global thumbnail MIME type.
  • Method Details

    • getThumbnails

      Collection<com.atlassian.core.util.thumbnail.Thumbnail> getThumbnails(Issue issue, ApplicationUser user) throws Exception
      Retrieves Thumbnails for an Issue
      Parameters:
      issue - the issue to get the thumnails for.
      user - the user on whose behalf the request is made.
      Returns:
      the thumbnails.
      Throws:
      Exception
      See Also:
    • isThumbnailable

      boolean isThumbnailable(Attachment attachment) throws org.ofbiz.core.entity.GenericEntityException
      Indicates whether JIRA can generate a thumbnail for the given attachment.
      Parameters:
      attachment - the attachment (required)
      Returns:
      see above
      Throws:
      org.ofbiz.core.entity.GenericEntityException
      See Also:
    • isThumbnailable

      boolean isThumbnailable(@Nullable Issue issue, Attachment attachment) throws org.ofbiz.core.entity.GenericEntityException
      Indicates whether JIRA can generate a thumbnail for the given attachment. This method may perform better than isThumbnailable(com.atlassian.jira.issue.attachment.Attachment) because it doesn't need to look up the issue.
      Parameters:
      issue - the issue to which the attachment relates (if null, this method will look it up)
      attachment - the attachment (required)
      Returns:
      see above
      Throws:
      org.ofbiz.core.entity.GenericEntityException
      See Also:
    • getThumbnailDeferred

      @Nullable com.atlassian.core.util.thumbnail.Thumbnail getThumbnailDeferred(Issue issue, Attachment attachment)
      A simplified implementation of the getThumbnail(Issue, Attachment) returning only thumbnail mock objects with default dimensions instead of reading existing dimensions from mock file This is speed optimisation and works for internal purposes AttachmentViewDtoConverter.convert(java.util.List)
      Parameters:
      issue - the issue for the attachment (passed in for performance reasons)
      attachment - an Attachment
      Returns:
      returns a Thumbnail, or null
      Since:
      8.20.1
    • checkToolkit

      boolean checkToolkit()
      Checks whether there is an "Abstract Window Toolkit" (AWT Toolkit) available.
      Returns:
      true if one is available
    • getThumbnail

      @Nullable com.atlassian.core.util.thumbnail.Thumbnail getThumbnail(Attachment attachment)
      Returns the Thumbnail that corresponds to an Attachment, or null if the given attachment is not an image.
      Parameters:
      attachment - an Attachment
      Returns:
      returns a Thumbnail, or null
      See Also:
    • getThumbnail

      @Nullable com.atlassian.core.util.thumbnail.Thumbnail getThumbnail(Issue issue, Attachment attachment)
      Returns the Thumbnail that corresponds to an Attachment, or null if the given attachment is not an image.
      Parameters:
      issue - the issue for the attachment (passed in for performance reasons)
      attachment - an Attachment
      Returns:
      returns a Thumbnail, or null
      See Also:
    • toThumbnailedImage

      @Nullable ThumbnailedImage toThumbnailedImage(@Nullable com.atlassian.core.util.thumbnail.Thumbnail thumbnail)
      Converts a Thumbnail into an ThumbnailedImage. The ThumbnailedImage is an analog of the atlassian-core Thumbnail but it contains JIRA-specific methods for getting the image URL, etc.
      Parameters:
      thumbnail - a Thumbnail, or null
      Returns:
      an ImageThumbnail, or null
      Since:
      v5.2
    • streamThumbnailContent

      <T> T streamThumbnailContent(Attachment attachment, InputStreamConsumer<T> consumer) throws IOException
      Get binary content of the thumbnail
      Type Parameters:
      T - The class that the consumer returns when run.
      Parameters:
      attachment - an Attachment
      consumer - function that consumes the thumbnail data.
      Returns:
      the result of the function after it consumed the thumbnail data.
      Throws:
      IOException - if something wrong happens while reading the thumbnail data.
      AttachmentReadException - if there is an error when trying to find if the file exists.
    • deleteThumbnailForAttachment

      void deleteThumbnailForAttachment(@Nullable Issue issue, Attachment attachment)
      Deletes the generated thumbnail for an attachment, if exists.
      Parameters:
      issue - the issue for the attachment (passed in for performance reasons)
      attachment - an Attachment
    • deleteThumbnailsForIssue

      void deleteThumbnailsForIssue(@Nonnull Issue issue)
      Deletes the generated thumbnails for the attachments of an issue.
      Parameters:
      issue - the issue whose attachments' thumbnails will be deleted.