public class DefaultThumbnailManager extends Object implements ThumbnailManager
MIME_TYPE
Constructor and Description |
---|
DefaultThumbnailManager(ThumbnailConfiguration thumbnailConfiguration,
AttachmentManager attachmentManager,
MimeManager mimeManager,
VelocityRequestContextFactory velocityRequestContextFactory,
AttachmentStore attachmentStore,
ThumbnailAccessor thumbnailAccessor,
ApplicationProperties applicationProperties) |
Modifier and Type | Method and Description |
---|---|
boolean |
checkToolkit()
Checks whether there is an "Abstract Window Toolkit" (AWT Toolkit) available.
|
void |
deleteThumbnailForAttachment(Issue issue,
Attachment attachment)
Deletes the generated thumbnail for an attachment, if exists.
|
void |
deleteThumbnailsForIssue(Issue issue)
Deletes the generated thumbnails for the attachments of an issue.
|
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,
ApplicationUser 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.
|
public DefaultThumbnailManager(ThumbnailConfiguration thumbnailConfiguration, AttachmentManager attachmentManager, MimeManager mimeManager, VelocityRequestContextFactory velocityRequestContextFactory, AttachmentStore attachmentStore, ThumbnailAccessor thumbnailAccessor, ApplicationProperties applicationProperties)
public Collection<com.atlassian.core.util.thumbnail.Thumbnail> getThumbnails(Issue issue, ApplicationUser user)
ThumbnailManager
Thumbnails
for an Issue
getThumbnails
in interface ThumbnailManager
issue
- the issue to get the thumnails for.user
- the user on whose behalf the request is made.ThumbnailManager.toThumbnailedImage(com.atlassian.core.util.thumbnail.Thumbnail)
public boolean isThumbnailable(Issue issue, Attachment attachment)
ThumbnailManager
ThumbnailManager.isThumbnailable(com.atlassian.jira.issue.attachment.Attachment)
because it doesn't need to look up the issue.isThumbnailable
in interface ThumbnailManager
issue
- the issue to which the attachment relates (if null, this method will look it up)attachment
- the attachment (required)ThumbnailManager.isThumbnailable(com.atlassian.jira.issue.attachment.Attachment)
public boolean isThumbnailable(Attachment attachment)
ThumbnailManager
isThumbnailable
in interface ThumbnailManager
attachment
- the attachment (required)ThumbnailManager.isThumbnailable(com.atlassian.jira.issue.Issue, com.atlassian.jira.issue.attachment.Attachment)
public com.atlassian.core.util.thumbnail.Thumbnail getThumbnail(Attachment attachment)
ThumbnailManager
getThumbnail
in interface ThumbnailManager
attachment
- an AttachmentThumbnailManager.toThumbnailedImage(com.atlassian.core.util.thumbnail.Thumbnail)
public com.atlassian.core.util.thumbnail.Thumbnail getThumbnail(Issue issue, Attachment attachment)
ThumbnailManager
getThumbnail
in interface ThumbnailManager
issue
- the issue for the attachment (passed in for performance reasons)attachment
- an AttachmentThumbnailManager.toThumbnailedImage(com.atlassian.core.util.thumbnail.Thumbnail)
public boolean checkToolkit()
ThumbnailManager
checkToolkit
in interface ThumbnailManager
public ThumbnailedImage toThumbnailedImage(@Nullable com.atlassian.core.util.thumbnail.Thumbnail thumbnail)
ThumbnailManager
toThumbnailedImage
in interface ThumbnailManager
thumbnail
- a Thumbnail, or nullpublic <T> T streamThumbnailContent(Attachment attachment, InputStreamConsumer<T> consumer) throws IOException
ThumbnailManager
streamThumbnailContent
in interface ThumbnailManager
T
- The class that the consumer returns when run.attachment
- an Attachmentconsumer
- function that consumes the thumbnail data.IOException
- if something wrong happens while reading the thumbnail data.public void deleteThumbnailForAttachment(@Nullable Issue issue, Attachment attachment)
ThumbnailManager
deleteThumbnailForAttachment
in interface ThumbnailManager
issue
- the issue for the attachment (passed in for performance reasons)attachment
- an Attachmentpublic void deleteThumbnailsForIssue(@Nonnull Issue issue)
ThumbnailManager
deleteThumbnailsForIssue
in interface ThumbnailManager
issue
- the issue whose attachments' thumbnails will be deleted.Copyright © 2002-2017 Atlassian. All Rights Reserved.