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)
           
 
Method Summary
 boolean checkToolkit()
          Checks if 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(Collection<Attachment> attachments, Issue issue)
           
 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)
           
 boolean isThumbnailable(Issue issue, Attachment attachment)
           
 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)
Method Detail

getThumbnails

public Collection<com.atlassian.core.util.thumbnail.Thumbnail> getThumbnails(Collection<Attachment> attachments,
                                                                             Issue issue)
                                                                      throws Exception
Throws:
Exception

getThumbnails

public Collection<com.atlassian.core.util.thumbnail.Thumbnail> getThumbnails(Issue issue,
                                                                             com.atlassian.crowd.embedded.api.User user)
                                                                      throws Exception
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.
Throws:
Exception
See Also:
ThumbnailManager.toThumbnailedImage(com.atlassian.core.util.thumbnail.Thumbnail)

isThumbnailable

public boolean isThumbnailable(Issue issue,
                               Attachment attachment)
                        throws DataAccessException
Specified by:
isThumbnailable in interface ThumbnailManager
Throws:
DataAccessException

isThumbnailable

public boolean isThumbnailable(Attachment attachment)
                        throws DataAccessException
Specified by:
isThumbnailable in interface ThumbnailManager
Throws:
DataAccessException

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 if there is an "Abstract Window Toolkit" (AWT Toolkit) available.

Specified by:
checkToolkit in interface ThumbnailManager
Returns:
true if there is an "Abstract Window Toolkit" (AWT Toolkit) 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


Copyright © 2002-2012 Atlassian. All Rights Reserved.