com.atlassian.jira.util
Class AttachmentUtils

java.lang.Object
  extended by com.atlassian.jira.util.AttachmentUtils

public class AttachmentUtils
extends java.lang.Object

Static utilities for working with the attachment files and their directories.


Field Summary
static java.lang.String THUMBS_SUBDIR
           
 
Constructor Summary
AttachmentUtils()
           
 
Method Summary
static void checkValidAttachmentDirectory(org.ofbiz.core.entity.GenericValue issue)
          Deprecated. use checkValidAttachmentDirectory(com.atlassian.jira.issue.Issue) TODO: remove in 4.2
static void checkValidAttachmentDirectory(Issue issue)
          Checks that the Attachment directory of the given issue is right to go - writable, accessible etc.
static void checkValidTemporaryAttachmentDirectory()
           
static java.io.File getAttachmentDirectory(org.ofbiz.core.entity.GenericValue issue)
          Deprecated. use getAttachmentDirectory(com.atlassian.jira.issue.Issue) TODO: remove in 4.2
static java.io.File getAttachmentDirectory(Issue issue)
          Returns the physical directory of the attachments for the given issue.
static java.io.File getAttachmentDirectory(Issue issue, boolean createDirectory)
          Returns the physical directory of the attachments for the given issue.
static java.io.File getAttachmentFile(Attachment attachment)
          Returns the physical File for the given Attachment.
static java.io.File getTemporaryAttachmentDirectory()
           
static java.io.File getThumbnailDirectory(Issue issue)
          Returns the physical directory of the thumbnails for the given issue, creating if necessary.
static java.io.File getThumbnailFile(Attachment attachment)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

THUMBS_SUBDIR

public static final java.lang.String THUMBS_SUBDIR
See Also:
Constant Field Values
Constructor Detail

AttachmentUtils

public AttachmentUtils()
Method Detail

getAttachmentDirectory

public static java.io.File getAttachmentDirectory(org.ofbiz.core.entity.GenericValue issue)
                                           throws DataAccessException
Deprecated. use getAttachmentDirectory(com.atlassian.jira.issue.Issue) TODO: remove in 4.2

Parameters:
issue - the issue.
Returns:
The issue's attachment directory. This will create it if necessary
Throws:
DataAccessException - on failure getting required project or issue info.

getThumbnailDirectory

public static java.io.File getThumbnailDirectory(Issue issue)
Returns the physical directory of the thumbnails for the given issue, creating if necessary.

Parameters:
issue - the issue whose thumbnail directory you want.
Returns:
The issue's thumbnail directory.

getAttachmentDirectory

public static java.io.File getAttachmentDirectory(Issue issue)
Returns the physical directory of the attachments for the given issue. This will create it if necessary.

Parameters:
issue - the issue whose attachment directory you want.
Returns:
The issue's attachment directory.

getAttachmentDirectory

public static java.io.File getAttachmentDirectory(Issue issue,
                                                  boolean createDirectory)
Returns the physical directory of the attachments for the given issue. This will create it if necessary.

Parameters:
issue - the issue whose attachment directory you want.
createDirectory - If true, and the directory does not currently exist, then the directory is created.
Returns:
The issue's attachment directory.

getTemporaryAttachmentDirectory

public static java.io.File getTemporaryAttachmentDirectory()

getAttachmentFile

public static java.io.File getAttachmentFile(Attachment attachment)
                                      throws DataAccessException
Returns the physical File for the given Attachment.

Parameters:
attachment - the attachment.
Returns:
the file.
Throws:
DataAccessException - on failure getting required attachment info.

getThumbnailFile

public static java.io.File getThumbnailFile(Attachment attachment)

checkValidAttachmentDirectory

public static void checkValidAttachmentDirectory(org.ofbiz.core.entity.GenericValue issue)
                                          throws AttachmentException
Deprecated. use checkValidAttachmentDirectory(com.atlassian.jira.issue.Issue) TODO: remove in 4.2

Parameters:
issue - the issue.
Throws:
AttachmentException - if the atttachment directory is invalid or not writable.

checkValidAttachmentDirectory

public static void checkValidAttachmentDirectory(Issue issue)
                                          throws AttachmentException
Checks that the Attachment directory of the given issue is right to go - writable, accessible etc. Will create it if necessary.

Parameters:
issue - the issue whose attachment directory to check.
Throws:
AttachmentException - if the directory is not writable or missing and cannot be created.

checkValidTemporaryAttachmentDirectory

public static void checkValidTemporaryAttachmentDirectory()
                                                   throws AttachmentException
Throws:
AttachmentException


Copyright © 2002-2010 Atlassian. All Rights Reserved.