public class ReadThroughCachingAttachmentDao extends AbstractDelegatingAttachmentDao implements FlushableCachingDao
getLatestAttachment(ContentEntityObject, String)
in a cache. Other methods simply delegate to the underlying DAO.
Because the persistent ID of the latest version of an attachment never changes, there's no need to synchronise the cache when an attachment is modified. However, the cache is updated when attachments are removed through this interface.
If for some reason the cache does get out of sync with the database, the lookup using the cached ID will fail. In this situation, we fall back to using the lookup by content ID + file name.
Will also cache misses.
AttachmentDao.AttachmentCopier, AttachmentDao.AttachmentMigrator| Constructor and Description |
|---|
ReadThroughCachingAttachmentDao(AttachmentDaoInternal delegate,
ReadThroughCache<String,Attachment> cache) |
| Modifier and Type | Method and Description |
|---|---|
void |
flush()
Flush the caches managed by this DAO.
|
Attachment |
getLatestAttachment(ContentEntityObject content,
String fileName)
Return the latest version of the attachment on the specified content with the given filename.
|
void |
moveAttachment(Attachment attachment,
Attachment oldAttachment,
ContentEntityObject newContent)
Moves an Attachment to a new file name or content object
|
List<Attachment> |
removeAllVersionsFromServer(Attachment attachment)
Removes all versions of an attachment
|
void |
removeAttachmentFromServer(Attachment attachment)
Removes attachment (and all of its versions)
|
void |
removeAttachmentVersionFromServer(Attachment attachment)
Removes an attachment version
|
afterMigrationFrom, countLatestVersionsOfAttachments, countLatestVersionsOfAttachmentsOnPageSince, countLatestVersionsOfAttachmentsWithAnyStatus, findAll, findAllVersions, findLatestVersionsIterator, getAttachment, getAttachmentData, getAttachmentData, getAttachmentStatistics, getBackingStorageType, getById, getByIds, getCopier, getDataDao, getDelegate, getLastAddedVersionsOf, getLatestVersionsOfAttachments, getLatestVersionsOfAttachments, getLatestVersionsOfAttachmentsForMultipleCeos, getLatestVersionsOfAttachmentsWithAnyStatus, getLatestVersionsOfAttachmentsWithAnyStatusForContainers, getMigrator, getRemappedAttachmentIds, isAttachmentPresent, prepareForMigrationTo, replaceAttachmentData, saveNewAttachment, saveNewAttachmentVersion, updateAttachmentclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetFilteredLatestVersionsOfAttachmentspublic ReadThroughCachingAttachmentDao(AttachmentDaoInternal delegate, ReadThroughCache<String,Attachment> cache)
public Attachment getLatestAttachment(ContentEntityObject content, String fileName)
AttachmentDaogetLatestAttachment in interface AttachmentDaogetLatestAttachment in class AbstractDelegatingAttachmentDaocontent - the content to find the attachment onfileName - the file name of the attachmentpublic void removeAttachmentFromServer(Attachment attachment)
AttachmentDaoremoveAttachmentFromServer in interface AttachmentDaoremoveAttachmentFromServer in class AbstractDelegatingAttachmentDaoattachment - the Attachment to be removedpublic List<Attachment> removeAllVersionsFromServer(Attachment attachment)
AttachmentDaoInternalremoveAllVersionsFromServer in interface AttachmentDaoInternalremoveAllVersionsFromServer in class AbstractDelegatingAttachmentDaoattachment - the Attachment to be removedpublic void removeAttachmentVersionFromServer(Attachment attachment)
AttachmentDaoremoveAttachmentVersionFromServer in interface AttachmentDaoremoveAttachmentVersionFromServer in class AbstractDelegatingAttachmentDaoattachment - the Attachment version to be removedpublic void flush()
FlushableCachingDaoflush in interface FlushableCachingDaopublic void moveAttachment(Attachment attachment, Attachment oldAttachment, ContentEntityObject newContent)
AttachmentDaoThis method assumes that the filename and/or content of the attachment (and its previous versions) have already been updated.
moveAttachment in interface AttachmentDaomoveAttachment in class AbstractDelegatingAttachmentDaoattachment - the Attachment to be movedoldAttachment - the Attachment before it has been updatednewContent - the new content attachment belongs toCopyright © 2003–2023 Atlassian. All rights reserved.