com.atlassian.jira.issue.thumbnail
Class DefaultThumbnailManager

java.lang.Object
  extended by com.atlassian.jira.issue.thumbnail.DefaultThumbnailManager
All Implemented Interfaces:
ThumbnailManager

public class DefaultThumbnailManager
extends Object
implements ThumbnailManager

Some of this code was taken in 4.4 from our friends in Confluence


Field Summary
 
Fields inherited from interface com.atlassian.jira.issue.thumbnail.ThumbnailManager
MIME_TYPE
 
Constructor Summary
DefaultThumbnailManager(ThumbnailConfiguration thumbnailConfiguration, AttachmentManager attachmentManager, MimeManager mimeManager, ApplicationProperties applicationProperties, VelocityRequestContextFactory velocityRequestContextFactory, AttachmentStore attachmentStore, ThumbnailAccessor thumbnailAccessor)
           
 
Method Summary
 boolean checkToolkit()
          Checks whether there is an "Abstract Window Toolkit" (AWT Toolkit) available.
 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.
 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.
 Collection<com.atlassian.core.util.thumbnail.Thumbnail> getThumbnails(Issue issue, com.atlassian.crowd.embedded.api.User user)
          Retrieves Thumbnails for an Issue
 boolean isThumbnailable(Attachment attachment)
          Indicates whether JIRA can generate a thumbnail for the given attachment.
 boolean isThumbnailable(Issue issue, Attachment attachment)
          Indicates whether JIRA can generate a thumbnail for the given attachment.
<T> T
streamThumbnailContent(Attachment attachment, InputStreamConsumer<T> consumer)
          Get binary content of the thumbnail
 ThumbnailedImage toThumbnailedImage(com.atlassian.core.util.thumbnail.Thumbnail thumbnail)
          Converts a Thumbnail into an ThumbnailedImage.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultThumbnailManager

public DefaultThumbnailManager(ThumbnailConfiguration thumbnailConfiguration,
                               AttachmentManager attachmentManager,
                               MimeManager mimeManager,
                               ApplicationProperties applicationProperties,
                               VelocityRequestContextFactory velocityRequestContextFactory,
                               AttachmentStore attachmentStore,
                               ThumbnailAccessor thumbnailAccessor)
Method Detail

getThumbnails

public Collection<com.atlassian.core.util.thumbnail.Thumbnail> getThumbnails(Issue issue,
                                                                             com.atlassian.crowd.embedded.api.User user)
Description copied from interface: ThumbnailManager
Retrieves Thumbnails for an Issue

Specified by:
getThumbnails in interface ThumbnailManager
Parameters:
issue - the issue to get the thumnails for.
user - the user on whose behalf the request is made.
Returns:
the thumbnails.
See Also:
ThumbnailManager.toThumbnailedImage(com.atlassian.core.util.thumbnail.Thumbnail)

isThumbnailable

public boolean isThumbnailable(Issue issue,
                               Attachment attachment)
Description copied from interface: ThumbnailManager
Indicates whether JIRA can generate a thumbnail for the given attachment. This method may perform better than ThumbnailManager.isThumbnailable(com.atlassian.jira.issue.attachment.Attachment) because it doesn't need to look up the issue.

Specified by:
isThumbnailable in interface ThumbnailManager
Parameters:
issue - the issue to which the attachment relates (if null, this method will look it up)
attachment - the attachment (required)
Returns:
see above
See Also:
ThumbnailManager.isThumbnailable(com.atlassian.jira.issue.attachment.Attachment)

isThumbnailable

public boolean isThumbnailable(Attachment attachment)
Description copied from interface: ThumbnailManager
Indicates whether JIRA can generate a thumbnail for the given attachment.

Specified by:
isThumbnailable in interface ThumbnailManager
Parameters:
attachment - the attachment (required)
Returns:
see above
See Also:
ThumbnailManager.isThumbnailable(com.atlassian.jira.issue.Issue, com.atlassian.jira.issue.attachment.Attachment)

getThumbnail

public com.atlassian.core.util.thumbnail.Thumbnail getThumbnail(Attachment attachment)
Description copied from interface: ThumbnailManager
Returns the Thumbnail that corresponds to an Attachment, or null if the given attachment is not an image.

Specified by:
getThumbnail in interface ThumbnailManager
Parameters:
attachment - an Attachment
Returns:
returns a Thumbnail, or null
See Also:
ThumbnailManager.toThumbnailedImage(com.atlassian.core.util.thumbnail.Thumbnail)

getThumbnail

public com.atlassian.core.util.thumbnail.Thumbnail getThumbnail(Issue issue,
                                                                Attachment attachment)
Description copied from interface: ThumbnailManager
Returns the Thumbnail that corresponds to an Attachment, or null if the given attachment is not an image.

Specified by:
getThumbnail in interface ThumbnailManager
Parameters:
issue - the issue for the attachment (passed in for performance reasons)
attachment - an Attachment
Returns:
returns a Thumbnail, or null
See Also:
ThumbnailManager.toThumbnailedImage(com.atlassian.core.util.thumbnail.Thumbnail)

checkToolkit

public boolean checkToolkit()
Description copied from interface: ThumbnailManager
Checks whether there is an "Abstract Window Toolkit" (AWT Toolkit) available.

Specified by:
checkToolkit in interface ThumbnailManager
Returns:
true if one is available

toThumbnailedImage

public ThumbnailedImage toThumbnailedImage(@Nullable
                                           com.atlassian.core.util.thumbnail.Thumbnail thumbnail)
Description copied from interface: ThumbnailManager
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.

Specified by:
toThumbnailedImage in interface ThumbnailManager
Parameters:
thumbnail - a Thumbnail, or null
Returns:
an ImageThumbnail, or null

streamThumbnailContent

public <T> T streamThumbnailContent(Attachment attachment,
                                    InputStreamConsumer<T> consumer)
                         throws IOException
Description copied from interface: ThumbnailManager
Get binary content of the thumbnail

Specified by:
streamThumbnailContent in interface ThumbnailManager
Returns:
Throws:
IOException


Copyright © 2002-2014 Atlassian. All Rights Reserved.