public class HibernateAttachmentDataDao extends HibernateObjectDao implements TransactionalAttachmentDataDao
As a result, it is transactional (can be rolled back), so it implements the TransactionalAttachmentDataDao interface.
HibernateObjectDao.Cacheability| Constructor and Description |
|---|
HibernateAttachmentDataDao() |
| Modifier and Type | Method and Description |
|---|---|
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.
|
@NonNull List |
findAll()
Find all objects of the class provided by getPersistentClass()
|
@NonNull List |
findAllSorted(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.
|
InputStream |
getDataForAttachment(Attachment attachment)
Grabs the AttachmentData object for an Attachment
|
AttachmentDataStream |
getDataForAttachment(Attachment attachment,
AttachmentDataStreamType dataStreamType)
Grabs the AttachmentData object for an Attachment
|
AttachmentDataStream |
getDataForAttachment(Attachment attachment,
AttachmentDataStreamType dataStreamType,
Optional<RangeRequest> range)
Grabs the AttachmentData object for an Attachment
|
Class |
getPersistentClass()
Gets the type of
EntityObject this Dao works with. |
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 |
removeDataForAttachmentVersion(Attachment attachmentVersion,
ContentEntityObject originalContent,
AttachmentDataStreamType dataStreamType)
Removes the attachment data of the specific stream type for the given attachment version.
|
void |
replaceDataForAttachment(Attachment attachment,
AttachmentDataStream dataStream)
Sets the data for attachment
|
void |
replaceDataForAttachment(Attachment attachment,
InputStream data)
Sets the data for attachment
|
void |
save(com.atlassian.core.bean.EntityObject objectToSave)
Save an object.
|
void |
saveDataForAttachment(Attachment attachment,
AttachmentDataStream dataStream)
Saves data to the attachment data store
|
void |
saveDataForAttachment(Attachment attachment,
InputStream data)
Saves data to the attachment data store
|
void |
saveDataForAttachmentVersion(Attachment attachment,
Attachment previousVersion,
AttachmentDataStream dataStream)
Saves data to the attachment data store, for an attachment
that has been updated.
|
void |
saveDataForAttachmentVersion(Attachment attachment,
Attachment previousVersion,
InputStream data)
Saves data to the attachment data store, for an attachment
that has been updated.
|
applyTransactionTimeout, applyTransactionTimeout, checkDaoConfig, createHibernateTemplate, findAllSorted, findByClassIds, findByClassIdsFiltered, findNamedQuery, findNamedQuery, findNamedQuery, findNamedQueryStringParam, findNamedQueryStringParam, findNamedQueryStringParam, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findSingleObject, getByClassId, getCountResult, getHibernateTemplate, getSession, getSessionFactory, index, indexEntity, refresh, refreshEntity, reIndex, reIndexEntity, remove, removeEntity, replicate, replicateEntity, saveEntity, saveRaw, saveRawEntity, setEventPublisher, setHibernateTemplate, setIndexer, setSessionFactory, unIndex, unIndexEntity, uniqueResult, updateEntityModificationData, updateModificationDatapublic @NonNull List findAll()
HibernateObjectDaofindAll in interface ObjectDaofindAll in interface ObjectDaoInternalfindAll in class HibernateObjectDaopublic @NonNull List findAllSorted(String s)
ObjectDaoInternalfindAllSorted in interface ObjectDaofindAllSorted in interface ObjectDaoInternalfindAllSorted 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)
HibernateObjectDaosave in interface ObjectDaosave in interface ObjectDaoInternalsave in class HibernateObjectDaoobjectToSave - the object to savepublic Class getPersistentClass()
ObjectDaoInternalEntityObject this Dao works with.getPersistentClass in interface ObjectDaogetPersistentClass in interface ObjectDaoInternalprotected AttachmentData getAttachmentDataForAttachment(Attachment attachment) throws AttachmentDataNotFoundException
attachment - the attachment to retrieve data forAttachmentDataNotFoundException - if the attachment data is not foundorg.springframework.dao.IncorrectResultSizeDataAccessException - if the database contains more than one data
object associated with the given attachmentpublic InputStream getDataForAttachment(Attachment attachment) throws AttachmentDataNotFoundException
AttachmentDataDaogetDataForAttachment in interface AttachmentDataDaoattachment - the Attachment representing the dataAttachmentDataNotFoundException - if no data was foundpublic void removeDataForAttachment(Attachment attachment, ContentEntityObject originalContent)
AttachmentDataDaoremoveDataForAttachment in interface AttachmentDataDaoattachment - the latest version of the attachment for which the data should be removedoriginalContent - the content the attachment belongs topublic void removeDataForAttachmentVersion(Attachment attachment, ContentEntityObject originalContent)
AttachmentDataDaoremoveDataForAttachmentVersion in interface AttachmentDataDaoattachment - the version of the attachment for which the data should be removedoriginalContent - the content the attachment belongs topublic void removeDataForAttachmentVersion(Attachment attachmentVersion, ContentEntityObject originalContent, AttachmentDataStreamType dataStreamType)
AttachmentDataDaoremoveDataForAttachmentVersion in interface AttachmentDataDaoattachmentVersion - the version of the attachment for which the data should be removedoriginalContent - the content the attachment belongs todataStreamType - the data stream typepublic 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, InputStream data)
AttachmentDataDaosaveDataForAttachment in interface AttachmentDataDaoattachment - the Attachment the data belongs todata - the InputStream to be writtenpublic void saveDataForAttachmentVersion(Attachment attachment, Attachment previousVersion, InputStream data)
AttachmentDataDaoThis method assumes that the attachment has already been saved.
saveDataForAttachmentVersion in interface AttachmentDataDaoattachment - the new version of the attachmentpreviousVersion - the previous version of the attachmentdata - the InputStream representing the datapublic void replaceDataForAttachment(Attachment attachment, InputStream data)
AttachmentDataDaoThis method will overwrite any existing data for the attachment.
replaceDataForAttachment in interface AttachmentDataDaoattachment - Attachment the data belongs todata - the data to be savedpublic boolean isAttachmentPresent(Attachment attachment)
AttachmentDataDaoisAttachmentPresent in interface AttachmentDataDaoattachment - the Attachment to be checkedpublic void moveAttachment(Attachment attachment, Attachment oldAttachment, ContentEntityObject newContent)
AttachmentDataDaomoveAttachment 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 AttachmentDataDaopublic AttachmentDataStream getDataForAttachment(Attachment attachment, AttachmentDataStreamType dataStreamType) throws AttachmentDataNotFoundException
AttachmentDataDaogetDataForAttachment in interface AttachmentDataDaoattachment - the Attachment representing the dataAttachmentDataNotFoundException - if no data was foundpublic AttachmentDataStream getDataForAttachment(Attachment attachment, AttachmentDataStreamType dataStreamType, Optional<RangeRequest> range) throws AttachmentDataNotFoundException
AttachmentDataDaogetDataForAttachment in interface AttachmentDataDaoattachment - the Attachment representing the datadataStreamType - the stream type of attachmentrange - the range of attachment dataAttachmentDataNotFoundException - if no data was foundpublic void saveDataForAttachment(Attachment attachment, AttachmentDataStream dataStream)
AttachmentDataDaosaveDataForAttachment in interface AttachmentDataDaoattachment - the Attachment the data belongs todataStream - the data stream to be writtenpublic void saveDataForAttachmentVersion(Attachment attachment, Attachment previousVersion, AttachmentDataStream dataStream)
AttachmentDataDaoThis method assumes that the attachment has already been saved.
saveDataForAttachmentVersion in interface AttachmentDataDaoattachment - the new version of the attachmentpreviousVersion - the previous version of the attachmentdataStream - the InputStream representing the datapublic void replaceDataForAttachment(Attachment attachment, AttachmentDataStream dataStream)
AttachmentDataDaoThis method will overwrite any existing data for the attachment.
replaceDataForAttachment in interface AttachmentDataDaoattachment - Attachment the data belongs todataStream - the data to be savedCopyright © 2003–2022 Atlassian. All rights reserved.