@Service(value="resourceStoringManagement") public class ResourceStoringManagementImpl extends ResourceStoringManagementBase
ResourceStoringManagement
Constructor and Description |
---|
ResourceStoringManagementImpl() |
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
|
int |
deleteOrphanedAttachments(Date upperUploadDate)
Remove all attachments which are not connected to a note and which are older than the given
date.
|
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.
|
protected void |
handleDeleteAttachment(Long attachmentId)
Performs the core logic for
ResourceStoringManagementBase.deleteAttachment(Long) |
protected void |
handleDeleteOrphanedAttachments(Collection<Long> attachmentIds)
Performs the core logic for
ResourceStoringManagementBase.deleteOrphanedAttachments(java.util.Collection) |
protected AttachmentTO |
handleGetAttachment(ContentId contentId)
Performs the core logic for
ResourceStoringManagementBase.getAttachment(com.communote.server.core.crc.vo.ContentId) |
protected AttachmentTO |
handleGetAttachment(Long attachmentId)
Performs the core logic for
ResourceStoringManagementBase.getAttachment(Long) |
protected <T> Collection<T> |
handleGetAttachmentsOfNote(Long noteId,
Collection<Long> attachmentIdsToFilter,
Converter<Attachment,T> converter)
Return the attachments of a note converted with the help of the provided converter
|
protected Attachment |
handleStoreAttachment(AttachmentTO attachmentTO)
Performs the core logic for
ResourceStoringManagementBase.storeAttachment(com.communote.server.core.vo.content.AttachmentTO) |
protected Attachment |
handleStoreCopyOfAttachment(Attachment contentResource)
Performs the core logic for
ResourceStoringManagementBase.storeCopyOfAttachment(Attachment) |
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.
|
deleteAttachment, deleteOrphanedAttachments, getAttachment, getAttachment, getAttachmentsOfNote, storeAttachment, storeCopyOfAttachment
@Transactional(propagation=SUPPORTS) public void addAttachmentStoringPreProcessor(AttachmentStoringPreProcessor processor)
ResourceStoringManagement
processor
- The processor.public void assertReadAccess(Long attachmentId) throws AuthorizationException, AttachmentNotFoundException
ResourceStoringManagement
attachmentId
- the ID of the attachmentAuthorizationException
- in case the user has no read accessAttachmentNotFoundException
- in case the attachment does not existpublic void assertWriteAccess(Long attachmentId) throws AuthorizationException, AttachmentNotFoundException
ResourceStoringManagement
attachmentId
- the ID of the attachmentAuthorizationException
- in case the user has no read accessAttachmentNotFoundException
- in case the attachment does not existpublic int deleteOrphanedAttachments(Date upperUploadDate) throws AuthorizationException
ResourceStoringManagement
upperUploadDate
- Attachments must be older than this date.AuthorizationException
- in case the current user is not the internal system userpublic Long getNoteOfAttachment(ContentId contentId) throws AuthorizationException
ResourceStoringManagement
contentId
- the content ID of the attachmentAuthorizationException
- in case the current user has no access to the notepublic Long getNoteOfAttachment(Long attachmentId) throws AuthorizationException
ResourceStoringManagement
attachmentId
- the ID of the attachmentAuthorizationException
- in case the current user has no access to the noteprotected void handleDeleteAttachment(Long attachmentId) throws AttachmentStillAssignedException, AuthorizationException
ResourceStoringManagementBase.deleteAttachment(Long)
handleDeleteAttachment
in class ResourceStoringManagementBase
AttachmentStillAssignedException
AuthorizationException
protected void handleDeleteOrphanedAttachments(Collection<Long> attachmentIds) throws AuthorizationException
ResourceStoringManagementBase.deleteOrphanedAttachments(java.util.Collection)
handleDeleteOrphanedAttachments
in class ResourceStoringManagementBase
AuthorizationException
protected AttachmentTO handleGetAttachment(ContentId contentId) throws ContentRepositoryException, AuthorizationException
ResourceStoringManagementBase.getAttachment(com.communote.server.core.crc.vo.ContentId)
handleGetAttachment
in class ResourceStoringManagementBase
ContentRepositoryException
AuthorizationException
protected AttachmentTO handleGetAttachment(Long attachmentId) throws ContentRepositoryException, AuthorizationException, AttachmentNotFoundException
ResourceStoringManagementBase
ResourceStoringManagementBase.getAttachment(Long)
handleGetAttachment
in class ResourceStoringManagementBase
AttachmentNotFoundException
ContentRepositoryException
AuthorizationException
protected <T> Collection<T> handleGetAttachmentsOfNote(Long noteId, Collection<Long> attachmentIdsToFilter, Converter<Attachment,T> converter) throws AuthorizationException, NotFoundException
ResourceStoringManagementBase
handleGetAttachmentsOfNote
in class ResourceStoringManagementBase
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 attachmentsAuthorizationException
- in case the current user has no read access to the noteNotFoundException
- in case the note does not existprotected Attachment handleStoreAttachment(AttachmentTO attachmentTO) throws AuthorizationException
ResourceStoringManagementBase
ResourceStoringManagementBase.storeAttachment(com.communote.server.core.vo.content.AttachmentTO)
handleStoreAttachment
in class ResourceStoringManagementBase
AuthorizationException
protected Attachment handleStoreCopyOfAttachment(Attachment contentResource) throws AuthorizationException
ResourceStoringManagementBase
ResourceStoringManagementBase.storeCopyOfAttachment(Attachment)
handleStoreCopyOfAttachment
in class ResourceStoringManagementBase
AuthorizationException
public void migrateContentTypeEmptyAttachments()
Migrate the attachments with an empty content type
@Transactional(propagation=SUPPORTS) public void removeAttachmentStoringPreProcessor(AttachmentStoringPreProcessor processor)
ResourceStoringManagement
processor
- The processor.Copyright © 2019 Communote team. All rights reserved.