Class MailArchiveAttachmentServiceImpl
java.lang.Object
ch.tocco.nice2.messaging.mail.impl.MailArchiveAttachmentServiceImpl
- All Implemented Interfaces:
MailArchiveAttachmentService
@Component
public class MailArchiveAttachmentServiceImpl
extends Object
implements MailArchiveAttachmentService
-
Nested Class Summary
Nested classes/interfaces inherited from interface MailArchiveAttachmentService
MailArchiveAttachmentService.Base64ImageExtractionResult, MailArchiveAttachmentService.MailArchiveAttachment -
Constructor Summary
ConstructorsConstructorDescriptionMailArchiveAttachmentServiceImpl(BinaryFactory binaryFactory, EntityDocumentsService entityDocumentsService, QueryBuilderFactory queryBuilderFactory, CommandExecutor commandExecutor, ContextManager contextManager, SecurityManager securityManager, org.slf4j.Logger logger) -
Method Summary
Modifier and TypeMethodDescriptionextractBase64Images(@Nullable String content, @Nullable UUID taskUuid) Extract base64 images from content, store them as binary in Email_attachment and replace src in img taggetAttachment(@Nullable UUID taskUuid, String id) Returns existing Email_attachment entity for given task UUID and attachment.getOrCreateAttachment(@Nullable UUID taskUuid, Attachment attachment) Returns existing Email_attachment entity for given task UUID and attachment or creates a new one.linkAttachmentEntities(@Nullable UUID taskUuid, List<MailArchive.AttachmentId> attachmentIds, Entity mailEntity) Link already created attachments to email archive entity
-
Constructor Details
-
MailArchiveAttachmentServiceImpl
public MailArchiveAttachmentServiceImpl(BinaryFactory binaryFactory, EntityDocumentsService entityDocumentsService, QueryBuilderFactory queryBuilderFactory, CommandExecutor commandExecutor, ContextManager contextManager, SecurityManager securityManager, org.slf4j.Logger logger)
-
-
Method Details
-
getOrCreateAttachment
public MailArchiveAttachmentService.MailArchiveAttachment getOrCreateAttachment(@Nullable UUID taskUuid, Attachment attachment) Description copied from interface:MailArchiveAttachmentServiceReturns existing Email_attachment entity for given task UUID and attachment or creates a new one. Email_attachment entities are shared among Email_archive entries which are created by a certain task. For instance, if three mails are sent with the same attachment, there will be three Email_archive entries, and they will all be linked to the same Email_attachment entity. This thread safe method makes sure that there really will be created only one Email_attachment entity for the same attachment (thread safety is required, as each Email_archive entry gets created in its own thread).- Specified by:
getOrCreateAttachmentin interfaceMailArchiveAttachmentService- Returns:
- the existing or newly created attachment. The Nice URL is only set if the attachment didn't already exist.
-
getAttachment
public Optional<MailArchiveAttachmentService.MailArchiveAttachment> getAttachment(@Nullable UUID taskUuid, String id) Description copied from interface:MailArchiveAttachmentServiceReturns existing Email_attachment entity for given task UUID and attachment.- Specified by:
getAttachmentin interfaceMailArchiveAttachmentService- Returns:
- the existing attachment
-
linkAttachmentEntities
public List<MailArchive.AttachmentValue> linkAttachmentEntities(@Nullable UUID taskUuid, List<MailArchive.AttachmentId> attachmentIds, Entity mailEntity) Description copied from interface:MailArchiveAttachmentServiceLink already created attachments to email archive entity- Specified by:
linkAttachmentEntitiesin interfaceMailArchiveAttachmentService
-
extractBase64Images
public MailArchiveAttachmentService.Base64ImageExtractionResult extractBase64Images(@Nullable String content, @Nullable UUID taskUuid) Description copied from interface:MailArchiveAttachmentServiceExtract base64 images from content, store them as binary in Email_attachment and replace src in img tag- Specified by:
extractBase64Imagesin interfaceMailArchiveAttachmentService
-