|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.springframework.dao.support.DaoSupport
org.springframework.orm.hibernate.support.HibernateDaoSupport
com.atlassian.hibernate.HibernateObjectDao
com.atlassian.confluence.pages.persistence.dao.hibernate.HibernateAttachmentDataDao
public class HibernateAttachmentDataDao
This class defines an AttachmentDataDao that stores Attachment data in a Hibernate-managed database.
As a result, it is transactional (can be rolled back), so it implements the TransactionalAttachmentDataDao interface.
| Field Summary |
|---|
| Fields inherited from class org.springframework.dao.support.DaoSupport |
|---|
logger |
| Constructor Summary | |
|---|---|
HibernateAttachmentDataDao()
|
|
| Method Summary | |
|---|---|
void |
afterMigrationFrom()
Once a data migration has occurred, remove all records from the table, as they are no longer necessary, and we don't want foreign key violations to occur when removing Attachments. |
java.util.List |
findAll()
Find all objects of the class provided by getPersistentClass() |
java.util.List |
findAllSorted(java.lang.String s)
Find all objects currently persisted of a particular type and sort results by named property. |
protected AttachmentData |
getAttachmentDataForAttachment(Attachment attachment)
Retrieves the attachment data object for a given attachment. |
java.io.InputStream |
getDataForAttachment(Attachment attachment)
Grabs the AttachmentData object for an Attachment |
java.lang.Class |
getPersistentClass()
|
AttachmentDataStorageType |
getStorageType()
Returns the storage type. |
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 |
void |
moveDataForAttachmentVersion(Attachment sourceAttachmentVersion,
Attachment targetAttachmentVersion)
Moves the attachment data from one AbstractVersionedEntityObject.getVersion() to the other. |
void |
prepareForMigrationTo()
This implementation clears out the Attachment data table, so we have a clean base for migration. |
void |
removeDataForAttachment(Attachment attachment,
ContentEntityObject originalContent)
Removes all attachment data for the given attachment. |
void |
removeDataForAttachmentVersion(Attachment attachment,
ContentEntityObject originalContent)
Removes the attachment data for the given attachment version. |
void |
replaceDataForAttachment(Attachment attachment,
java.io.InputStream data)
Sets the data for attachment This method will overwrite any existing data for the attachment. |
void |
save(com.atlassian.core.bean.EntityObject objectToSave)
Save an object. |
void |
saveDataForAttachment(Attachment attachment,
java.io.InputStream data)
Saves data to the attachment data store |
void |
saveDataForAttachmentVersion(Attachment attachment,
Attachment previousVersion,
java.io.InputStream data)
Saves data to the attachment data store, for an attachment that has been updated. |
| 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 |
| Constructor Detail |
|---|
public HibernateAttachmentDataDao()
| Method Detail |
|---|
public java.util.List findAll()
HibernateObjectDao
findAll in interface ObjectDaofindAll in class HibernateObjectDaopublic java.util.List findAllSorted(java.lang.String s)
ObjectDao
findAllSorted in interface ObjectDaofindAllSorted in class HibernateObjectDaos - the name of the property to be sorted on. This should be null if no sorting is required.public void save(com.atlassian.core.bean.EntityObject objectToSave)
HibernateObjectDao
save in interface ObjectDaosave in class HibernateObjectDaopublic java.lang.Class getPersistentClass()
getPersistentClass in interface ObjectDao
protected AttachmentData getAttachmentDataForAttachment(Attachment attachment)
throws AttachmentDataNotFoundException
attachment - the attachment to retrieve data for
AttachmentDataNotFoundException - if the attachment data is not found
org.springframework.dao.IncorrectResultSizeDataAccessException - if the database contains more than one data
object associated with the given attachment
public java.io.InputStream getDataForAttachment(Attachment attachment)
throws AttachmentDataNotFoundException
AttachmentDataDao
getDataForAttachment in interface AttachmentDataDaoattachment - the Attachment representing the data
AttachmentDataNotFoundException - if no data was found
public void removeDataForAttachment(Attachment attachment,
ContentEntityObject originalContent)
AttachmentDataDao
removeDataForAttachment in interface AttachmentDataDaoattachment - the latest version of the attachment for which the data should be removedoriginalContent - the content the attachment belongs to
public void removeDataForAttachmentVersion(Attachment attachment,
ContentEntityObject originalContent)
AttachmentDataDao
removeDataForAttachmentVersion in interface AttachmentDataDaoattachment - the version of the attachment for which the data should be removedoriginalContent - the content the attachment belongs to
public void moveDataForAttachmentVersion(Attachment sourceAttachmentVersion,
Attachment targetAttachmentVersion)
AttachmentDataDaoAbstractVersionedEntityObject.getVersion() to the other.
This method will overwrite any existing data for the target attachment version.
moveDataForAttachmentVersion in interface AttachmentDataDaosourceAttachmentVersion - the attachmentAttachmentDataDao.moveAttachment(Attachment, Attachment, ContentEntityObject)
public void saveDataForAttachment(Attachment attachment,
java.io.InputStream data)
AttachmentDataDao
saveDataForAttachment in interface AttachmentDataDaoattachment - the Attachment the data belongs todata - the InputStream to be written
public void saveDataForAttachmentVersion(Attachment attachment,
Attachment previousVersion,
java.io.InputStream data)
AttachmentDataDao
saveDataForAttachmentVersion in interface AttachmentDataDaoattachment - the new version of the attachmentpreviousVersion - the previous version of the attachmentdata - the InputStream representing the data
public void replaceDataForAttachment(Attachment attachment,
java.io.InputStream data)
AttachmentDataDao
replaceDataForAttachment in interface AttachmentDataDaoattachment - Attachment the data belongs todata - the data to be savedpublic boolean isAttachmentPresent(Attachment attachment)
AttachmentDataDao
isAttachmentPresent in interface AttachmentDataDaoattachment - the Attachment to be checked
public void moveAttachment(Attachment attachment,
Attachment oldAttachment,
ContentEntityObject newContent)
AttachmentDataDao
moveAttachment in interface AttachmentDataDaoattachment - the Attachment to be movedoldAttachment - the original version of the attachmentnewContent - the new content the Attachment belongs topublic void prepareForMigrationTo()
prepareForMigrationTo in interface AttachmentDataDaopublic void afterMigrationFrom()
afterMigrationFrom in interface AttachmentDataDaopublic AttachmentDataStorageType getStorageType()
AttachmentDataDaoThe client code should be storage agnostic in general. Thus this method should only be used in rare cases in order to hide operations which are known to be not implemented for the specific type.
getStorageType in interface AttachmentDataDao
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||