|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.atlassian.confluence.pages.attachments.CachingAttachmentDao
public class CachingAttachmentDao
Caches the IDs of attachments retrieved with getLatestAttachment(ContentEntityObject, String)
in an AttachmentCache. Other methods simply delegate to the underlying DAO.
AttachmentCache| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface com.atlassian.confluence.pages.persistence.dao.AttachmentDao |
|---|
AttachmentDao.AttachmentCopier, AttachmentDao.AttachmentMigrator |
| Constructor Summary | |
|---|---|
CachingAttachmentDao(AttachmentDao delegate,
AttachmentCache cache)
|
|
| Method Summary | |
|---|---|
void |
afterMigrationFrom()
Perform any tasks necessary after Attachment data has been moved from this data store to another. |
int |
countLatestVersionsOfAttachments(ContentEntityObject content)
|
List<Attachment> |
findAll()
Retrieves the latest versions of all Attachments Use of this method is discouraged when there are a large amount of Attachments. |
List<Attachment> |
findAllVersions(Attachment attachment)
|
Iterator<Attachment> |
findLatestVersionsIterator()
Retrieves the latest versions of all Attachments and returns an Iterator to the results. |
void |
flush()
Flush the caches managed by this DAO. |
Attachment |
getAttachment(ContentEntityObject content,
String fileName,
int version)
Return the attachment on the specified content with the given filename and version. |
InputStream |
getAttachmentData(Attachment attachment)
Retrieves the InputStream representing the data for attachment |
Attachment |
getById(long id)
Returns the attachment with the given persistent ID. |
AttachmentDao.AttachmentCopier |
getCopier(AttachmentDao destinationDao)
Get a copier object to copy attachments between data stores The source data store will remain untouched |
AttachmentDao |
getDelegate()
Returns the attachment DAO which this instance delegates to. |
List<Attachment> |
getLastAddedVersionsOf(Attachment attachment)
Retrieves all the last added versions for each user who has added a version of the attachment That is, if a user has added multiple versions, only the latest added version will be added to the list returned. |
Attachment |
getLatestAttachment(ContentEntityObject content,
String fileName)
Return the latest version of the attachment on the specified content with the given filename. |
List<Attachment> |
getLatestVersionsOfAttachments(ContentEntityObject ceo)
Retrieves the latest versions of all attachments to ceo |
AttachmentDao.AttachmentMigrator |
getMigrator(AttachmentDao destinationDao)
Get a migrator object to migrate attachments between attachment datastores. |
void |
moveAttachment(Attachment attachment,
Attachment oldAttachment,
ContentEntityObject newContent)
Moves an Attachment to a new file name or content object This method assumes that the filename and/or content of the attachment (and its previous versions) have already been updated. |
void |
prepareForMigrationTo()
Prepare the data store for a migration from another type of data store. |
void |
removeAttachmentFromServer(Attachment attachment)
Removes attachment (and all of its versions) |
void |
replaceAttachmentData(Attachment attachment,
InputStream attachmentData)
Sets the attachment data for attachment This method will overwrite any existing data for the attachment version. |
void |
saveNewAttachment(Attachment attachment,
InputStream attachmentData)
Saves a new attachment |
void |
saveNewAttachmentVersion(Attachment attachment,
Attachment previousVersion,
InputStream attachmentData)
Saves a new version of attachment |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public CachingAttachmentDao(AttachmentDao delegate,
AttachmentCache cache)
| Method Detail |
|---|
public AttachmentDao getDelegate()
DelegatingAttachmentDao
getDelegate in interface DelegatingAttachmentDaopublic Attachment getById(long id)
AttachmentDao
getById in interface AttachmentDaoid - the persistent ID of the attachment to retrieve
public Attachment getLatestAttachment(ContentEntityObject content,
String fileName)
AttachmentDao
getLatestAttachment in interface AttachmentDaocontent - the content to find the attachment onfileName - the file name of the attachment
public List<Attachment> getLastAddedVersionsOf(Attachment attachment)
AttachmentDao
getLastAddedVersionsOf in interface AttachmentDaoattachment - attachment (must be the latest version)
public void removeAttachmentFromServer(Attachment attachment)
AttachmentDao
removeAttachmentFromServer in interface AttachmentDaoattachment - the Attachment to be removedpublic void flush()
FlushableCachingDao
flush in interface FlushableCachingDaopublic List<Attachment> getLatestVersionsOfAttachments(ContentEntityObject ceo)
AttachmentDao
getLatestVersionsOfAttachments in interface AttachmentDaoceo - the content to look up attachments
AttachmentDao.countLatestVersionsOfAttachments(com.atlassian.confluence.core.ContentEntityObject)public int countLatestVersionsOfAttachments(ContentEntityObject content)
countLatestVersionsOfAttachments in interface AttachmentDaocontent - the content object
AttachmentDao.getLatestVersionsOfAttachments(com.atlassian.confluence.core.ContentEntityObject)public List<Attachment> findAll()
AttachmentDao
findAll in interface AttachmentDaoAttachmentDao.findLatestVersionsIterator()public Iterator<Attachment> findLatestVersionsIterator()
AttachmentDao
findLatestVersionsIterator in interface AttachmentDao
public InputStream getAttachmentData(Attachment attachment)
throws AttachmentDataNotFoundException
AttachmentDao
getAttachmentData in interface AttachmentDaoattachment - the attachment whose data will be returned
AttachmentDataNotFoundException - if the data could not be found
public void saveNewAttachment(Attachment attachment,
InputStream attachmentData)
AttachmentDao
saveNewAttachment in interface AttachmentDaoattachment - the Attachment to be savedattachmentData - the attachment data to be saved
public void saveNewAttachmentVersion(Attachment attachment,
Attachment previousVersion,
InputStream attachmentData)
AttachmentDao
saveNewAttachmentVersion in interface AttachmentDaoattachment - the Attachment to be savedpreviousVersion - the previous version of the AttachmentattachmentData - the attachment data to be saved
public void moveAttachment(Attachment attachment,
Attachment oldAttachment,
ContentEntityObject newContent)
AttachmentDao
moveAttachment in interface AttachmentDaoattachment - the Attachment to be movedoldAttachment - the Attachment before it has been updatednewContent - the new content attachment belongs to
public void replaceAttachmentData(Attachment attachment,
InputStream attachmentData)
AttachmentDao
replaceAttachmentData in interface AttachmentDaoattachment - Attachment the data belongs toattachmentData - the data to savepublic AttachmentDao.AttachmentMigrator getMigrator(AttachmentDao destinationDao)
AttachmentDao
getMigrator in interface AttachmentDaodestinationDao - dao to move attachments to
public AttachmentDao.AttachmentCopier getCopier(AttachmentDao destinationDao)
AttachmentDao
getCopier in interface AttachmentDaodestinationDao - dao to copy attachments to
public void prepareForMigrationTo()
AttachmentDao
prepareForMigrationTo in interface AttachmentDaopublic void afterMigrationFrom()
AttachmentDao
afterMigrationFrom in interface AttachmentDaopublic List<Attachment> findAllVersions(Attachment attachment)
findAllVersions in interface AttachmentDao
public Attachment getAttachment(ContentEntityObject content,
String fileName,
int version)
AttachmentDaoAttachmentManager.getAttachment(ContentEntityObject, String, int), this method does not accept zero as a special
flag to indicate the latest version of an attachment. To retrieve the latest version
of an attachment, use AttachmentDao.getLatestAttachment(ContentEntityObject, String).
getAttachment in interface AttachmentDaocontent - the content to find the attachment onfileName - the file name of the attachment, treated case-insensitivelyversion - the version of the attachment
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||