public interface ResourceStoringManagement
Modifier and Type | Method and Description |
---|---|
void |
addAttachmentStoringPreProcessor(AttachmentStoringPreProcessor processor)
Method to add a new processor to the list of processors.
|
void |
assertReadAccess(Long attachmentId)
Assert that the current user has read access to the attachment
|
void |
assertWriteAccess(Long attachmentId)
Assert that the current user has access to edit the attachment
|
void |
deleteAttachment(Long attachmentId)
Deletes an attachment.
|
void |
deleteOrphanedAttachments(Collection<Long> attachmentIds)
Deletes all provided attachments that are not connected to a note.
|
int |
deleteOrphanedAttachments(Date upperUploadDate)
Remove all attachments which are not connected to a note and which are older than the given
date.
|
AttachmentTO |
getAttachment(ContentId contentId)
Returns an attachment with the delivered content id.
|
AttachmentTO |
getAttachment(Long attachmentId)
Get an attachment by the given ID.
|
<T> Collection<T> |
getAttachmentsOfNote(Long noteId,
Collection<Long> attachmentIdsToFilter,
Converter<Attachment,T> converter)
Return the attachments of a note converted with the help of the provided converter
|
Long |
getNoteOfAttachment(ContentId contentId)
Get the note the given attachment is assigned to.
|
Long |
getNoteOfAttachment(Long attachmentId)
Get the note the given attachment is assigned to.
|
void |
migrateContentTypeEmptyAttachments()
Migrate the attachments with an empty content type
|
void |
removeAttachmentStoringPreProcessor(AttachmentStoringPreProcessor processor)
Method to remove a new processor from the list of registered processors.
|
Attachment |
storeAttachment(AttachmentTO attachment)
Store the attachment in the repository and return the created entity.
|
Attachment |
storeCopyOfAttachment(Attachment contentResource)
Create a copy of a stored attachment.
|
void addAttachmentStoringPreProcessor(AttachmentStoringPreProcessor processor)
processor
- The processor.void assertReadAccess(Long attachmentId) throws AuthorizationException, AttachmentNotFoundException
attachmentId
- the ID of the attachmentAuthorizationException
- in case the user has no read accessAttachmentNotFoundException
- in case the attachment does not existvoid assertWriteAccess(Long attachmentId) throws AuthorizationException, AttachmentNotFoundException
attachmentId
- the ID of the attachmentAuthorizationException
- in case the user has no read accessAttachmentNotFoundException
- in case the attachment does not existvoid deleteAttachment(Long attachmentId) throws AttachmentStillAssignedException, AuthorizationException
attachmentId
- the ID of attachment to deleteAttachmentStillAssignedException
- in case the attachment cannot be deleted because it is still assigned to the noteAuthorizationException
- Thrown, when the current user is not allowed to remove the given attachment.int deleteOrphanedAttachments(Date upperUploadDate) throws AuthorizationException
upperUploadDate
- Attachments must be older than this date.AuthorizationException
- in case the current user is not the internal system uservoid deleteOrphanedAttachments(Collection<Long> attachmentIds) throws AuthorizationException
attachmentIds
- the IDs of the attachments to deleteAuthorizationException
AttachmentTO getAttachment(ContentId contentId) throws ContentRepositoryException, AuthorizationException
Returns an attachment with the delivered content id. This method checks if the current user has read access to the note the attachment belongs to.
AttachmentTO getAttachment(Long attachmentId) throws ContentRepositoryException, AuthorizationException, AttachmentNotFoundException
attachmentId
- the ID of the attachmentAuthorizationException
- in case the current user has no access to the attachment. This is the case if the
attachment was not yet published and the current user is not the uploader or the
attachment is published and the current user has no access to the note of the
attachment.AttachmentNotFoundException
- in case the attachment does not existContentRepositoryException
- in case the attachment data cannot be read from the content repository were it is
stored<T> Collection<T> getAttachmentsOfNote(Long noteId, Collection<Long> attachmentIdsToFilter, Converter<Attachment,T> converter) throws AuthorizationException, NotFoundException
T
- The target type of the conversionnoteId
- the ID of the noteattachmentIdsToFilter
- optional collection of attachment IDs to filter the result by only adding those
attachments whose ID is in the collection. If omitted all attachments will be
considered.converter
- the converter to convert the found attachmentsNotFoundException
- in case the note does not existAuthorizationException
- in case the current user has no read access to the noteLong getNoteOfAttachment(ContentId contentId) throws AuthorizationException
contentId
- the content ID of the attachmentAuthorizationException
- in case the current user has no access to the noteLong getNoteOfAttachment(Long attachmentId) throws AuthorizationException
attachmentId
- the ID of the attachmentAuthorizationException
- in case the current user has no access to the notevoid migrateContentTypeEmptyAttachments()
Migrate the attachments with an empty content type
void removeAttachmentStoringPreProcessor(AttachmentStoringPreProcessor processor)
processor
- The processor.Attachment storeAttachment(AttachmentTO attachment) throws AuthorizationException
attachment
- TO containing the details of the attachment to store.AuthorizationException
- in case the current user is not the internal system or an authenticated Communote
userAttachment storeCopyOfAttachment(Attachment contentResource) throws AuthorizationException
AuthorizationException
- in case the current user is not the internal system or an authenticated Communote
userCopyright © 2019 Communote team. All rights reserved.