@Transactional(propagation=REQUIRED) public abstract class ResourceStoringManagementBase extends Object implements ResourceStoringManagement
Spring Service base class for
com.communote.server.service.storing.ResourceStoringManagement
, provides access to
all services and entities referenced by this service.
ResourceStoringManagement
Constructor and Description |
---|
ResourceStoringManagementBase() |
Modifier and Type | Method and Description |
---|---|
void |
deleteAttachment(Long attachmentId)
Deletes an attachment.
|
void |
deleteOrphanedAttachments(Collection<Long> attachmentIds)
Deletes all provided attachments that are not connected to a note.
|
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
|
protected abstract void |
handleDeleteAttachment(Long attachmentId)
Performs the core logic for
deleteAttachment(Long) |
protected abstract void |
handleDeleteOrphanedAttachments(Collection<Long> attachmentIds)
Performs the core logic for
deleteOrphanedAttachments(java.util.Collection) |
protected abstract AttachmentTO |
handleGetAttachment(ContentId contentId)
Performs the core logic for
getAttachment(com.communote.server.core.crc.vo.ContentId) |
protected abstract AttachmentTO |
handleGetAttachment(Long attachmentId)
Performs the core logic for
getAttachment(Long) |
protected abstract <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 abstract Attachment |
handleStoreAttachment(AttachmentTO attachment)
Performs the core logic for
storeAttachment(com.communote.server.core.vo.content.AttachmentTO) |
protected abstract Attachment |
handleStoreCopyOfAttachment(Attachment contentResource)
Performs the core logic for
storeCopyOfAttachment(Attachment) |
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.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addAttachmentStoringPreProcessor, assertReadAccess, assertWriteAccess, deleteOrphanedAttachments, getNoteOfAttachment, getNoteOfAttachment, migrateContentTypeEmptyAttachments, removeAttachmentStoringPreProcessor
public void deleteAttachment(Long attachmentId) throws AttachmentStillAssignedException, AuthorizationException
deleteAttachment
in interface ResourceStoringManagement
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.public void deleteOrphanedAttachments(Collection<Long> attachmentIds) throws AuthorizationException
deleteOrphanedAttachments
in interface ResourceStoringManagement
attachmentIds
- the IDs of the attachments to deleteAuthorizationException
@Transactional(readOnly=true) public 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.
getAttachment
in interface ResourceStoringManagement
ContentRepositoryException
AuthorizationException
@Transactional(readOnly=true) public AttachmentTO getAttachment(Long attachmentId) throws ContentRepositoryException, AuthorizationException, AttachmentNotFoundException
ResourceStoringManagement
getAttachment
in interface ResourceStoringManagement
attachmentId
- the ID of the attachmentContentRepositoryException
- in case the attachment data cannot be read from the content repository were it is
storedAuthorizationException
- 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 exist@Transactional(readOnly=true) public <T> Collection<T> getAttachmentsOfNote(Long noteId, Collection<Long> attachmentIdsToFilter, Converter<Attachment,T> converter) throws AuthorizationException, NotFoundException
ResourceStoringManagement
getAttachmentsOfNote
in interface ResourceStoringManagement
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 abstract void handleDeleteAttachment(Long attachmentId) throws AttachmentStillAssignedException, AuthorizationException
deleteAttachment(Long)
protected abstract void handleDeleteOrphanedAttachments(Collection<Long> attachmentIds) throws AuthorizationException
deleteOrphanedAttachments(java.util.Collection)
AuthorizationException
protected abstract AttachmentTO handleGetAttachment(ContentId contentId) throws ContentRepositoryException, AuthorizationException
getAttachment(com.communote.server.core.crc.vo.ContentId)
protected abstract AttachmentTO handleGetAttachment(Long attachmentId) throws ContentRepositoryException, AuthorizationException, AttachmentNotFoundException
getAttachment(Long)
protected abstract <T> Collection<T> handleGetAttachmentsOfNote(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 noteprotected abstract Attachment handleStoreAttachment(AttachmentTO attachment) throws AuthorizationException
storeAttachment(com.communote.server.core.vo.content.AttachmentTO)
AuthorizationException
protected abstract Attachment handleStoreCopyOfAttachment(Attachment contentResource) throws AuthorizationException
storeCopyOfAttachment(Attachment)
AuthorizationException
public Attachment storeAttachment(AttachmentTO attachment) throws AuthorizationException
ResourceStoringManagement
storeAttachment
in interface ResourceStoringManagement
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
userpublic Attachment storeCopyOfAttachment(Attachment contentResource) throws AuthorizationException
ResourceStoringManagement
storeCopyOfAttachment
in interface ResourceStoringManagement
AuthorizationException
- in case the current user is not the internal system or an authenticated Communote
userCopyright © 2019 Communote team. All rights reserved.