|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.dao.support.DaoSupport org.springframework.orm.hibernate.support.HibernateDaoSupport com.atlassian.hibernate.HibernateObjectDao com.atlassian.confluence.core.persistence.hibernate.VersionedHibernateObjectDao com.atlassian.confluence.pages.persistence.dao.hibernate.AbstractHibernateAttachmentDao
public abstract class AbstractHibernateAttachmentDao
Abstract class that defines the basic methods necessary for saving Attachments to a database.
The location of the storage of attachment data is dependent on the AttachmentDataDao set for this class. In some cases, since the removal of attachments is destructive, different implementations may wish to perform the removal of data in a different order. Subclasses will have to implement the #removeDataForAttachment(Attachment attachment) method.
Nested Class Summary | |
---|---|
class |
AbstractHibernateAttachmentDao.IntraHibernateAttachmentCopier
This attachment copier will copy attachment streams from the current instance of AbstractHibernateAttachmentDao to another. |
class |
AbstractHibernateAttachmentDao.IntraHibernateAttachmentMigrator
This attachment migrator will migrate attachment streams from the current instance of AbstractHibernateAttachmentDao to another. |
Nested classes/interfaces inherited from interface com.atlassian.confluence.pages.persistence.dao.AttachmentDao |
---|
AttachmentDao.AttachmentCopier, AttachmentDao.AttachmentMigrator |
Field Summary | |
---|---|
protected AttachmentDataDao |
dataDao
|
static long |
ONE_DAY
|
Fields inherited from class com.atlassian.confluence.core.persistence.hibernate.VersionedHibernateObjectDao |
---|
cacheFactory, log |
Fields inherited from class org.springframework.dao.support.DaoSupport |
---|
logger |
Constructor Summary | |
---|---|
AbstractHibernateAttachmentDao()
|
Method Summary | |
---|---|
void |
afterMigrationFrom()
This implementation removes all Attachments and passes the migration tasks onto the AttachmentDataDao |
java.util.List |
findAllVersions(Attachment attachment)
|
void |
flush()
This implementation flushes the Hibernate session. |
java.util.List |
getAttachmentByQuery(ListQuery listQuery,
int firstResult)
Deprecated. since 2.8, use com.atlassian.confluence.search.smartlist.SmartListManager#search instead. |
java.io.InputStream |
getAttachmentData(Attachment attachment)
Retrieves the InputStream representing the data for attachment |
AttachmentDao.AttachmentCopier |
getCopier(AttachmentDao destinationDao)
Get a copier object to copy attachments between data stores The source data store will remain untouched |
AttachmentDataDao |
getDataDao()
|
static AttachmentDao |
getInstance(AttachmentDataDao attachmentDataDao)
Returns the correct instance of AttachmentDao for the AttachmentDataDao that is given. |
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. |
java.lang.Class |
getPersistentClass()
|
void |
moveAttachment(Attachment latestVersion,
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()
This implementation removes the contents of the table and passes the migration tasks onto the AttachmentDataDao |
protected void |
removeAttachment(Attachment attachment,
ContentEntityObject content)
Severs the connection between attachment and content, and removes the attachment from the database |
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)
This implementation saves the Attachment and its previous version to the VersionedHibernateObjectDao. |
Methods inherited from class com.atlassian.confluence.core.persistence.hibernate.VersionedHibernateObjectDao |
---|
findAllSorted, findLatestVersionsCount, findLatestVersionsIterator, save, setCacheFactory, updateModificationData |
Methods inherited from class com.atlassian.hibernate.HibernateObjectDao |
---|
findAll, findNamedQuery, findNamedQuery, findNamedQuery, findNamedQueryStringParam, findNamedQueryStringParam, findNamedQueryStringParam, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findSingleObject, getByClassId, index, refresh, reIndex, remove, replicate, save, saveRaw, setIndexer, unIndex |
Methods inherited from class org.springframework.orm.hibernate.support.HibernateDaoSupport |
---|
checkDaoConfig, convertHibernateAccessException, createHibernateTemplate, getHibernateTemplate, getSession, getSession, getSessionFactory, releaseSession, setHibernateTemplate, setSessionFactory |
Methods inherited from class org.springframework.dao.support.DaoSupport |
---|
afterPropertiesSet, initDao |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.atlassian.confluence.pages.persistence.dao.AttachmentDao |
---|
findAll, findLatestVersionsIterator, removeAttachmentFromServer |
Methods inherited from interface bucket.core.persistence.ObjectDao |
---|
findAll, refresh, remove, replicate, save, saveRaw |
Field Detail |
---|
public static final long ONE_DAY
protected AttachmentDataDao dataDao
Constructor Detail |
---|
public AbstractHibernateAttachmentDao()
Method Detail |
---|
public AttachmentDataDao getDataDao()
public static AttachmentDao getInstance(AttachmentDataDao attachmentDataDao)
attachmentDataDao
- the AttachmentDataDao that should be used
java.lang.IllegalArgumentException
- if dataDao is not supportedpublic java.lang.Class getPersistentClass()
getPersistentClass
in interface bucket.core.persistence.ObjectDao
public java.util.List<Attachment> getLatestVersionsOfAttachments(ContentEntityObject ceo)
AttachmentDao
getLatestVersionsOfAttachments
in interface AttachmentDao
ceo
- the content to look up attachments
public java.util.List findAllVersions(Attachment attachment)
findAllVersions
in interface AttachmentDao
public java.io.InputStream getAttachmentData(Attachment attachment) throws AttachmentDataNotFoundException
AttachmentDao
getAttachmentData
in interface AttachmentDao
AttachmentDataNotFoundException
- if the data could not be foundpublic java.util.List getAttachmentByQuery(ListQuery listQuery, int firstResult)
getAttachmentByQuery
in interface AttachmentDao
public void saveNewAttachment(Attachment attachment, java.io.InputStream attachmentData)
AttachmentDao
saveNewAttachment
in interface AttachmentDao
attachment
- the Attachment to be savedattachmentData
- the attachment data to be savedpublic void saveNewAttachmentVersion(Attachment attachment, Attachment previousVersion, java.io.InputStream attachmentData)
saveNewAttachmentVersion
in interface AttachmentDao
attachment
- previousVersion
- attachmentData
- public void moveAttachment(Attachment latestVersion, Attachment oldAttachment, ContentEntityObject newContent)
AttachmentDao
moveAttachment
in interface AttachmentDao
latestVersion
- the Attachment to be movedoldAttachment
- the Attachment before it has been updatednewContent
- the new content attachment belongs toprotected void removeAttachment(Attachment attachment, ContentEntityObject content)
attachment
- content
- public AttachmentDao.AttachmentMigrator getMigrator(AttachmentDao destinationDao)
AttachmentDao
getMigrator
in interface AttachmentDao
destinationDao
- dao to move attachments to
public AttachmentDao.AttachmentCopier getCopier(AttachmentDao destinationDao)
AttachmentDao
getCopier
in interface AttachmentDao
destinationDao
- dao to copy attachments to
public void prepareForMigrationTo()
prepareForMigrationTo
in interface AttachmentDao
public void afterMigrationFrom()
afterMigrationFrom
in interface AttachmentDao
public void replaceAttachmentData(Attachment attachment, java.io.InputStream attachmentData)
AttachmentDao
replaceAttachmentData
in interface AttachmentDao
attachment
- Attachment the data belongs toattachmentData
- the data to savepublic void flush()
flush
in interface CachingAttachmentDao
java.lang.RuntimeException
- if there was a problem flushing
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |