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:
com.atlassian.bonnie.search.SearchableAttachment, com.atlassian.bonnie.Searchable, Addressable, Versioned, java.io.Serializable, java.lang.Cloneable

public class Attachment
extends AbstractVersionedEntityObject
implements com.atlassian.bonnie.search.SearchableAttachment, Addressable

See Also:
Serialized Form

Field Summary
static java.lang.String CONTENT_TYPE
           
static java.lang.String PROFILE_PICTURE_COMMENT
           
 
Fields inherited from class com.atlassian.confluence.core.AbstractVersionedEntityObject
INITIAL_VERSION
 
Constructor Summary
Attachment()
           
Attachment(java.lang.String fileName, java.lang.String contentType, long fileSize, java.lang.String comment)
          Constructs a new Attachment.
 
Method Summary
 boolean equals(java.lang.Object o)
           
 java.lang.Integer getAttachmentVersion()
           
 java.lang.String getComment()
           
 ContentEntityObject getContent()
          The object to which the attachment is attached.
 java.io.InputStream getContentsAsStream()
           
 java.lang.String getContentType()
           
 java.lang.String getDisplayTitle()
          The title of the addressable object, suitable for display in a list
 java.lang.String getDownloadPath()
           
 java.lang.String getDownloadPathWithoutVersion()
           
 java.lang.String getFileExtension()
          Returns the file extension of the attachment.
 java.lang.String getFileName()
           
 long getFileSize()
           
 java.lang.String getNiceFileSize()
           
 java.lang.String getNiceType()
           
 java.lang.String getRealTitle()
          Deprecated. since 2.8 - see Addressable
 java.util.Collection getSearchableDependants()
           
 java.lang.String getType()
           
 java.lang.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) We also don't want to index attachments associated with drafts.
 boolean isUserProfilePicture()
          Determines whether the Attachment is a user's profile picture
 void setAttachmentVersion(java.lang.Integer attachmentVersion)
           
 void setComment(java.lang.String comment)
           
 void setContent(ContentEntityObject content)
           
 void setContentType(java.lang.String contentType)
           
 void setFileName(java.lang.String fileName)
           
 void setFileSize(long fileSize)
           
 java.lang.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 java.lang.String CONTENT_TYPE
See Also:
Constant Field Values

PROFILE_PICTURE_COMMENT

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

Attachment

public Attachment()

Attachment

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

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

getAttachmentVersion

public java.lang.Integer getAttachmentVersion()

setAttachmentVersion

public void setAttachmentVersion(java.lang.Integer attachmentVersion)

getFileName

public java.lang.String getFileName()
Specified by:
getFileName in interface com.atlassian.bonnie.search.SearchableAttachment

setFileName

public void setFileName(java.lang.String fileName)

getContentType

public java.lang.String getContentType()
Specified by:
getContentType in interface com.atlassian.bonnie.search.SearchableAttachment

setContentType

public void setContentType(java.lang.String contentType)

getContent

public ContentEntityObject getContent()
The object to which the attachment is attached. Eg the page or blog post to which its attached.


setContent

public void setContent(ContentEntityObject content)

getComment

public java.lang.String getComment()
Specified by:
getComment in interface com.atlassian.bonnie.search.SearchableAttachment

setComment

public void setComment(java.lang.String comment)

getFileSize

public long getFileSize()

setFileSize

public void setFileSize(long fileSize)

getNiceFileSize

public java.lang.String getNiceFileSize()
Specified by:
getNiceFileSize in interface com.atlassian.bonnie.search.SearchableAttachment

getNiceType

public java.lang.String getNiceType()
Specified by:
getNiceType in interface com.atlassian.bonnie.search.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 java.lang.String getType()
Specified by:
getType in interface Addressable

getRealTitle

public java.lang.String getRealTitle()
Deprecated. since 2.8 - see Addressable

Specified by:
getRealTitle in interface Addressable
Returns:

getDisplayTitle

public java.lang.String getDisplayTitle()
Description copied from interface: Addressable
The title of the addressable object, suitable for display in a list

Specified by:
getDisplayTitle in interface Addressable
Returns:

getUrlPath

public java.lang.String getUrlPath()
Specified by:
getUrlPath in interface Addressable

getSearchableDependants

public java.util.Collection getSearchableDependants()
Specified by:
getSearchableDependants in interface com.atlassian.bonnie.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) We also don't want to index attachments associated with drafts.

Specified by:
isIndexable in interface com.atlassian.bonnie.Searchable

getDownloadPath

public java.lang.String getDownloadPath()
Specified by:
getDownloadPath in interface com.atlassian.bonnie.search.SearchableAttachment

getDownloadPathWithoutVersion

public java.lang.String getDownloadPathWithoutVersion()

getContentsAsStream

public java.io.InputStream getContentsAsStream()
                                        throws java.io.IOException
Specified by:
getContentsAsStream in interface com.atlassian.bonnie.search.SearchableAttachment
Throws:
java.io.IOException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class com.atlassian.core.bean.EntityObject

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class com.atlassian.core.bean.EntityObject

getFileExtension

public java.lang.String getFileExtension()
Returns the file extension of the attachment. If there is no extension, an empty string is returned.

Returns:
the file extension of the attachment in lower case


Copyright © 2003-2008 Atlassian Pty Ltd. All Rights Reserved.