public class Attachment extends SpaceContentEntityObject implements com.atlassian.bonnie.search.SearchableAttachment, Addressable, HasLinkWikiMarkup, ContentConvertible, Contained<ContentEntityObject>
| Modifier and Type | Class and Description |
|---|---|
static class |
Attachment.Type
An enum of basic Attachment types with a text description of each type.
|
| Modifier and Type | Field and Description |
|---|---|
static String |
API_REVISION |
static String |
API_REVISION_V2 |
static String |
CONTENT_TYPE |
static String |
DOWNLOAD_PATH_BASE
The download path for an attachment is composed with this base, see
getDownloadPathWithoutEncoding() for an example. |
static String |
PROFILE_PICTURE_COMMENT |
static String |
PROP_FILE_STORE_ID |
static String |
PROP_FILESIZE |
static String |
PROP_HIDDEN |
static String |
PROP_MEDIA_TYPE |
static String |
PROP_MINOR_EDIT |
COLLABORATIVE_EDITING_UUID, CONFLUENCE_RECOVERY, CONFLUENCE_RECOVERY_WITH_EXTERNAL_CHANGE, CONTENT_RESTORED_SYNC_REV_SOURCE, CREATED, CURRENT, DELETED, DRAFT, DUMMY_SYNC_REV, LIMITED_MODE_SYNC_REV_SOURCE, MODIFIED, SHARE_ID, SYNC_REV, SYNC_REV_SOURCE, SYNCHRONY_ACK_SYNC_REV_SOURCE, SYNCHRONY_RECOVERY, SYNCHRONY_RECOVERY_WITH_EXTERNAL_CHANGE, SYNCHRONY_SYNC_REV_SOURCEINITIAL_VERSION| Constructor and Description |
|---|
Attachment() |
Attachment(String fileName,
String mediaType,
long fileSize,
String versionComment)
Constructs a new Attachment.
|
Attachment(String fileName,
String mediaType,
long fileSize,
String versionComment,
boolean minorEdit) |
| Modifier and Type | Method and Description |
|---|---|
Object |
clone() |
Attachment |
copy() |
Attachment |
copyLatestVersion()
Will copy all detail information of an attachment including :
- Content Properties
- File Name
- File Size
- Content Type
- And set version is 1
|
boolean |
equals(Object o) |
Integer |
getAttachmentVersion()
Deprecated.
Since 5.7. Use
AbstractVersionedEntityObject.getVersion() instead |
String |
getComment()
Deprecated.
Since 5.7. Use
ContentEntityObject.getVersionComment() instead |
ContentEntityObject |
getContainer() |
ContentEntityObject |
getContent()
Deprecated.
since 5.7 Use
getContainer() instead |
ContentId |
getContentId()
Returns the
ContentId for this entity object, if it implements ContentConvertible. |
InputStream |
getContentsAsStream()
Deprecated.
since 5.5. Use
AttachmentManager.getAttachmentData(Attachment) |
String |
getContentType()
Deprecated.
Since 5.7. Use
getMediaType() instead |
ContentType |
getContentTypeObject() |
static String |
getDescriptionForMimeType(String mimeType,
String fileExtension) |
String |
getDisplayTitle()
Returns the display title.
|
String |
getDownloadPath() |
String |
getDownloadPath(String attachmentPath,
boolean addVersionInfo)
Returns the download path of the attachment for a given attachmentPath prefix.
|
String |
getDownloadPathWithoutEncoding() |
String |
getDownloadPathWithoutVersion()
Returns the download path without any version info.
|
String |
getDownloadPathWithoutVersionOrApiRevision()
Returns the download path without any version info or API revision.
|
String |
getExportPath() |
String |
getExportPathForThumbnail() |
String |
getFileExtension()
Returns the file extension of the attachment.
|
String |
getFileName() |
long |
getFileSize() |
String |
getFileStoreId() |
protected Collection |
getImageDetailsDTO()
accessor methods provided for hibernate proxy use only.
|
String |
getLinkWikiMarkup() |
String |
getMediaType() |
String |
getNameForComparison()
Subclasses should implement this method, giving a String back so
that the content can be alphabetically sorted in a mixed-type list
of content-entities.
|
String |
getNiceFileSize() |
String |
getNiceType() |
Collection<com.atlassian.bonnie.Searchable> |
getSearchableDependants() |
Space |
getSpace() |
String |
getType()
An easy name for the type of this content: makes it easy for
things like the #contentLink macro to work out what to draw.
|
String |
getUrlPath() |
VersionChildOwnerPolicy |
getVersionChildPolicy(ContentType contentType)
Returns the right
VersionChildOwnerPolicy depending on the passed contentType. |
int |
hashCode() |
boolean |
isHidden()
Indicates whether this attachment is supposed to be strictly hidden from displaying and searching
Hidden attachment is not indexable
Hidden attachment manipulation will not trigger external notification events
|
boolean |
isIndexable()
Only the current version of a non-hidden 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 or hidden attachments
|
boolean |
isMinorEdit()
Indicates whether this attachment is supposed to be hidden under normal circumstances.
|
boolean |
isUserProfilePicture()
Determines whether the Attachment is a user's profile picture
|
void |
setAttachmentVersion(Integer attachmentVersion)
Deprecated.
Since 5.7. Use
AbstractVersionedEntityObject.setVersion(int) instead |
void |
setComment(String comment)
Deprecated.
Since 5.7. Use
ContentEntityObject.setVersionComment(java.lang.String) instead |
void |
setContainer(ContentEntityObject content) |
void |
setContent(ContentEntityObject content)
Deprecated.
since 5.7 Use
setContainer(ContentEntityObject) instead |
void |
setContentType(String contentType)
Deprecated.
Since 5.7. Use
setMediaType(java.lang.String) instead |
void |
setFileName(String fileName) |
void |
setFileSize(long fileSize) |
void |
setFileStoreId(String fileStoreId) |
void |
setHidden(boolean hidden) |
protected void |
setImageDetailsDTO(Set imageDetailDTOs) |
void |
setMediaType(String mediaType) |
void |
setMinorEdit(boolean minorEdit) |
boolean |
shouldConvertToContent() |
String |
toString() |
convertToHistoricalVersion, getSpaceKey, isInSpace, setSpaceaddAttachment, addComment, addCustomContent, addOutgoingLink, addPermission, addReferralLink, addTrackbackLink, applyChildVersioningPolicy, applyChildVersioningPolicy, compareTo, ensureAttachmentBelongsToContent, getAttachmentManager, getAttachmentNamed, getAttachments, getAttachmentsUrlPath, getAttachmentUrlPath, getBodyAsString, getBodyAsStringWithoutMarkup, getBodyContent, getBodyContent, getBodyContents, getCollaborativeEditingUuid, getComments, getContainerContent, getContentEntityObject, getContentPermission, getContentPermissionSet, getContentStatus, getContentStatusObject, getDefaultBodyType, getEntity, getExcerpt, getIdAsString, getLatestVersionId, getLatestVersionsOfAttachments, getLowerTitle, getOriginalVersionId, getOutgoingLinks, getPermissions, getProperties, getReferralLinks, getRenderedVersionComment, getSelector, getShareId, getSynchronyRevision, getSynchronyRevisionSource, getTitle, getTrackbackLinks, getTypeEnum, getUserAccessor, getVersionComment, hasContentPermissions, hasPermissions, isCurrent, isDeleted, isDraft, isRecentlyUpdatedFor, isUnpublished, isVersionCommentAvailable, removeAttachment, removeComment, removeContentPermissionSet, removeCustomContent, removeOutgoingLink, removeReferralLink, removeTrackbackLink, replaceContentProperties, restore, restoreDependents, setAttachments, setBodyAsString, setBodyContent, setBodyContents, setCollaborativeEditingUuid, setComments, setContainerContent, setContentPropertiesFrom, setContentStatus, setOriginalVersion, setOriginalVersionId, setOutgoingLinks, setReferralLinks, setShareId, setSynchronyRevision, setSynchronyRevisionSource, setTitle, setTrackbackLinks, setUserAccessor, setVersionComment, sharedAccessAllowed, sharedAccessAllowed, toPageContext, trash, trashDependents, wasCreatedByaddLabelling, getGlobalLabels, getLabelCount, getLabellings, getLabels, getLabelsForDisplay, getLabelUtil, getPersonalLabels, getTeamLabels, getVisibleLabels, isFavourite, isFavourite, removeLabelling, setLabellingsgetConfluenceRevision, getLatestVersion, getOriginalVersion, getVersion, isLatestVersion, isNew, setVersiongetCreator, getCreatorName, getLastModifier, getLastModifierName, getRealClass, isPersistent, setCreator, setCreatorName, setLastModifier, setLastModifierNamegetCreationDate, getCurrentDate, getId, getLastModificationDate, setClock, setCreationDate, setId, setLastModificationDatefinalize, getClass, notify, notifyAll, wait, wait, waitgetIdgetSelectorgetId, isPersistentpublic static final String PROP_MEDIA_TYPE
public static final String PROP_FILESIZE
public static final String PROP_MINOR_EDIT
public static final String PROP_HIDDEN
public static final String PROP_FILE_STORE_ID
public static final String CONTENT_TYPE
public static final String PROFILE_PICTURE_COMMENT
public static final String API_REVISION
public static final String API_REVISION_V2
public static final String DOWNLOAD_PATH_BASE
getDownloadPathWithoutEncoding() for an example.public Attachment()
public Attachment(@Nonnull String fileName, @Nonnull String mediaType, long fileSize, String versionComment, boolean minorEdit)
@Deprecated public Integer getAttachmentVersion()
AbstractVersionedEntityObject.getVersion() instead@Deprecated public void setAttachmentVersion(@Nullable Integer attachmentVersion)
AbstractVersionedEntityObject.setVersion(int) instead@Nonnull public String getFileName()
getFileName in interface com.atlassian.bonnie.search.SearchableAttachment@Nonnull @Deprecated public String getContentType()
getMediaType() insteadgetContentType in interface com.atlassian.bonnie.search.SearchableAttachment@Deprecated public void setContentType(@Nonnull String contentType)
setMediaType(java.lang.String) insteadpublic ContentEntityObject getContainer()
getContainer in interface Contained<ContentEntityObject>public void setContainer(ContentEntityObject content)
@Deprecated @Nonnull public ContentEntityObject getContent()
getContainer() instead@Deprecated public void setContent(@Nonnull ContentEntityObject content)
setContainer(ContentEntityObject) instead@Deprecated public String getComment()
ContentEntityObject.getVersionComment() insteadgetComment in interface com.atlassian.bonnie.search.SearchableAttachment@Deprecated public void setComment(String comment)
ContentEntityObject.setVersionComment(java.lang.String) insteadpublic boolean isMinorEdit()
public void setMinorEdit(boolean minorEdit)
public String getFileStoreId()
public void setFileStoreId(String fileStoreId)
public boolean isHidden()
public void setHidden(boolean hidden)
public long getFileSize()
public void setFileSize(long fileSize)
public String getNiceFileSize()
getNiceFileSize in interface com.atlassian.bonnie.search.SearchableAttachmentpublic String getNiceType()
getNiceType in interface com.atlassian.bonnie.search.SearchableAttachmentpublic String getType()
ContentEntityObjectThis is a bit of a hack, but it saves heaps of code elsewhere, especially since we tend to get back these objects wrapped in all sorts of Hibernate CGLIB stuff.
getType in interface ContentTypeAwaregetType in class ContentEntityObjectpublic String getDisplayTitle()
ContentEntityObjectgetDisplayTitle in interface AddressablegetDisplayTitle in class ContentEntityObject@Nullable public String getUrlPath()
getUrlPath in interface AddressablegetUrlPath in class ContentEntityObjectpublic Collection<com.atlassian.bonnie.Searchable> getSearchableDependants()
getSearchableDependants in interface com.atlassian.bonnie.SearchablegetSearchableDependants in class ContentEntityObjectpublic boolean isUserProfilePicture()
public boolean isIndexable()
isIndexable in interface com.atlassian.bonnie.SearchableisIndexable in class SpaceContentEntityObjectpublic String getDownloadPath()
getDownloadPath in interface com.atlassian.bonnie.search.SearchableAttachmentpublic String getDownloadPathWithoutVersion()
public String getDownloadPathWithoutVersionOrApiRevision()
public String getDownloadPath(String attachmentPath, boolean addVersionInfo)
public String getDownloadPathWithoutEncoding()
public String getExportPath()
public String getExportPathForThumbnail()
@Deprecated public InputStream getContentsAsStream() throws IOException
AttachmentManager.getAttachmentData(Attachment)getContentsAsStream in interface com.atlassian.bonnie.search.SearchableAttachmentIOExceptionpublic String toString()
toString in class ContentEntityObjectpublic String getNameForComparison()
ContentEntityObjectgetNameForComparison in class SpaceContentEntityObjectpublic boolean equals(Object o)
equals in class ContentEntityObjectpublic int hashCode()
hashCode in class SpaceContentEntityObjectpublic String getFileExtension()
public static String getDescriptionForMimeType(String mimeType, String fileExtension)
mimeType - the mime type to be described. Should not be nullfileExtension - the file extension to help with the deriving of the description.public Space getSpace()
getSpace in interface SpacedgetSpace in class SpaceContentEntityObjectSpaced), or null otherwise.public String getLinkWikiMarkup()
getLinkWikiMarkup in interface HasLinkWikiMarkupprotected Collection getImageDetailsDTO()
ImageDetailsManager.getImageDetails(Attachment attachment)protected void setImageDetailsDTO(Set imageDetailDTOs)
public Object clone()
clone in class ContentEntityObjectpublic Attachment copy()
public VersionChildOwnerPolicy getVersionChildPolicy(ContentType contentType)
VersionedVersionChildOwnerPolicy depending on the passed contentType.
By default, VersionChildOwnerPolicy.currentVersion is returned
Right now, this is only enforced for children with content type Attachment or Comment
getVersionChildPolicy in interface VersionedgetVersionChildPolicy in class AbstractVersionedEntityObjectpublic ContentType getContentTypeObject()
getContentTypeObject in interface ContentConvertiblepublic ContentId getContentId()
ContentEntityObjectContentId for this entity object, if it implements ContentConvertible.
Subclasses implementing ContentConvertible must override this method.
getContentId in interface ContentConvertiblegetContentId in class ContentEntityObjectpublic boolean shouldConvertToContent()
shouldConvertToContent in interface ContentConvertiblepublic Attachment copyLatestVersion()
NOTE: it won't copy content history
Copyright © 2003–2021 Atlassian. All rights reserved.