com.atlassian.jira.issue.attachment
Class FileAttachments

java.lang.Object
  extended by com.atlassian.jira.issue.attachment.FileAttachments

public final class FileAttachments
extends Object

Contains utility methods for dealing with attachments on the file system.

Since:
v6.3

Method Summary
static String computeIssueKeyForOriginalProjectKey(String originalProjectKey, String issueKey)
          Helper method to mung an issue key to the given project key.
static File getAttachmentDirectoryForIssue(File rootDir, String originalProjectKey, String issueKey)
          Returns the directory containing attachments for an issue.
static File getAttachmentFileHolder(AttachmentKey attachment, File rootDir)
          Returns a file that refers to an attachment specified by the given attachment key and the attachment root directory.
static File getAttachmentFileHolder(AttachmentStore.AttachmentAdapter attachment, File attachmentDir)
          Deprecated. we should be using getAttachmentFileHolder(AttachmentKey, java.io.File) once AttachmentStore is removed.
static File getDefaultAttachmentFileHolder(AttachmentKey attachment, File rootDir)
          Returns a file that refers to the default location of an attachment specified by the given attachment key and the attachment root directory.
static File validateFileForAttachment(Attachment metaData, File file)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getAttachmentDirectoryForIssue

public static File getAttachmentDirectoryForIssue(File rootDir,
                                                  String originalProjectKey,
                                                  String issueKey)
Returns the directory containing attachments for an issue.

Parameters:
rootDir - The root directory of all attachments.
originalProjectKey - The project key that was used to store the attachments (i.e. the original project key)
issueKey - The issue key
Returns:
The directory containing attachments for an issue.

computeIssueKeyForOriginalProjectKey

public static String computeIssueKeyForOriginalProjectKey(String originalProjectKey,
                                                          String issueKey)
Helper method to mung an issue key to the given project key.

Parameters:
originalProjectKey - The project key that the issue should be under.
issueKey - The issue key to mung.
Returns:
Munged issue key with the specified original project key as the issue prefix.

getAttachmentFileHolder

public static File getAttachmentFileHolder(AttachmentKey attachment,
                                           File rootDir)
Returns a file that refers to an attachment specified by the given attachment key and the attachment root directory.

Parameters:
attachment - The attachment key.
rootDir - The root directory of all attachments. NOT THE DIRECTORY FOR AN ISSUE'S ATTACHMENT.
Returns:
a file that refers to an attachment specified by the given attachment key and the attachment root directory.

getDefaultAttachmentFileHolder

public static File getDefaultAttachmentFileHolder(AttachmentKey attachment,
                                                  File rootDir)
Returns a file that refers to the default location of an attachment specified by the given attachment key and the attachment root directory.

Parameters:
attachment - The attachment key.
rootDir - The root directory of all attachments. NOT THE DIRECTORY FOR AN ISSUE'S ATTACHMENT.
Returns:
a file that refers to the default location of an attachment specified by the given attachment key and the attachment root directory.

getAttachmentFileHolder

@Deprecated
public static File getAttachmentFileHolder(AttachmentStore.AttachmentAdapter attachment,
                                                      File attachmentDir)
Deprecated. we should be using getAttachmentFileHolder(AttachmentKey, java.io.File) once AttachmentStore is removed.

Returns a file that refers to an attachment specified by the given attachment key and the attachment root directory.

Parameters:
attachment - The attachment adapter
attachmentDir - The directory of issue's attachments. NOT THE ROOT DIRECTORY FOR ALL ATTACHMENTS.
Returns:
a file that refers to an attachment specified by the given attachment key and the attachment root directory.

validateFileForAttachment

public static File validateFileForAttachment(Attachment metaData,
                                             File file)


Copyright © 2002-2014 Atlassian. All Rights Reserved.