Class HibernateAttachmentDataDao
- java.lang.Object
-
- org.springframework.dao.support.DaoSupport
-
- com.atlassian.confluence.core.persistence.hibernate.HibernateObjectDao
-
- com.atlassian.confluence.pages.persistence.dao.hibernate.HibernateAttachmentDataDao
-
- All Implemented Interfaces:
ObjectDao,ObjectDaoInternal,AttachmentDataDao,TransactionalAttachmentDataDao,org.springframework.beans.factory.InitializingBean
@Deprecated(forRemoval=true, since="8.8") public class HibernateAttachmentDataDao extends HibernateObjectDao implements TransactionalAttachmentDataDao
Deprecated, for removal: This API element is subject to removal in a future version.since 8.8, no replacementThis 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.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.atlassian.confluence.core.persistence.hibernate.HibernateObjectDao
HibernateObjectDao.Cacheability
-
-
Constructor Summary
Constructors Constructor Description HibernateAttachmentDataDao()Deprecated, for removal: This API element is subject to removal in a future version.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidafterMigrationFrom()Deprecated, for removal: This API element is subject to removal in a future version.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 ListfindAll()Deprecated, for removal: This API element is subject to removal in a future version.Find all objects of the class provided by getPersistentClass()@NonNull ListfindAllSorted(String s)Deprecated, for removal: This API element is subject to removal in a future version.Find all objects currently persisted of a particular type and sort results by named property.protected AttachmentDatagetAttachmentDataForAttachment(Attachment attachment)Deprecated, for removal: This API element is subject to removal in a future version.Retrieves the attachment data object for a given attachment.InputStreamgetDataForAttachment(Attachment attachment)Deprecated, for removal: This API element is subject to removal in a future version.Grabs the AttachmentData object for an AttachmentAttachmentDataStreamgetDataForAttachment(Attachment attachment, AttachmentDataStreamType dataStreamType)Deprecated, for removal: This API element is subject to removal in a future version.Grabs the AttachmentData object for an AttachmentAttachmentDataStreamgetDataForAttachment(Attachment attachment, AttachmentDataStreamType dataStreamType, Optional<RangeRequest> range)Deprecated, for removal: This API element is subject to removal in a future version.Grabs the AttachmentData object for an AttachmentClassgetPersistentClass()Deprecated, for removal: This API element is subject to removal in a future version.Gets the type ofEntityObjectthis Dao works with.AttachmentDataStorageTypegetStorageType()Deprecated, for removal: This API element is subject to removal in a future version.Returns the storage type.booleanisAttachmentPresent(Attachment attachment)Deprecated, for removal: This API element is subject to removal in a future version.Check that an attachment existsvoidmoveAttachment(Attachment attachment, Attachment oldAttachment, ContentEntityObject newContent)Deprecated, for removal: This API element is subject to removal in a future version.Moves an attachment to a new file name or content objectvoidmoveDataForAttachmentVersion(Attachment sourceAttachmentVersion, Attachment targetAttachmentVersion)Deprecated, for removal: This API element is subject to removal in a future version.Moves the attachment data from oneAbstractVersionedEntityObject.getVersion()to the other.voidprepareForMigrationTo()Deprecated, for removal: This API element is subject to removal in a future version.This implementation clears out the Attachment data table, so we have a clean base for migration.voidremoveDataForAttachment(Attachment attachment, ContentEntityObject originalContent)Deprecated, for removal: This API element is subject to removal in a future version.Removes all attachment data for the given attachment.voidremoveDataForAttachmentVersion(Attachment attachment, ContentEntityObject originalContent)Deprecated, for removal: This API element is subject to removal in a future version.Removes the attachment data for the given attachment version.voidremoveDataForAttachmentVersion(Attachment attachmentVersion, ContentEntityObject originalContent, AttachmentDataStreamType dataStreamType)Deprecated, for removal: This API element is subject to removal in a future version.Removes the attachment data of the specific stream type for the given attachment version.voidreplaceDataForAttachment(Attachment attachment, AttachmentDataStream dataStream)Deprecated, for removal: This API element is subject to removal in a future version.Sets the data for attachmentvoidreplaceDataForAttachment(Attachment attachment, InputStream data)Deprecated, for removal: This API element is subject to removal in a future version.Sets the data for attachmentvoidsave(com.atlassian.core.bean.EntityObject objectToSave)Deprecated, for removal: This API element is subject to removal in a future version.Save an object.voidsaveDataForAttachment(Attachment attachment, AttachmentDataStream dataStream)Deprecated, for removal: This API element is subject to removal in a future version.Saves data to the attachment data storevoidsaveDataForAttachment(Attachment attachment, InputStream data)Deprecated, for removal: This API element is subject to removal in a future version.Saves data to the attachment data storevoidsaveDataForAttachmentVersion(Attachment attachment, Attachment previousVersion, AttachmentDataStream dataStream)Deprecated, for removal: This API element is subject to removal in a future version.Saves data to the attachment data store, for an attachment that has been updated.voidsaveDataForAttachmentVersion(Attachment attachment, Attachment previousVersion, InputStream data)Deprecated, for removal: This API element is subject to removal in a future version.Saves data to the attachment data store, for an attachment that has been updated.-
Methods inherited from class com.atlassian.confluence.core.persistence.hibernate.HibernateObjectDao
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, getSessionFactory, index, indexEntity, refresh, refreshEntity, reIndex, reIndexEntity, remove, removeEntity, replicate, replicateEntity, saveEntity, saveRaw, saveRawEntity, setEventPublisher, setHibernateTemplate, setIndexer, setSessionFactory, unIndex, unIndexEntity, uniqueResult, updateEntityModificationData, updateModificationData
-
-
-
-
Method Detail
-
findAll
public @NonNull List findAll()
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from class:HibernateObjectDaoFind all objects of the class provided by getPersistentClass()- Specified by:
findAllin interfaceObjectDao- Specified by:
findAllin interfaceObjectDaoInternal- Overrides:
findAllin classHibernateObjectDao- Returns:
- a list of all objects of the appropriate class, or the empty list if no objects are found
-
findAllSorted
public @NonNull List findAllSorted(String s)
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:ObjectDaoInternalFind all objects currently persisted of a particular type and sort results by named property.- Specified by:
findAllSortedin interfaceObjectDao- Specified by:
findAllSortedin interfaceObjectDaoInternal- Overrides:
findAllSortedin classHibernateObjectDao- Parameters:
s- the name of the property to be sorted on. This should be null if no sorting is required.
-
save
public void save(com.atlassian.core.bean.EntityObject objectToSave)
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from class:HibernateObjectDaoSave an object. The object's last-modified time will be updated, and if the object is searchable it will be indexed.- Specified by:
savein interfaceObjectDao- Specified by:
savein interfaceObjectDaoInternal- Overrides:
savein classHibernateObjectDao- Parameters:
objectToSave- the object to save
-
getPersistentClass
public Class getPersistentClass()
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:ObjectDaoInternalGets the type ofEntityObjectthis Dao works with.- Specified by:
getPersistentClassin interfaceObjectDao- Specified by:
getPersistentClassin interfaceObjectDaoInternal- Returns:
- the type
-
getAttachmentDataForAttachment
protected AttachmentData getAttachmentDataForAttachment(Attachment attachment) throws AttachmentDataNotFoundException
Deprecated, for removal: This API element is subject to removal in a future version.Retrieves the attachment data object for a given attachment.- Parameters:
attachment- the attachment to retrieve data for- Returns:
- attachment data for the provided attachment
- Throws:
AttachmentDataNotFoundException- if the attachment data is not foundorg.springframework.dao.IncorrectResultSizeDataAccessException- if the database contains more than one data object associated with the given attachment
-
getDataForAttachment
public InputStream getDataForAttachment(Attachment attachment) throws AttachmentDataNotFoundException
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:AttachmentDataDaoGrabs the AttachmentData object for an Attachment- Specified by:
getDataForAttachmentin interfaceAttachmentDataDao- Parameters:
attachment- the Attachment representing the data- Returns:
- an AttachmentData object
- Throws:
AttachmentDataNotFoundException- if no data was found
-
removeDataForAttachment
public void removeDataForAttachment(Attachment attachment, ContentEntityObject originalContent)
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:AttachmentDataDaoRemoves all attachment data for the given attachment. Since Confluence 4.2 the contract of this method has been clarified. It now removes all versions of the given attachment.- Specified by:
removeDataForAttachmentin interfaceAttachmentDataDao- Parameters:
attachment- the latest version of the attachment for which the data should be removedoriginalContent- the content the attachment belongs to
-
removeDataForAttachmentVersion
public void removeDataForAttachmentVersion(Attachment attachment, ContentEntityObject originalContent)
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:AttachmentDataDaoRemoves the attachment data for the given attachment version.- Specified by:
removeDataForAttachmentVersionin interfaceAttachmentDataDao- Parameters:
attachment- the version of the attachment for which the data should be removedoriginalContent- the content the attachment belongs to
-
removeDataForAttachmentVersion
public void removeDataForAttachmentVersion(Attachment attachmentVersion, ContentEntityObject originalContent, AttachmentDataStreamType dataStreamType)
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:AttachmentDataDaoRemoves the attachment data of the specific stream type for the given attachment version.- Specified by:
removeDataForAttachmentVersionin interfaceAttachmentDataDao- Parameters:
attachmentVersion- the version of the attachment for which the data should be removedoriginalContent- the content the attachment belongs todataStreamType- the data stream type
-
moveDataForAttachmentVersion
public void moveDataForAttachmentVersion(Attachment sourceAttachmentVersion, Attachment targetAttachmentVersion)
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:AttachmentDataDaoMoves the attachment data from oneAbstractVersionedEntityObject.getVersion()to the other.This method will overwrite any existing data for the target attachment version.
- Specified by:
moveDataForAttachmentVersionin interfaceAttachmentDataDao- Parameters:
sourceAttachmentVersion- the attachment- See Also:
AttachmentDataDao.moveAttachment(Attachment, Attachment, ContentEntityObject)
-
saveDataForAttachment
public void saveDataForAttachment(Attachment attachment, InputStream data)
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:AttachmentDataDaoSaves data to the attachment data store- Specified by:
saveDataForAttachmentin interfaceAttachmentDataDao- Parameters:
attachment- the Attachment the data belongs todata- the InputStream to be written
-
saveDataForAttachmentVersion
public void saveDataForAttachmentVersion(Attachment attachment, Attachment previousVersion, InputStream data)
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:AttachmentDataDaoSaves data to the attachment data store, for an attachment that has been updated.This method assumes that the attachment has already been saved.
- Specified by:
saveDataForAttachmentVersionin interfaceAttachmentDataDao- Parameters:
attachment- the new version of the attachmentpreviousVersion- the previous version of the attachmentdata- the InputStream representing the data
-
replaceDataForAttachment
public void replaceDataForAttachment(Attachment attachment, InputStream data)
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:AttachmentDataDaoSets the data for attachmentThis method will overwrite any existing data for the attachment.
- Specified by:
replaceDataForAttachmentin interfaceAttachmentDataDao- Parameters:
attachment- Attachment the data belongs todata- the data to be saved
-
isAttachmentPresent
public boolean isAttachmentPresent(Attachment attachment)
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:AttachmentDataDaoCheck that an attachment exists- Specified by:
isAttachmentPresentin interfaceAttachmentDataDao- Parameters:
attachment- the Attachment to be checked
-
moveAttachment
public void moveAttachment(Attachment attachment, Attachment oldAttachment, ContentEntityObject newContent)
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:AttachmentDataDaoMoves an attachment to a new file name or content object- Specified by:
moveAttachmentin interfaceAttachmentDataDao- Parameters:
attachment- the Attachment to be movedoldAttachment- the original version of the attachmentnewContent- the new content the Attachment belongs to
-
prepareForMigrationTo
public void prepareForMigrationTo()
Deprecated, for removal: This API element is subject to removal in a future version.This implementation clears out the Attachment data table, so we have a clean base for migration. It circumvents hibernate, so should only be called when nobody else can see the attachment data.- Specified by:
prepareForMigrationToin interfaceAttachmentDataDao
-
afterMigrationFrom
public void afterMigrationFrom()
Deprecated, for removal: This API element is subject to removal in a future version.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. It circumvents hibernate, so should only be called when nobody else can see the data.- Specified by:
afterMigrationFromin interfaceAttachmentDataDao
-
getStorageType
public AttachmentDataStorageType getStorageType()
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:AttachmentDataDaoReturns the storage type.The 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.
- Specified by:
getStorageTypein interfaceAttachmentDataDao- Returns:
- the storage type
-
getDataForAttachment
public AttachmentDataStream getDataForAttachment(Attachment attachment, AttachmentDataStreamType dataStreamType) throws AttachmentDataNotFoundException
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:AttachmentDataDaoGrabs the AttachmentData object for an Attachment- Specified by:
getDataForAttachmentin interfaceAttachmentDataDao- Parameters:
attachment- the Attachment representing the data- Returns:
- an AttachmentData object
- Throws:
AttachmentDataNotFoundException- if no data was found
-
getDataForAttachment
public AttachmentDataStream getDataForAttachment(Attachment attachment, AttachmentDataStreamType dataStreamType, Optional<RangeRequest> range) throws AttachmentDataNotFoundException
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:AttachmentDataDaoGrabs the AttachmentData object for an Attachment- Specified by:
getDataForAttachmentin interfaceAttachmentDataDao- Parameters:
attachment- the Attachment representing the datadataStreamType- the stream type of attachmentrange- the range of attachment data- Returns:
- an AttachmentData object
- Throws:
AttachmentDataNotFoundException- if no data was found
-
saveDataForAttachment
public void saveDataForAttachment(Attachment attachment, AttachmentDataStream dataStream)
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:AttachmentDataDaoSaves data to the attachment data store- Specified by:
saveDataForAttachmentin interfaceAttachmentDataDao- Parameters:
attachment- the Attachment the data belongs todataStream- the data stream to be written
-
saveDataForAttachmentVersion
public void saveDataForAttachmentVersion(Attachment attachment, Attachment previousVersion, AttachmentDataStream dataStream)
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:AttachmentDataDaoSaves data to the attachment data store, for an attachment that has been updated.This method assumes that the attachment has already been saved.
- Specified by:
saveDataForAttachmentVersionin interfaceAttachmentDataDao- Parameters:
attachment- the new version of the attachmentpreviousVersion- the previous version of the attachmentdataStream- the InputStream representing the data
-
replaceDataForAttachment
public void replaceDataForAttachment(Attachment attachment, AttachmentDataStream dataStream)
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:AttachmentDataDaoSets the data for attachmentThis method will overwrite any existing data for the attachment.
- Specified by:
replaceDataForAttachmentin interfaceAttachmentDataDao- Parameters:
attachment- Attachment the data belongs todataStream- the data to be saved
-
-