public class EmailServiceImpl extends FaxToMailServiceSupport implements EmailService
| Modifier and Type | Field and Description |
|---|---|
protected org.nuiton.util.beans.Binder<Attachment,Attachment> |
attachmentBinder |
serviceContext| Constructor and Description |
|---|
EmailServiceImpl() |
| Modifier and Type | Method and Description |
|---|---|
Email |
addToHistory(String emailId,
HistoryType type,
FaxToMailUser user,
Date date,
String... fields) |
protected void |
browseFolderParent(MailFolder folder,
FaxToMailUser user,
MailFolderService mailFolderService) |
Map<Range,Long[]> |
computeQuantitiesByRange(MailFolder rootFolder) |
Attachment |
convertHTMLToPdf(List<Attachment> attachments,
String content,
String name)
Convert html content to image.
|
Attachment |
convertIfNecessary(Attachment attachment)
Retourne un input stream sur une piece jointe convertie ou pas.
|
Attachment |
convertTextToPdf(String content,
String name) |
Attachment |
convertToPdf(Attachment attachment,
ExtensionCommand extensionCommand)
Convert attachment to pdf.
|
String |
decomposeMultipartEmail(List<Attachment> attachments,
javax.mail.Part part)
Decompose a multipart part.
|
protected String |
decomposeMultipartEmail(List<Attachment> attachments,
javax.mail.Part part,
int decomposingForwardedEmail) |
List<MailLock> |
getAllMailLocks()
Retourne la liste des vérrouillages actifs.
|
long |
getArchivedMailCount()
Retourne le nombre de mail archivé.
|
AttachmentFile |
getAttachmentFile(String attachmentId,
boolean original) |
AttachmentFile |
getAttachmentFileFromStream(InputStream contentStream)
Save content stream into attachment file content.
|
List<MailFolder> |
getChildrenRecursively(MailFolder folder) |
Set<Object> |
getDistinctValues(MailFolder folder,
String[] properties,
boolean sum) |
Email |
getEmailById(String id) |
protected Email |
getEmailById(String id,
String fetch,
String... otherFetches) |
AttachmentFile |
getEmailDetailAsAttachment(Email email)
Generate email details as PDF and return it as an printable attachment.
|
protected String |
getEmailDetailAsHtml(Email email) |
org.nuiton.util.pagination.PaginationResult<Email> |
getEmailForFolder(MailFolder folder,
FaxToMailUser currentUser,
EmailFilter filter,
org.nuiton.util.pagination.PaginationParameter page)
Recupère les demandes d'un dossier visible par un utilisateur.
|
Email |
getFullEmailById(String id) |
Email |
getFullEmailById(String id,
FaxToMailUser user) |
ReplyContent |
getReplyContent(String replyId)
Get reply content on demand for lazy loading.
|
protected String |
getTopiaId(Class clazz,
org.nuiton.topia.persistence.TopiaEntity entity) |
Email |
groupEmails(String email1Id,
String email2Id,
FaxToMailUser user) |
protected void |
handleEdiTransmission(Email email,
HistoryTopiaDao historyDao,
Set<String> fieldSet) |
ArchiveImportResult |
importArchive(InputStream inputStream,
File attachmentBase)
Import archive from input stream.
|
Email |
lockEmail(String emailId,
FaxToMailUser currentUser)
Vérrouille une demande par un utilisateur empechant les autres de l'ouvrir.
|
Email |
openEmail(String emailId,
FaxToMailUser user,
boolean takeEmail) |
OriginalEmail |
originalEmailFromMessage(javax.mail.internet.MimeMessage message,
Charset charset) |
void |
rejectEmail(String from,
String to,
String subject,
String content) |
Email |
reply(String from,
String to,
String cc,
String bcc,
String subject,
String content,
Collection<AttachmentFile> attachments,
String originalEmailId,
FaxToMailUser user)
Envoi une réponse et retourne l'email.
|
Email |
saveEmail(Email email,
Collection<Attachment> attachments,
Collection<Reply> replies,
String clientCode,
FaxToMailUser user,
String... modifiedFields) |
Email |
saveEmail(Email email,
FaxToMailUser user,
String... modifiedFields)
Save email with default email client code.
|
org.nuiton.util.pagination.PaginationResult<Email> |
search(SearchFilter emailFilter,
FaxToMailUser user,
org.nuiton.util.pagination.PaginationParameter pagination) |
Collection<Email> |
searchArchives(String commandQuotationNumber,
String company) |
void |
transmit(Collection<String> emailIds,
MailFolder newFolder,
FaxToMailUser currentUser) |
protected void |
transmitDemandToEdi(Email email)
Generate txt file to send demand to EDI system.
|
void |
transmitPendingDemandsToEdi() |
void |
unlockEmail(String emailId)
Dévérrouille une demande.
|
void |
unlockMails(List<String> mailLockIds)
Dévérrouille les mails specifiés.
|
protected void |
updateAttachments(Email email,
Collection<Attachment> attachments,
FaxToMailUser user)
Les attachment sont copiés dans l'UI sans la valorisation des champs "originalFile" et "editedFile".
|
void |
updateRangeRowsWithEdiReturns() |
protected void |
updateReplies(Email email)
Les réponses sont modifiées par l'ui pour ne pas charger le contenu binaire, pour la sauvegarde,
il faut bien rétablir les replyContent avec ceux en base.
|
getApplicationConfig, getClientService, getConfigurationService, getDecoratorService, getEmailService, getMailFolderService, getNow, getPersistenceContext, getReferentielService, newService, setServiceContextclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitsetServiceContextprotected org.nuiton.util.beans.Binder<Attachment,Attachment> attachmentBinder
public Email getEmailById(String id)
getEmailById in interface EmailServicepublic Email getFullEmailById(String id)
getFullEmailById in interface EmailServicepublic Email getFullEmailById(String id, FaxToMailUser user)
getFullEmailById in interface EmailServiceprotected void browseFolderParent(MailFolder folder, FaxToMailUser user, MailFolderService mailFolderService)
public Email saveEmail(Email email, FaxToMailUser user, String... modifiedFields) throws InvalidClientException
saveEmail in interface EmailServiceemail - emailuser - usermodifiedFields - modified fieldsInvalidClientException - if client code is not validpublic Email saveEmail(Email email, Collection<Attachment> attachments, Collection<Reply> replies, String clientCode, FaxToMailUser user, String... modifiedFields) throws InvalidClientException
saveEmail in interface EmailServiceInvalidClientExceptionprotected void updateReplies(Email email)
email - protected void updateAttachments(Email email, Collection<Attachment> attachments, FaxToMailUser user)
email - attachments - user - protected void handleEdiTransmission(Email email, HistoryTopiaDao historyDao, Set<String> fieldSet)
public void transmitPendingDemandsToEdi()
transmitPendingDemandsToEdi in interface EmailServiceprotected void transmitDemandToEdi(Email email)
email - email to sendpublic Set<Object> getDistinctValues(MailFolder folder, String[] properties, boolean sum)
getDistinctValues in interface EmailServicepublic org.nuiton.util.pagination.PaginationResult<Email> getEmailForFolder(MailFolder folder, FaxToMailUser currentUser, EmailFilter filter, org.nuiton.util.pagination.PaginationParameter page)
getEmailForFolder in interface EmailServicefolder - folder to get demandecurrentUser - user to check rigthpage - paginationpublic List<MailFolder> getChildrenRecursively(MailFolder folder)
getChildrenRecursively in interface EmailServicepublic Map<Range,Long[]> computeQuantitiesByRange(MailFolder rootFolder)
computeQuantitiesByRange in interface EmailServicepublic Email addToHistory(String emailId, HistoryType type, FaxToMailUser user, Date date, String... fields)
addToHistory in interface EmailServicepublic Email openEmail(String emailId, FaxToMailUser user, boolean takeEmail) throws FolderNotReadableException
openEmail in interface EmailServiceFolderNotReadableExceptionpublic Email lockEmail(String emailId, FaxToMailUser currentUser) throws AlreadyLockedMailException, FolderNotReadableException
lockEmail in interface EmailServiceemailId - topiaId de la demande à vérouillercurrentUser - userAlreadyLockedMailException - if email is already locked by another userFolderNotReadableExceptionpublic void unlockEmail(String emailId)
unlockEmail in interface EmailServiceemailId - topiaId de la demande à devérouillerpublic org.nuiton.util.pagination.PaginationResult<Email> search(SearchFilter emailFilter, FaxToMailUser user, org.nuiton.util.pagination.PaginationParameter pagination)
search in interface EmailServicepublic Collection<Email> searchArchives(String commandQuotationNumber, String company)
searchArchives in interface EmailServicepublic Email groupEmails(String email1Id, String email2Id, FaxToMailUser user)
groupEmails in interface EmailServicepublic Email reply(String from, String to, String cc, String bcc, String subject, String content, Collection<AttachmentFile> attachments, String originalEmailId, FaxToMailUser user) throws org.apache.commons.mail.EmailException, javax.mail.MessagingException, IOException
reply in interface EmailServicefrom - fromto - tocc - ccbcc - bccsubject - subjectcontent - contentattachments - attachementoriginalEmailId - mail topia iduser - user to add new history entry for userorg.apache.commons.mail.EmailException - if message can't be sentjavax.mail.MessagingException - if message can't be sentIOException - if message can't be sentpublic void transmit(Collection<String> emailIds, MailFolder newFolder, FaxToMailUser currentUser)
transmit in interface EmailServicepublic AttachmentFile getAttachmentFileFromStream(InputStream contentStream)
getAttachmentFileFromStream in interface EmailServicecontentStream - contentpublic AttachmentFile getAttachmentFile(String attachmentId, boolean original)
getAttachmentFile in interface EmailServicepublic ReplyContent getReplyContent(String replyId)
EmailServicegetReplyContent in interface EmailServicereplyId - reply topia idpublic List<MailLock> getAllMailLocks()
getAllMailLocks in interface EmailServicepublic void unlockMails(List<String> mailLockIds)
unlockMails in interface EmailServicemailLockIds - mail lock ids to unlockpublic void rejectEmail(String from, String to, String subject, String content) throws org.apache.commons.mail.EmailException, javax.mail.MessagingException, IOException
rejectEmail in interface EmailServiceorg.apache.commons.mail.EmailExceptionjavax.mail.MessagingExceptionIOExceptionpublic void updateRangeRowsWithEdiReturns()
updateRangeRowsWithEdiReturns in interface EmailServicepublic OriginalEmail originalEmailFromMessage(javax.mail.internet.MimeMessage message, Charset charset) throws javax.mail.MessagingException, IOException
originalEmailFromMessage in interface EmailServicejavax.mail.MessagingExceptionIOExceptionpublic AttachmentFile getEmailDetailAsAttachment(Email email)
getEmailDetailAsAttachment in interface EmailServiceemail - emailpublic ArchiveImportResult importArchive(InputStream inputStream, File attachmentBase)
EmailServiceimportArchive in interface EmailServiceinputStream - input stream of csv fileattachmentBase - base folder containing attachment listed in csv fileprotected String getTopiaId(Class clazz, org.nuiton.topia.persistence.TopiaEntity entity)
public long getArchivedMailCount()
EmailServicegetArchivedMailCount in interface EmailServicepublic String decomposeMultipartEmail(List<Attachment> attachments, javax.mail.Part part) throws Exception
EmailServicedecomposeMultipartEmail in interface EmailServicepart - the part to decomposeExceptionprotected String decomposeMultipartEmail(List<Attachment> attachments, javax.mail.Part part, int decomposingForwardedEmail) throws Exception
Exceptionpublic Attachment convertIfNecessary(Attachment attachment) throws IOException
EmailServiceconvertIfNecessary in interface EmailServiceattachment - to convertIOExceptionpublic Attachment convertToPdf(Attachment attachment, ExtensionCommand extensionCommand) throws IOException
EmailServiceconvertToPdf in interface EmailServiceattachment - attachment to convertextensionCommand - commandIOExceptionpublic Attachment convertTextToPdf(String content, String name) throws IOException, com.itextpdf.text.DocumentException
convertTextToPdf in interface EmailServiceIOExceptioncom.itextpdf.text.DocumentExceptionpublic Attachment convertHTMLToPdf(List<Attachment> attachments, String content, String name) throws IOException
EmailServiceconvertHTMLToPdf in interface EmailServiceattachments - attachment content to link content tocontent - html contentname - result attachment namenull if content can't be convertedIOExceptionCopyright © 2014–2015 CodeLutin. All rights reserved.