Package com.atlassian.confluence.pages
Record Class IndexableAttachment
java.lang.Object
java.lang.Record
com.atlassian.confluence.pages.IndexableAttachment
- All Implemented Interfaces:
Searchable,SearchableAttachment
public record IndexableAttachment(Attachment attachment)
extends Record
implements SearchableAttachment
A wrapper around an
Attachment that implements the SearchableAttachment interface.- Since:
- 9.3
-
Constructor Summary
ConstructorsConstructorDescriptionIndexableAttachment(Attachment attachment) Creates an instance of aIndexableAttachmentrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theattachmentrecord component.final booleanIndicates whether some other object is "equal to" this one.Return any comment associated with this attachmentReturn the contents of the attachment as an InputStreamgetContentsAsStream(AttachmentManager attachmentManager) Gets the MIME content-type of this attachment.static StringgetDescriptionForMimeType(String mimeType, String fileExtension) Gets the filename of this attachment.longgetId()When we un-index something (say, a page), we also need to un-index everything contained within that page (comments, attachments), because presumably they're all about to go away.final inthashCode()Returns a hash code value for this object.booleanAllows an object to tell the search indexer that it is not allowed to be indexedstatic IndexableAttachmentof(Attachment attachment) final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
IndexableAttachment
Creates an instance of aIndexableAttachmentrecord class.- Parameters:
attachment- the value for theattachmentrecord component
-
-
Method Details
-
of
-
getContentType
Description copied from interface:SearchableAttachmentGets the MIME content-type of this attachment. If there is no content-type, return "application/x-unknown". Should never return null.- Specified by:
getContentTypein interfaceSearchableAttachment- Returns:
- the MIME content-type of the attachment, or "application/x-unknown" if the MIME type is unknown
-
getFileName
Description copied from interface:SearchableAttachmentGets the filename of this attachment. If there is no filename, return the empty string. This method should never return null.- Specified by:
getFileNamein interfaceSearchableAttachment- Returns:
- the filename of this attachment, or the empty string if there is no filename
-
getContentsAsStream
Description copied from interface:SearchableAttachmentReturn the contents of the attachment as an InputStream- Specified by:
getContentsAsStreamin interfaceSearchableAttachment- Returns:
- an InputStream set at the start of the attachment's contents.
-
getContentsAsStream
-
getComment
Description copied from interface:SearchableAttachmentReturn any comment associated with this attachment- Specified by:
getCommentin interfaceSearchableAttachment
-
getNiceType
- Specified by:
getNiceTypein interfaceSearchableAttachment
-
getDescriptionForMimeType
- 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.
-
getNiceFileSize
- Specified by:
getNiceFileSizein interfaceSearchableAttachment
-
getDownloadPath
- Specified by:
getDownloadPathin interfaceSearchableAttachment
-
getId
public long getId()- Specified by:
getIdin interfaceSearchable
-
getSearchableDependants
Description copied from interface:SearchableWhen we un-index something (say, a page), we also need to un-index everything contained within that page (comments, attachments), because presumably they're all about to go away.- Specified by:
getSearchableDependantsin interfaceSearchable
-
isIndexable
public boolean isIndexable()Description copied from interface:SearchableAllows an object to tell the search indexer that it is not allowed to be indexed- Specified by:
isIndexablein interfaceSearchable
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
attachment
Returns the value of theattachmentrecord component.- Returns:
- the value of the
attachmentrecord component
-