public class

DefaultAttachmentIndexManager

extends Object
implements AttachmentIndexManager
java.lang.Object
   ↳ com.atlassian.jira.issue.managers.DefaultAttachmentIndexManager

Summary

Nested Classes
class DefaultAttachmentIndexManager.TotalLengthPredicate JSONs are saved to the database by EntityProperty mechanism maximum length of whole index is EXTREMELY_LONG_MAXIMUM_LENGTH
Public Constructors
DefaultAttachmentIndexManager(PluginAccessor pluginAccessor, StreamAttachmentStore attachmentStore, JsonEntityPropertyManager jsonEntityPropertyManager, IssuePropertyHelper entityPropertyHelper, IOUtilsWrapper fileFactory, InputStreamFunctionFactory inputStreamFunctionFactory, AttachmentKeyMapper attachmentKeyMapper)
Public Methods
Option<AttachmentArchive> getAttachmentContents(Attachment attachment, Issue issue, int maxEntries)
Retrieves index of given attachment file.
boolean isExpandable(Attachment attachment)
Checks if provided attachment is currently expandable.
void processAttachmentAndCreateIndex(File file, Attachment attachment, Issue issue)
This methods generates the index of and archive file.
void removeAttachmentIndex(Attachment attachment, Issue issue)
Removes the index data of the specified attachment.
Protected Methods
Option<AttachmentArchive> processAttachmentAndCreateIndex(File file, Attachment attachment, Issue issue, int maxEntries)
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.atlassian.jira.issue.AttachmentIndexManager

Public Constructors

public DefaultAttachmentIndexManager (PluginAccessor pluginAccessor, StreamAttachmentStore attachmentStore, JsonEntityPropertyManager jsonEntityPropertyManager, IssuePropertyHelper entityPropertyHelper, IOUtilsWrapper fileFactory, InputStreamFunctionFactory inputStreamFunctionFactory, AttachmentKeyMapper attachmentKeyMapper)

Public Methods

public Option<AttachmentArchive> getAttachmentContents (Attachment attachment, Issue issue, int maxEntries)

Retrieves index of given attachment file. If the index does not exist tries to obtain Attachment file from AttachmentStore and if obtained saves its index to the database.

Parameters
attachment for which index will be retrieved.
issue to which attachment belongs.
maxEntries maximum number of entries that should be returned in
Returns
  • Option.none if no index was found or contents that were retrieved from database.

public boolean isExpandable (Attachment attachment)

Checks if provided attachment is currently expandable.

Parameters
attachment to be tested.
Returns
  • true only if attachment can be expanded by JIRA.

public void processAttachmentAndCreateIndex (File file, Attachment attachment, Issue issue)

This methods generates the index of and archive file. It looks up for plugins that can handle processing file with certain extension. Then it stores given attachment index to database.

Note that after processing file other than archive its index will still be saved as an empty JSON array ("[]") in order to store information that this file was already processed so that getAttachmentContents will not call this method unnecessarily on each issue display.

Parameters
file attachment.
attachment for which index provided.
issue to which attachment belongs.

public void removeAttachmentIndex (Attachment attachment, Issue issue)

Removes the index data of the specified attachment.

Parameters
attachment for which index file will be removed.
issue to which attachment belongs.

Protected Methods

protected Option<AttachmentArchive> processAttachmentAndCreateIndex (File file, Attachment attachment, Issue issue, int maxEntries)