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, Serializable, 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. |
Methods inherited from class com.atlassian.core.bean.EntityObject |
clone, getCreationDate, getCurrentDate, getId, getLastModificationDate, setClock, setCreationDate, setId, setLastModificationDate |
Methods inherited from interface com.atlassian.bonnie.Searchable |
getId |
Methods inherited from interface com.atlassian.confluence.core.Addressable |
getId |
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
Attachment
public Attachment()
Attachment
public Attachment(String fileName,
String contentType,
long fileSize,
String comment)
- Constructs a new Attachment.
getAttachmentVersion
public Integer getAttachmentVersion()
setAttachmentVersion
public void setAttachmentVersion(Integer attachmentVersion)
getFileName
public String getFileName()
- Specified by:
getFileName
in interface com.atlassian.bonnie.search.SearchableAttachment
setFileName
public void setFileName(String fileName)
getContentType
public String getContentType()
- Specified by:
getContentType
in interface com.atlassian.bonnie.search.SearchableAttachment
setContentType
public void setContentType(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 String getComment()
- Specified by:
getComment
in interface com.atlassian.bonnie.search.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 com.atlassian.bonnie.search.SearchableAttachment
getNiceType
public 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 String getType()
- Specified by:
getType
in interface ContentTypeAware
- Returns:
- the content type
getDisplayTitle
public String getDisplayTitle()
- Specified by:
getDisplayTitle
in interface Addressable
- Returns:
- the title of the addressable object, suitable for display in a list
getUrlPath
public String getUrlPath()
- Specified by:
getUrlPath
in interface Addressable
getSearchableDependants
public 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 String getDownloadPath()
- Specified by:
getDownloadPath
in interface com.atlassian.bonnie.search.SearchableAttachment
getDownloadPathWithoutVersion
public String getDownloadPathWithoutVersion()
getDownloadPathWithoutEncoding
public String getDownloadPathWithoutEncoding()
getExportPath
public String getExportPath()
getExportPathForThumbnail
public String getExportPathForThumbnail()
getContentsAsStream
public InputStream getContentsAsStream()
throws IOException
- Specified by:
getContentsAsStream
in interface com.atlassian.bonnie.search.SearchableAttachment
- Throws:
IOException
toString
public String toString()
- Overrides:
toString
in class Object
hashCode
public int hashCode()
- Overrides:
hashCode
in class com.atlassian.core.bean.EntityObject
equals
public boolean equals(Object o)
- Overrides:
equals
in class com.atlassian.core.bean.EntityObject
getFileExtension
public 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 String getDescriptionForMimeType(String mimeType,
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 String getLinkWikiMarkup()
- Specified by:
getLinkWikiMarkup
in interface HasLinkWikiMarkup
- Returns:
- the wiki markup used to link to this content