@Deprecated public class WebDavAttachmentDao extends Object implements AttachmentDao
This class handles authentication and communication with a WebDAV server when it is being used for Attachment storage.
This implementation is different to the default (AbstractHibernateAttachmentDao), as it does not store the Attachment data in the Hibernate-managed Confluence database. Instead, we construct the Attachment information from the properties stored by the WebDAV server. While this may result in decreased performance, it allows the WebDAV server to be accessed independently of Confluence and attachments changes to be reflected in Confluence.
AttachmentDao.AttachmentCopier, AttachmentDao.AttachmentMigrator
Constructor and Description |
---|
WebDavAttachmentDao()
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
void |
afterMigrationFrom()
Deprecated.
The contents of the WebDAV store may be used by other applications
or users, so we do not clean it out after migrating away from it.
|
int |
countLatestVersionsOfAttachments(ContentEntityObject ceo)
Deprecated.
|
List<Attachment> |
findAll()
Deprecated.
Retrieves the latest versions of all Attachments
Use of this method is discouraged when there are a
large amount of Attachments.
|
List |
findAllVersions(Attachment attachment)
Deprecated.
|
Iterator<Attachment> |
findLatestVersionsIterator()
Deprecated.
This implementation is technically dodgy.
|
Attachment |
getAttachment(ContentEntityObject content,
String fileName,
int version)
Deprecated.
Return the attachment on the specified content with the given filename and version.
|
InputStream |
getAttachmentData(Attachment attachment)
Deprecated.
Retrieves the InputStream representing the data for attachment
|
AttachmentDataStorageType |
getBackingStorageType()
Deprecated.
Returns the backing storage type.
|
Attachment |
getById(long id)
Deprecated.
Returns the attachment with the given persistent ID.
|
List<Attachment> |
getByIds(List<Long> ids)
Deprecated.
Returns a list of attachments matching the given list of IDs.
|
AttachmentDao.AttachmentCopier |
getCopier(AttachmentDao destinationDao)
Deprecated.
This method is not supported by the implementation.
|
List<Attachment> |
getLastAddedVersionsOf(Attachment attachment)
Deprecated.
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)
Deprecated.
Return the latest version of the attachment on the specified content with the given filename.
|
List<Attachment> |
getLatestVersionsOfAttachments(ContentEntityObject ceo)
Deprecated.
Retrieves the latest versions of all attachments to ceo
|
PageResponse<Attachment> |
getLatestVersionsOfAttachments(ContentEntityObject ceo,
LimitedRequest pageRequest,
com.google.common.base.Predicate<? super Attachment> predicate)
Deprecated.
Retrieves a paginated list of the latest version of attachments to the ceo filtered by the predicate
|
AttachmentDao.AttachmentMigrator |
getMigrator(AttachmentDao destinationDao)
Deprecated.
This method is not supported by the implementation.
|
Map<Long,Long> |
getRemappedAttachmentIds()
Deprecated.
Gets a list of remapped attachment IDs.
|
boolean |
isAttachmentPresent(Attachment attachment)
Deprecated.
Check that an attachment exists
|
void |
moveAttachment(Attachment attachment,
Attachment oldAttachment,
ContentEntityObject newContent)
Deprecated.
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()
Deprecated.
In this implementation, there may be existing files on the
WebDAV store, so no deletion will occur.
|
void |
removeAttachmentFromServer(Attachment attachment)
Deprecated.
todo: Should i remove the files from the webdav server?! should i remove the parent folder when folder's empty?
|
void |
removeAttachmentVersionFromServer(Attachment attachment)
Deprecated.
Removes an attachment version
|
void |
renameAttachment(Attachment attachment,
String newName)
Deprecated.
|
void |
replaceAttachmentData(Attachment attachment,
InputStream attachmentData)
Deprecated.
Technically, this method is supposed to overwrite existing data
without incrementing the version, due to the nature of WebDAV,
we can't avoid that.
|
void |
saveNewAttachment(Attachment attachment,
InputStream attachmentData)
Deprecated.
This implementation saves a new Attachment to the appropriate path.
|
void |
saveNewAttachmentVersion(Attachment attachment,
Attachment previousVersion,
InputStream attachmentData)
Deprecated.
Saves a new version of attachment
|
void |
setConfig(WebDavConfiguration config)
Deprecated.
|
void |
setContentEntityObjectDao(ContentEntityObjectDao contentEntityObjectDao)
Deprecated.
|
void |
updateAttachment(Attachment attachment)
Deprecated.
Update an existing attachment without creating a new version
|
public void setConfig(WebDavConfiguration config)
public List<Attachment> getLatestVersionsOfAttachments(ContentEntityObject ceo)
AttachmentDao
getLatestVersionsOfAttachments
in interface AttachmentDao
ceo
- the content to look up attachmentsAttachmentDao.countLatestVersionsOfAttachments(com.atlassian.confluence.core.ContentEntityObject)
public PageResponse<Attachment> getLatestVersionsOfAttachments(ContentEntityObject ceo, LimitedRequest pageRequest, com.google.common.base.Predicate<? super Attachment> predicate)
AttachmentDao
getLatestVersionsOfAttachments
in interface AttachmentDao
ceo
- the content to find attachments onpageRequest
- the pagination requestpredicate
- a predicate to filter the results bypublic int countLatestVersionsOfAttachments(ContentEntityObject ceo)
countLatestVersionsOfAttachments
in interface AttachmentDao
ceo
- the content objectAttachmentDao.getLatestVersionsOfAttachments(com.atlassian.confluence.core.ContentEntityObject)
public List<Attachment> findAll()
AttachmentDao
findAll
in interface AttachmentDao
AttachmentDao.findLatestVersionsIterator()
public Iterator<Attachment> findLatestVersionsIterator()
findLatestVersionsIterator
in interface AttachmentDao
public InputStream getAttachmentData(Attachment attachment) throws AttachmentDataNotFoundException
AttachmentDao
getAttachmentData
in interface AttachmentDao
attachment
- the attachment whose data will be returnedAttachmentDataNotFoundException
- if the data could not be foundpublic void saveNewAttachment(Attachment attachment, InputStream attachmentData)
saveNewAttachment
in interface AttachmentDao
attachment
- the Attachment to saveattachmentData
- the data to save for the Attachmentpublic void saveNewAttachmentVersion(Attachment attachment, Attachment previousVersion, InputStream attachmentData)
AttachmentDao
saveNewAttachmentVersion
in interface AttachmentDao
attachment
- the Attachment to be savedpreviousVersion
- the previous version of the AttachmentattachmentData
- the attachment data to be savedpublic boolean isAttachmentPresent(Attachment attachment)
AttachmentDao
isAttachmentPresent
in interface AttachmentDao
attachment
- the Attachment to be checkedpublic void moveAttachment(Attachment attachment, Attachment oldAttachment, ContentEntityObject newContent)
AttachmentDao
moveAttachment
in interface AttachmentDao
attachment
- the Attachment to be movedoldAttachment
- the Attachment before it has been updatednewContent
- the new content attachment belongs topublic void removeAttachmentFromServer(Attachment attachment)
removeAttachmentFromServer
in interface AttachmentDao
attachment
- the Attachment to be removedpublic void removeAttachmentVersionFromServer(Attachment attachment)
AttachmentDao
removeAttachmentVersionFromServer
in interface AttachmentDao
attachment
- the Attachment version to be removedpublic void replaceAttachmentData(Attachment attachment, InputStream attachmentData)
replaceAttachmentData
in interface AttachmentDao
attachment
- the Attachment to replace the dataattachmentData
- the data to writepublic AttachmentDao.AttachmentMigrator getMigrator(AttachmentDao destinationDao)
getMigrator
in interface AttachmentDao
destinationDao
- the destination AttachmentDAOGeneralAttachmentMigrator
public AttachmentDao.AttachmentCopier getCopier(AttachmentDao destinationDao)
getCopier
in interface AttachmentDao
destinationDao
- the destination AttachmentDAOGeneralAttachmentCopier
public void updateAttachment(Attachment attachment)
AttachmentDao
updateAttachment
in interface AttachmentDao
public void prepareForMigrationTo()
prepareForMigrationTo
in interface AttachmentDao
public void afterMigrationFrom()
afterMigrationFrom
in interface AttachmentDao
public Map<Long,Long> getRemappedAttachmentIds()
AttachmentDao
getRemappedAttachmentIds
in interface AttachmentDao
public void renameAttachment(Attachment attachment, String newName) throws IOException
IOException
public void setContentEntityObjectDao(ContentEntityObjectDao contentEntityObjectDao)
public List findAllVersions(Attachment attachment)
findAllVersions
in interface AttachmentDao
public Attachment getAttachment(ContentEntityObject content, String fileName, int version)
AttachmentDao
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 AttachmentDao.getLatestAttachment(ContentEntityObject, String)
.getAttachment
in interface AttachmentDao
content
- the content to find the attachment onfileName
- the file name of the attachment, treated case-insensitivelyversion
- the version of the attachmentpublic Attachment getLatestAttachment(ContentEntityObject content, String fileName)
AttachmentDao
getLatestAttachment
in interface AttachmentDao
content
- the content to find the attachment onfileName
- the file name of the attachmentpublic Attachment getById(long id)
AttachmentDao
getById
in interface AttachmentDao
id
- the persistent ID of the attachment to retrievepublic List<Attachment> getByIds(List<Long> ids)
AttachmentDao
getByIds
in interface AttachmentDao
ids
- list of IDs to retrievepublic List<Attachment> getLastAddedVersionsOf(Attachment attachment)
AttachmentDao
getLastAddedVersionsOf
in interface AttachmentDao
attachment
- attachment (must be the latest version)public AttachmentDataStorageType getBackingStorageType()
AttachmentDao
getBackingStorageType
in interface AttachmentDao
AttachmentDataDao.getStorageType()
Copyright © 2003–2016 Atlassian. All rights reserved.