com.atlassian.confluence.pages
Class Attachment
java.lang.Object
com.atlassian.core.bean.EntityObject
com.atlassian.confluence.core.ConfluenceEntityObject
com.atlassian.confluence.core.AbstractVersionedEntityObject
com.atlassian.confluence.pages.Attachment
- All Implemented Interfaces:
- com.atlassian.bonnie.search.SearchableAttachment, com.atlassian.bonnie.Searchable, Addressable, ContentTypeAware, HasLinkWikiMarkup, Versioned, Spaced, java.io.Serializable, java.lang.Cloneable
public class Attachment
- extends AbstractVersionedEntityObject
- implements com.atlassian.bonnie.search.SearchableAttachment, Addressable, Spaced, HasLinkWikiMarkup
- See Also:
- Serialized Form
Nested Class Summary |
static class |
Attachment.Type
An enum of basic Attachment types with a text description of each type. |
Constructor Summary |
Attachment()
|
Attachment(java.lang.String fileName,
java.lang.String contentType,
long fileSize,
java.lang.String comment)
Constructs a new Attachment. |
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 |
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
Attachment
public Attachment()
Attachment
public Attachment(java.lang.String fileName,
java.lang.String contentType,
long fileSize,
java.lang.String comment)
- Constructs a new Attachment.
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 ContentTypeAware
- Returns:
- the content type
getDisplayTitle
public java.lang.String getDisplayTitle()
- Specified by:
getDisplayTitle
in interface Addressable
- Returns:
- the title of the addressable object, suitable for display in a list
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 or global descriptions.
- 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()
getDownloadPathWithoutEncoding
public java.lang.String getDownloadPathWithoutEncoding()
getExportPath
public java.lang.String getExportPath()
getExportPathForThumbnail
public java.lang.String getExportPathForThumbnail()
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
getDescriptionForMimeType
public static java.lang.String getDescriptionForMimeType(java.lang.String mimeType,
java.lang.String fileExtension)
- Parameters:
mimeType
- the mime type to be described. Should not be nullfileExtension
- the file extension to help with the deriving of the description.
- Returns:
- A more displayable description for the supplied mime type. If a blank String is supplied then null will
be returned.
getSpace
public Space getSpace()
- Specified by:
getSpace
in interface Spaced
- Returns:
- the space of the owning content if it can be associated with a space (i.e. of type
Spaced
), or null otherwise.
getLinkWikiMarkup
public java.lang.String getLinkWikiMarkup()
- Specified by:
getLinkWikiMarkup
in interface HasLinkWikiMarkup
- Returns:
- the wiki markup used to link to this content
Copyright © 2003-2010 Atlassian. All Rights Reserved.