Class DefaultThumbnailManager
java.lang.Object
com.atlassian.jira.issue.thumbnail.DefaultThumbnailManager
- All Implemented Interfaces:
ThumbnailManager
ThumbnailManager is a utility used to create and retrieve thumbnails for attachments.
-
Field Summary
Fields inherited from interface com.atlassian.jira.issue.thumbnail.ThumbnailManager
MIME_TYPE -
Constructor Summary
ConstructorsConstructorDescriptionDefaultThumbnailManager(AttachmentKeyMapper attachmentKeyMapper, ThumbnailConfiguration thumbnailConfiguration, AttachmentManager attachmentManager, MimeManager mimeManager, VelocityRequestContextFactory velocityRequestContextFactory, ThumbnailAccessor thumbnailAccessor, ApplicationProperties applicationProperties, FeatureManager featureManager, StreamAttachmentStore streamAttachmentStore, AttachmentConfigManager attachmentConfigManager) -
Method Summary
Modifier and TypeMethodDescriptionbooleanChecks whether there is an "Abstract Window Toolkit" (AWT Toolkit) available.voiddeleteThumbnailForAttachment(Issue issue, Attachment attachment) Deletes the generated thumbnail for an attachment, if exists.voiddeleteThumbnailsForIssue(Issue issue) Deletes the generated thumbnails for the attachments of an issue.com.atlassian.core.util.thumbnail.ThumbnailgetThumbnail(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.ThumbnailgetThumbnail(Issue issue, 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.ThumbnailgetThumbnailDeferred(Issue issue, Attachment attachment) A simplified implementation of theThumbnailManager.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 purposesAttachmentViewDtoConverter.convert(java.util.List)Collection<com.atlassian.core.util.thumbnail.Thumbnail> getThumbnails(Issue issue, ApplicationUser user) RetrievesThumbnailsfor anIssuebooleanisThumbnailable(Attachment attachment) Indicates whether JIRA can generate a thumbnail for the given attachment.booleanisThumbnailable(Issue issue, Attachment attachment) Indicates whether JIRA can generate a thumbnail for the given attachment.<T> TstreamThumbnailContent(Attachment attachment, InputStreamConsumer<T> consumer) Get binary content of the thumbnailtoThumbnailedImage(com.atlassian.core.util.thumbnail.Thumbnail thumbnail) Converts a Thumbnail into an ThumbnailedImage.
-
Constructor Details
-
DefaultThumbnailManager
public DefaultThumbnailManager(AttachmentKeyMapper attachmentKeyMapper, ThumbnailConfiguration thumbnailConfiguration, AttachmentManager attachmentManager, MimeManager mimeManager, VelocityRequestContextFactory velocityRequestContextFactory, ThumbnailAccessor thumbnailAccessor, ApplicationProperties applicationProperties, FeatureManager featureManager, StreamAttachmentStore streamAttachmentStore, AttachmentConfigManager attachmentConfigManager)
-
-
Method Details
-
getThumbnails
public Collection<com.atlassian.core.util.thumbnail.Thumbnail> getThumbnails(Issue issue, ApplicationUser user) Description copied from interface:ThumbnailManagerRetrievesThumbnailsfor anIssue- Specified by:
getThumbnailsin interfaceThumbnailManager- Parameters:
issue- the issue to get the thumnails for.user- the user on whose behalf the request is made.- Returns:
- the thumbnails.
- See Also:
-
isThumbnailable
Description copied from interface:ThumbnailManagerIndicates whether JIRA can generate a thumbnail for the given attachment. This method may perform better thanThumbnailManager.isThumbnailable(com.atlassian.jira.issue.attachment.Attachment)because it doesn't need to look up the issue.- Specified by:
isThumbnailablein interfaceThumbnailManager- 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:
-
isThumbnailable
Description copied from interface:ThumbnailManagerIndicates whether JIRA can generate a thumbnail for the given attachment.- Specified by:
isThumbnailablein interfaceThumbnailManager- Parameters:
attachment- the attachment (required)- Returns:
- see above
- See Also:
-
getThumbnail
Description copied from interface:ThumbnailManagerReturns the Thumbnail that corresponds to an Attachment, or null if the given attachment is not an image.- Specified by:
getThumbnailin interfaceThumbnailManager- Parameters:
attachment- an Attachment- Returns:
- returns a Thumbnail, or null
- See Also:
-
getThumbnail
Description copied from interface:ThumbnailManagerReturns the Thumbnail that corresponds to an Attachment, or null if the given attachment is not an image.- Specified by:
getThumbnailin interfaceThumbnailManager- Parameters:
issue- the issue for the attachment (passed in for performance reasons)attachment- an Attachment- Returns:
- returns a Thumbnail, or null
- See Also:
-
getThumbnailDeferred
@Nullable public com.atlassian.core.util.thumbnail.Thumbnail getThumbnailDeferred(Issue issue, Attachment attachment) Description copied from interface:ThumbnailManagerA simplified implementation of theThumbnailManager.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 purposesAttachmentViewDtoConverter.convert(java.util.List)- Specified by:
getThumbnailDeferredin interfaceThumbnailManager- Parameters:
issue- the issue for the attachment (passed in for performance reasons)attachment- an Attachment- Returns:
- returns a Thumbnail, or null
-
checkToolkit
public boolean checkToolkit()Description copied from interface:ThumbnailManagerChecks whether there is an "Abstract Window Toolkit" (AWT Toolkit) available.- Specified by:
checkToolkitin interfaceThumbnailManager- Returns:
- true if one is available
-
toThumbnailedImage
public ThumbnailedImage toThumbnailedImage(@Nullable com.atlassian.core.util.thumbnail.Thumbnail thumbnail) Description copied from interface:ThumbnailManagerConverts 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:
toThumbnailedImagein interfaceThumbnailManager- 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:ThumbnailManagerGet binary content of the thumbnail- Specified by:
streamThumbnailContentin interfaceThumbnailManager- Type Parameters:
T- The class that the consumer returns when run.- Parameters:
attachment- an Attachmentconsumer- 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.
-
deleteThumbnailForAttachment
Description copied from interface:ThumbnailManagerDeletes the generated thumbnail for an attachment, if exists.- Specified by:
deleteThumbnailForAttachmentin interfaceThumbnailManager- Parameters:
issue- the issue for the attachment (passed in for performance reasons)attachment- an Attachment
-
deleteThumbnailsForIssue
Description copied from interface:ThumbnailManagerDeletes the generated thumbnails for the attachments of an issue.- Specified by:
deleteThumbnailsForIssuein interfaceThumbnailManager- Parameters:
issue- the issue whose attachments' thumbnails will be deleted.
-