com.atlassian.confluence.pages
Class Attachment

java.lang.Object
  extended by com.atlassian.core.bean.EntityObject
      extended by com.atlassian.confluence.core.ConfluenceEntityObject
          extended by com.atlassian.confluence.core.AbstractVersionedEntityObject
              extended by com.atlassian.confluence.pages.Attachment
All Implemented Interfaces:
SearchableAttachment, Searchable, Addressable, Versioned, Serializable, Cloneable

public class Attachment
extends AbstractVersionedEntityObject
implements SearchableAttachment, Addressable

See Also:
Serialized Form

Field Summary
static String CONTENT_TYPE
           
static String PROFILE_PICTURE_COMMENT
           
 
Constructor Summary
Attachment()
           
Attachment(String fileName, String contentType, long fileSize, String comment)
          Constructs a new Attachment.
 
Method Summary
 boolean equals(Object o)
           
 Integer getAttachmentVersion()
           
 String getComment()
           
 ContentEntityObject getContent()
          The page of this attachment.
 InputStream getContentsAsStream()
           
 String getContentType()
           
 String getDownloadPath()
           
 String getDownloadPathWithoutVersion()
           
 String getFileName()
           
 long getFileSize()
           
 String getNiceFileSize()
           
 String getNiceType()
           
 String getRealTitle()
           
 Collection getSearchableDependants()
           
 String getType()
           
 String getUrlPath()
           
 int hashCode()
           
 boolean isIndexable()
          Only the current version of an attachment is indexable (until we can deal with old objects in search results)
 boolean isUserProfilePicture()
          Determines whether the Attachment is a user's profile picture
 void setAttachmentVersion(Integer attachmentVersion)
           
 void setComment(String comment)
           
 void setContent(ContentEntityObject content)
           
 void setContentType(String contentType)
           
 void setFileName(String fileName)
           
 void setFileSize(long fileSize)
           
 String toString()
           
 
Methods inherited from class com.atlassian.confluence.core.AbstractVersionedEntityObject
convertToHistoricalVersion, getLatestVersion, getOriginalVersion, getVersion, isLatestVersion, isNew, setOriginalVersion, setVersion
 
Methods inherited from class com.atlassian.confluence.core.ConfluenceEntityObject
getCreatorName, getLastModifierName, isPersistent, setCreatorName, setLastModifierName
 
Methods inherited from class com.atlassian.core.bean.EntityObject
clone, getCreationDate, getCurrentDate, getId, getLastModificationDate, setClock, setCreationDate, setId, setLastModificationDate
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.atlassian.bonnie.Searchable
getId
 
Methods inherited from interface com.atlassian.confluence.core.Addressable
getId
 

Field Detail

CONTENT_TYPE

public static final String CONTENT_TYPE
See Also:
Constant Field Values

PROFILE_PICTURE_COMMENT

public static final String PROFILE_PICTURE_COMMENT
See Also:
Constant Field Values
Constructor Detail

Attachment

public Attachment()

Attachment

public Attachment(String fileName,
                  String contentType,
                  long fileSize,
                  String comment)
Constructs a new Attachment.

Parameters:
fileName -
contentType -
fileSize -
comment -
Method Detail

getAttachmentVersion

public Integer getAttachmentVersion()

setAttachmentVersion

public void setAttachmentVersion(Integer attachmentVersion)

getFileName

public String getFileName()
Specified by:
getFileName in interface SearchableAttachment

setFileName

public void setFileName(String fileName)

getContentType

public String getContentType()
Specified by:
getContentType in interface SearchableAttachment

setContentType

public void setContentType(String contentType)

getContent

public ContentEntityObject getContent()
The page of this attachment.


setContent

public void setContent(ContentEntityObject content)

getComment

public String getComment()
Specified by:
getComment in interface SearchableAttachment

setComment

public void setComment(String comment)

getFileSize

public long getFileSize()

setFileSize

public void setFileSize(long fileSize)

getNiceFileSize

public String getNiceFileSize()
Specified by:
getNiceFileSize in interface SearchableAttachment

getNiceType

public String getNiceType()
Specified by:
getNiceType in interface SearchableAttachment
Returns:
A nice type for this file if possible (eg "PDF" or "Word") - or null if no nice type can be recognised

getType

public String getType()
Specified by:
getType in interface Addressable

getRealTitle

public String getRealTitle()
Specified by:
getRealTitle in interface Addressable

getUrlPath

public String getUrlPath()
Specified by:
getUrlPath in interface Addressable

getSearchableDependants

public Collection getSearchableDependants()
Specified by:
getSearchableDependants in interface Searchable

isUserProfilePicture

public boolean isUserProfilePicture()
Determines whether the Attachment is a user's profile picture

Returns:
true if it is attached to a PersonalInformation object and has the correct comment

isIndexable

public boolean isIndexable()
Only the current version of an attachment is indexable (until we can deal with old objects in search results)

Specified by:
isIndexable in interface Searchable

getDownloadPath

public String getDownloadPath()
Specified by:
getDownloadPath in interface SearchableAttachment

getDownloadPathWithoutVersion

public String getDownloadPathWithoutVersion()

getContentsAsStream

public InputStream getContentsAsStream()
                                throws IOException
Specified by:
getContentsAsStream in interface SearchableAttachment
Throws:
IOException

toString

public String toString()
Overrides:
toString in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class EntityObject

equals

public boolean equals(Object o)
Overrides:
equals in class EntityObject


Confluence is developed by Atlassian.