|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface AttachmentDao
This interface defines the methods for classes acting as a DAO at the level of meta-data storage for Attachments.
Nested Class Summary | |
---|---|
static interface |
AttachmentDao.AttachmentCopier
|
static interface |
AttachmentDao.AttachmentMigrator
|
Method Summary | |
---|---|
void |
afterMigrationFrom()
Perform any tasks necessary after Attachment data has been moved from this data store to another. |
int |
countLatestVersionsOfAttachments(ContentEntityObject content)
|
java.util.List<Attachment> |
findAll()
Retrieves the latest versions of all Attachments Use of this method is discouraged when there are a large amount of Attachments. |
java.util.List<Attachment> |
findAllVersions(Attachment attachment)
|
java.util.Iterator<Attachment> |
findLatestVersionsIterator()
Retrieves the latest versions of all Attachments and returns an Iterator to the results. |
Attachment |
getAttachment(ContentEntityObject content,
java.lang.String fileName,
int version)
Return the attachment on the specified content with the given filename and version. |
java.io.InputStream |
getAttachmentData(Attachment attachment)
Retrieves the InputStream representing the data for attachment |
AttachmentDataStorageType |
getBackingStorageType()
Returns the backing storage type. |
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 |
java.util.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,
java.lang.String fileName)
Return the latest version of the attachment on the specified content with the given filename. |
java.util.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. |
boolean |
isAttachmentPresent(Attachment attachment)
Check that an attachment exists |
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 |
removeAttachmentVersionFromServer(Attachment attachment)
Removes an attachment version |
void |
replaceAttachmentData(Attachment attachment,
java.io.InputStream attachmentData)
Sets the attachment data for attachment This method will overwrite any existing data for the attachment version. |
void |
saveNewAttachment(Attachment attachment,
java.io.InputStream attachmentData)
Saves a new attachment |
void |
saveNewAttachmentVersion(Attachment attachment,
Attachment previousVersion,
java.io.InputStream attachmentData)
Saves a new version of attachment |
Method Detail |
---|
java.util.List<Attachment> getLatestVersionsOfAttachments(ContentEntityObject ceo)
ceo
- the content to look up attachments
countLatestVersionsOfAttachments(com.atlassian.confluence.core.ContentEntityObject)
int countLatestVersionsOfAttachments(ContentEntityObject content)
content
- the content object
getLatestVersionsOfAttachments(com.atlassian.confluence.core.ContentEntityObject)
java.util.List<Attachment> findAll()
findLatestVersionsIterator()
java.util.Iterator<Attachment> findLatestVersionsIterator()
java.io.InputStream getAttachmentData(Attachment attachment) throws AttachmentDataNotFoundException
attachment
- the attachment whose data will be returned
AttachmentDataNotFoundException
- if the data could not be foundvoid saveNewAttachment(Attachment attachment, java.io.InputStream attachmentData)
attachment
- the Attachment to be savedattachmentData
- the attachment data to be savedvoid saveNewAttachmentVersion(Attachment attachment, Attachment previousVersion, java.io.InputStream attachmentData)
attachment
- the Attachment to be savedpreviousVersion
- the previous version of the AttachmentattachmentData
- the attachment data to be savedboolean isAttachmentPresent(Attachment attachment)
attachment
- the Attachment to be checkedvoid moveAttachment(Attachment attachment, Attachment oldAttachment, ContentEntityObject newContent)
attachment
- the Attachment to be movedoldAttachment
- the Attachment before it has been updatednewContent
- the new content attachment belongs to
java.lang.IllegalArgumentException
- if attachment is not the latest versionvoid removeAttachmentFromServer(Attachment attachment)
attachment
- the Attachment to be removedvoid removeAttachmentVersionFromServer(Attachment attachment)
attachment
- the Attachment version to be removedvoid replaceAttachmentData(Attachment attachment, java.io.InputStream attachmentData)
attachment
- Attachment the data belongs toattachmentData
- the data to saveAttachmentDao.AttachmentMigrator getMigrator(AttachmentDao destinationDao)
destinationDao
- dao to move attachments to
AttachmentDao.AttachmentCopier getCopier(AttachmentDao destinationDao)
destinationDao
- dao to copy attachments to
void prepareForMigrationTo()
java.lang.RuntimeException
- if there was a problemvoid afterMigrationFrom()
java.lang.RuntimeException
- if there was a problemjava.util.List<Attachment> findAllVersions(Attachment attachment)
Attachment getById(long id)
id
- the persistent ID of the attachment to retrieve
Attachment getAttachment(ContentEntityObject content, java.lang.String fileName, int version) throws java.lang.IllegalArgumentException
AttachmentManager.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 getLatestAttachment(ContentEntityObject, String)
.
content
- the content to find the attachment onfileName
- the file name of the attachment, treated case-insensitivelyversion
- the version of the attachment
java.lang.IllegalArgumentException
- if the content or fileName is nullAttachment getLatestAttachment(ContentEntityObject content, java.lang.String fileName) throws java.lang.IllegalArgumentException
content
- the content to find the attachment onfileName
- the file name of the attachment
java.lang.IllegalArgumentException
- if the content or fileName is nulljava.util.List<Attachment> getLastAddedVersionsOf(Attachment attachment)
attachment
- attachment (must be the latest version)
java.lang.IllegalArgumentException
- if the attachment is not the latest version or nullAttachmentDataStorageType getBackingStorageType()
AttachmentDataDao.getStorageType()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |