it.sistematica.isharedoc.service.mail
Class MessageboxServiceImpl

java.lang.Object
  extended by it.sistematica.isharedoc.service.mail.MessageboxServiceImpl
All Implemented Interfaces:
MessageboxService

@Service(value="messageboxService")
public class MessageboxServiceImpl
extends java.lang.Object
implements MessageboxService


Nested Class Summary
 
Nested classes/interfaces inherited from interface it.sistematica.isharedoc.service.mail.MessageboxService
MessageboxService.PecAttachmentsSizeLimitExceededException, MessageboxService.PecRecipientsLimitExceededException
 
Field Summary
(package private)  it.neverworks.util.Configuration configuration
           
(package private)  DocumentManager documentManager
           
(package private)  it.neverworks.data.EntityManager entities
           
(package private)  InstanceSecurityService instanceSecurityService
           
(package private)  InstanceService instanceService
           
(package private)  IsharedocSystemService isharedocSystemService
           
(package private)  it.neverworks.template.TemplateEngine mailTemplateEngine
           
(package private)  NotificationService notificationService
           
(package private)  OrganizationService organizationService
           
(package private)  PartitionService partitionService
           
(package private)  PecService pecService
           
(package private)  WorkProcessManager processManager
           
(package private)  org.hibernate.SessionFactory sessionFactory
           
(package private)  org.springframework.transaction.PlatformTransactionManager transactionManager
           
(package private)  it.neverworks.application.service.UserInfo userInfo
           
 
Fields inherited from interface it.sistematica.isharedoc.service.mail.MessageboxService
ACCETTAZIONE, AGGIORNAMENTO_CONFERMA, ANNULLAMENTO_PROTOCOLLAZIONE, ANOMALIA, AVVENUTA_CONSEGNA, CONFERMA_RICEZIONE, ERRORE_CONSEGNA, ISHAREDOC_ERROR_WEBMAIL_FOLDER, ISHAREDOC_PROCESSED_WEBMAIL_FOLDER, ITEM_INSTANCE_PREFIX, MAIL_EML, MISSING_XML, NON_ACCETTAZIONE, NOTIFICA_ECCEZIONE, PEC_EML, POSTA_CERTIFICATA, PREAVVISO_ERRORE_CONSEGNA, PROCESS_INSTANCE_PREFIX, SEGNATURA, SEPARATOR_PREFIX, X_RICEVUTA, X_Riferimento_Message_ID, X_TRASPORTO, XML_MULTIPLI
 
Constructor Summary
MessageboxServiceImpl()
           
 
Method Summary
 void archive()
          Archive.
 void archive(java.util.Date fromDate, java.util.Date toDate)
          Archive.
 void archive(MessageBox messageBox, java.util.Date fromDate, java.util.Date toDate)
          Archive.
 void archiveInstance(ItemInstance instance)
          Archive instance.
 void associateServiceInstance(MessageInstance message, MessageServiceInstance messageService)
          Associate service instance.
 void checkPECSendLimits(MessageInstance messageInstance)
          Check pec send limits.
 MessageBox findMessageBoxById(java.lang.Long id)
          Find message box by id.
 File getInstanceAttachmentFolder(MessageInstance instance)
          Gets the instance attachment folder.
 File getInstanceAttachmentFolderMonth(MessageInstance instance)
          Gets the instance attachment folder month.
 java.util.List<MessageBox> getMessageBoxes(boolean filterAccessibleMe, boolean filterShowInAccounts)
          Gets the message boxes.
 java.util.List<MessageBox> getMessageBoxesCreateMessage()
          Gets the message boxes create message.
 java.util.List<MessageBox> getMessageBoxesCreateMessage(Storyboard storyboard)
          Gets the message boxes create message.
 java.util.List<MessageInstance.MessageType> getMessageTypeCreateMessage(MessageBox mbox)
          Gets the message type create message.
 java.util.List<Organization> getMyOrganizationsOnMessageBox(MessageBox mbox)
          Gets the my organizations on message box.
 void loopPendingMessages(java.lang.Long partitionId, java.lang.Long messageBoxId)
          Loop pending messages.
 void MIME2MessageInstance(javax.mail.Message message, MessageInstance instance, boolean getOriginalMessage, java.util.Map<java.lang.String,java.lang.Object> variables)
          MIM e2 message instance.
 void moveAllRecipientsToCcn(MessageInstance messageInstance)
          Move all recipients to ccn.
 void moveMessage(MessageInstance message, MessageBox mbox)
          Move message.
 void moveMessages(MessageBox fromMbox, MessageBox toMbox)
          Move messages.
 void processMailboxRulesAllPartitions()
          Process mailbox rules all partitions.
 void processMailboxRulesCurrentPartition(Partition partition)
           
 void processPendingMessagesAllPartitions()
          Process pending messages all partitions.
 void processPendingMessagesCurrentPartition(Partition partition)
           
 void rebuildSpecialFoldersPermissions(MessageBox mbox)
          Rebuild special folders permissions.
 void repair()
          Repair.
 void repair(MessageBox mbox)
          Repair.
 void repairDirectoryMessages()
          Repair directory messages.
 void repairDirectoryMessages(MessageBox mbox)
          Repair directory messages.
 void save(MessageBox mbox)
          Save.
 void saveAndApplyRules(MessageInstance messageInstance)
          Save and apply rules.
 void saveMessage(javax.mail.Message message, java.lang.Long messageBoxId)
          Save message.
 void scheduleSendMail(MessageInstance messageInstance, java.util.Date scheduleDate)
          Schedule send mail.
 void sendMail(MessageInstance messageInstance)
          Send mail.
 void sendMail(MessageInstance messageInstance, ContactInstance contactInstance)
          Send mail.
 void sendMailAnnullamento(MessageInstance messageInstance, java.lang.String motivo, java.lang.String provvedimento)
          Send mail annullamento.
 void sendMailConfermaRicezione(MessageInstance messageInstance, java.lang.String protocolNumber, java.util.Date protocolDate)
          Send mail conferma ricezione.
 void sendMailNotificaEccezione(MessageInstance messageInstance, java.lang.String motivo)
          Send mail notifica eccezione.
 void setDeliveryInfo(MessageInstance messageInstance, it.neverworks.mail.helper.MessageHelper message)
          Sets the delivery info.
 void setMailConnectionTimeout(int mailConnectionTimeout)
           
 void setMailIOTimeout(int mailIOTimeout)
           
 void setReplyMessage(MessageInstance replyMessage, MessageInstance repliedMessage)
          Sets the reply message.
 void validateDefaults(MessageBox mbox)
          Validate defaults.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

userInfo

it.neverworks.application.service.UserInfo userInfo

entities

it.neverworks.data.EntityManager entities

sessionFactory

org.hibernate.SessionFactory sessionFactory

transactionManager

org.springframework.transaction.PlatformTransactionManager transactionManager

configuration

it.neverworks.util.Configuration configuration

notificationService

NotificationService notificationService

partitionService

PartitionService partitionService

documentManager

DocumentManager documentManager

pecService

PecService pecService

instanceService

InstanceService instanceService

instanceSecurityService

InstanceSecurityService instanceSecurityService

organizationService

OrganizationService organizationService

mailTemplateEngine

it.neverworks.template.TemplateEngine mailTemplateEngine

isharedocSystemService

IsharedocSystemService isharedocSystemService

processManager

WorkProcessManager processManager
Constructor Detail

MessageboxServiceImpl

public MessageboxServiceImpl()
Method Detail

setMailConnectionTimeout

public void setMailConnectionTimeout(int mailConnectionTimeout)

setMailIOTimeout

public void setMailIOTimeout(int mailIOTimeout)

save

@Transactional
public void save(MessageBox mbox)
Description copied from interface: MessageboxService
Save.

Specified by:
save in interface MessageboxService
Parameters:
mbox - the mbox

validateDefaults

@Transactional
public void validateDefaults(MessageBox mbox)
Description copied from interface: MessageboxService
Validate defaults.

Specified by:
validateDefaults in interface MessageboxService
Parameters:
mbox - the mbox

repair

public void repair()
Description copied from interface: MessageboxService
Repair.

Specified by:
repair in interface MessageboxService

repair

public void repair(MessageBox mbox)
Description copied from interface: MessageboxService
Repair.

Specified by:
repair in interface MessageboxService
Parameters:
mbox - the mbox

repairDirectoryMessages

public void repairDirectoryMessages()
Description copied from interface: MessageboxService
Repair directory messages.

Specified by:
repairDirectoryMessages in interface MessageboxService

repairDirectoryMessages

public void repairDirectoryMessages(MessageBox mbox)
Description copied from interface: MessageboxService
Repair directory messages.

Specified by:
repairDirectoryMessages in interface MessageboxService
Parameters:
mbox - the mbox

rebuildSpecialFoldersPermissions

@Transactional
public void rebuildSpecialFoldersPermissions(MessageBox mbox)
Description copied from interface: MessageboxService
Rebuild special folders permissions.

Specified by:
rebuildSpecialFoldersPermissions in interface MessageboxService
Parameters:
mbox - the mbox

getMessageBoxes

public java.util.List<MessageBox> getMessageBoxes(boolean filterAccessibleMe,
                                                  boolean filterShowInAccounts)
Description copied from interface: MessageboxService
Gets the message boxes.

Specified by:
getMessageBoxes in interface MessageboxService
Parameters:
filterAccessibleMe - the filter accessible me
filterShowInAccounts - the filter show in accounts
Returns:
the message boxes

getMessageBoxesCreateMessage

public java.util.List<MessageBox> getMessageBoxesCreateMessage(Storyboard storyboard)
Description copied from interface: MessageboxService
Gets the message boxes create message.

Specified by:
getMessageBoxesCreateMessage in interface MessageboxService
Parameters:
storyboard - the storyboard
Returns:
the message boxes create message

getMessageBoxesCreateMessage

public java.util.List<MessageBox> getMessageBoxesCreateMessage()
Description copied from interface: MessageboxService
Gets the message boxes create message.

Specified by:
getMessageBoxesCreateMessage in interface MessageboxService
Returns:
the message boxes create message

getMessageTypeCreateMessage

@Transactional
public java.util.List<MessageInstance.MessageType> getMessageTypeCreateMessage(MessageBox mbox)
Description copied from interface: MessageboxService
Gets the message type create message.

Specified by:
getMessageTypeCreateMessage in interface MessageboxService
Parameters:
mbox - the mbox
Returns:
the message type create message

getMyOrganizationsOnMessageBox

@Transactional
public java.util.List<Organization> getMyOrganizationsOnMessageBox(MessageBox mbox)
Description copied from interface: MessageboxService
Gets the my organizations on message box.

Specified by:
getMyOrganizationsOnMessageBox in interface MessageboxService
Parameters:
mbox - the mbox
Returns:
the my organizations on message box

findMessageBoxById

@Transactional
public MessageBox findMessageBoxById(java.lang.Long id)
Description copied from interface: MessageboxService
Find message box by id.

Specified by:
findMessageBoxById in interface MessageboxService
Parameters:
id - the id
Returns:
the message box

moveMessage

@Transactional
public void moveMessage(MessageInstance message,
                                      MessageBox mbox)
Description copied from interface: MessageboxService
Move message.

Specified by:
moveMessage in interface MessageboxService
Parameters:
message - the message
mbox - the mbox

moveMessages

@Transactional
public void moveMessages(MessageBox fromMbox,
                                       MessageBox toMbox)
Description copied from interface: MessageboxService
Move messages.

Specified by:
moveMessages in interface MessageboxService
Parameters:
fromMbox - the from mbox
toMbox - the to mbox

setReplyMessage

@Transactional
public void setReplyMessage(MessageInstance replyMessage,
                                          MessageInstance repliedMessage)
Description copied from interface: MessageboxService
Sets the reply message.

Specified by:
setReplyMessage in interface MessageboxService
Parameters:
replyMessage - the reply message
repliedMessage - the replied message

associateServiceInstance

@Transactional
public void associateServiceInstance(MessageInstance message,
                                                   MessageServiceInstance messageService)
Description copied from interface: MessageboxService
Associate service instance.

Specified by:
associateServiceInstance in interface MessageboxService
Parameters:
message - the message
messageService - the message service

getInstanceAttachmentFolderMonth

@Transactional
public File getInstanceAttachmentFolderMonth(MessageInstance instance)
Description copied from interface: MessageboxService
Gets the instance attachment folder month.

Specified by:
getInstanceAttachmentFolderMonth in interface MessageboxService
Parameters:
instance - the instance
Returns:
the instance attachment folder month

getInstanceAttachmentFolder

@Transactional
public File getInstanceAttachmentFolder(MessageInstance instance)
Description copied from interface: MessageboxService
Gets the instance attachment folder.

Specified by:
getInstanceAttachmentFolder in interface MessageboxService
Parameters:
instance - the instance
Returns:
the instance attachment folder

sendMailConfermaRicezione

@Transactional
public void sendMailConfermaRicezione(MessageInstance messageInstance,
                                                    java.lang.String protocolNumber,
                                                    java.util.Date protocolDate)
                               throws java.lang.Exception
Description copied from interface: MessageboxService
Send mail conferma ricezione.

Specified by:
sendMailConfermaRicezione in interface MessageboxService
Parameters:
messageInstance - the message instance
protocolNumber - the protocol number
protocolDate - the protocol date
Throws:
MessageboxService.PecRecipientsLimitExceededException - the exception
java.lang.Exception

scheduleSendMail

@Transactional
public void scheduleSendMail(MessageInstance messageInstance,
                                           java.util.Date scheduleDate)
Description copied from interface: MessageboxService
Schedule send mail.

Specified by:
scheduleSendMail in interface MessageboxService
Parameters:
messageInstance - the message instance
scheduleDate - the schedule date

sendMail

public void sendMail(MessageInstance messageInstance)
              throws java.lang.Exception
Description copied from interface: MessageboxService
Send mail.

Specified by:
sendMail in interface MessageboxService
Parameters:
messageInstance - the message instance
Throws:
MessageboxService.PecRecipientsLimitExceededException - the exception
java.lang.Exception

sendMail

@Transactional
public void sendMail(MessageInstance messageInstance,
                                   ContactInstance contactInstance)
              throws java.lang.Exception
Description copied from interface: MessageboxService
Send mail.

Specified by:
sendMail in interface MessageboxService
Parameters:
messageInstance - the message instance
contactInstance - the contact instance
Throws:
MessageboxService.PecRecipientsLimitExceededException - the exception
java.lang.Exception

saveMessage

public void saveMessage(javax.mail.Message message,
                        java.lang.Long messageBoxId)
Description copied from interface: MessageboxService
Save message.

Specified by:
saveMessage in interface MessageboxService
Parameters:
message - the message
messageBoxId - the message box id

MIME2MessageInstance

public void MIME2MessageInstance(javax.mail.Message message,
                                 MessageInstance instance,
                                 boolean getOriginalMessage,
                                 java.util.Map<java.lang.String,java.lang.Object> variables)
                          throws java.lang.Exception
Description copied from interface: MessageboxService
MIM e2 message instance.

Specified by:
MIME2MessageInstance in interface MessageboxService
Parameters:
message - the message
instance - the instance
getOriginalMessage - the get original message
variables - the variables
Throws:
MessageboxService.PecRecipientsLimitExceededException - the exception
java.lang.Exception

setDeliveryInfo

public void setDeliveryInfo(MessageInstance messageInstance,
                            it.neverworks.mail.helper.MessageHelper message)
                     throws java.lang.Exception
Description copied from interface: MessageboxService
Sets the delivery info.

Specified by:
setDeliveryInfo in interface MessageboxService
Parameters:
messageInstance - the message instance
message - the message
Throws:
MessageboxService.PecRecipientsLimitExceededException - the exception
java.lang.Exception

sendMailNotificaEccezione

public void sendMailNotificaEccezione(MessageInstance messageInstance,
                                      java.lang.String motivo)
                               throws java.lang.Exception
Description copied from interface: MessageboxService
Send mail notifica eccezione.

Specified by:
sendMailNotificaEccezione in interface MessageboxService
Parameters:
messageInstance - the message instance
motivo - the motivo
Throws:
MessageboxService.PecRecipientsLimitExceededException - the exception
java.lang.Exception

sendMailAnnullamento

public void sendMailAnnullamento(MessageInstance messageInstance,
                                 java.lang.String motivo,
                                 java.lang.String provvedimento)
                          throws java.lang.Exception
Description copied from interface: MessageboxService
Send mail annullamento.

Specified by:
sendMailAnnullamento in interface MessageboxService
Parameters:
messageInstance - the message instance
motivo - the motivo
provvedimento - the provvedimento
Throws:
MessageboxService.PecRecipientsLimitExceededException - the exception
java.lang.Exception

saveAndApplyRules

@Transactional
public void saveAndApplyRules(MessageInstance messageInstance)
Description copied from interface: MessageboxService
Save and apply rules.

Specified by:
saveAndApplyRules in interface MessageboxService
Parameters:
messageInstance - the message instance

archive

@Transactional
public void archive()
Description copied from interface: MessageboxService
Archive.

Specified by:
archive in interface MessageboxService

archive

@Transactional
public void archive(java.util.Date fromDate,
                                  java.util.Date toDate)
Description copied from interface: MessageboxService
Archive.

Specified by:
archive in interface MessageboxService
Parameters:
fromDate - the from date
toDate - the to date

archive

@Transactional
public void archive(MessageBox messageBox,
                                  java.util.Date fromDate,
                                  java.util.Date toDate)
Description copied from interface: MessageboxService
Archive.

Specified by:
archive in interface MessageboxService
Parameters:
messageBox - the message box
fromDate - the from date
toDate - the to date

archiveInstance

@Transactional
public void archiveInstance(ItemInstance instance)
Description copied from interface: MessageboxService
Archive instance.

Specified by:
archiveInstance in interface MessageboxService
Parameters:
instance - the instance

loopPendingMessages

@Transactional(propagation=REQUIRES_NEW)
public void loopPendingMessages(java.lang.Long partitionId,
                                              java.lang.Long messageBoxId)
                         throws javax.mail.MessagingException,
                                java.lang.Exception
Description copied from interface: MessageboxService
Loop pending messages.

Specified by:
loopPendingMessages in interface MessageboxService
Parameters:
partitionId - the partition id
messageBoxId - the message box id
Throws:
javax.mail.MessagingException - the messaging exception
MessageboxService.PecRecipientsLimitExceededException - the exception
java.lang.Exception

processPendingMessagesAllPartitions

@Transactional
public void processPendingMessagesAllPartitions()
                                         throws javax.mail.MessagingException,
                                                java.lang.Exception
Description copied from interface: MessageboxService
Process pending messages all partitions.

Specified by:
processPendingMessagesAllPartitions in interface MessageboxService
Throws:
javax.mail.MessagingException - the messaging exception
MessageboxService.PecRecipientsLimitExceededException - the exception
java.lang.Exception

processMailboxRulesAllPartitions

@Transactional
public void processMailboxRulesAllPartitions()
                                      throws javax.mail.MessagingException,
                                             java.lang.Exception
Description copied from interface: MessageboxService
Process mailbox rules all partitions.

Specified by:
processMailboxRulesAllPartitions in interface MessageboxService
Throws:
javax.mail.MessagingException - the messaging exception
MessageboxService.PecRecipientsLimitExceededException - the exception
java.lang.Exception

processPendingMessagesCurrentPartition

@Transactional(propagation=REQUIRES_NEW)
public void processPendingMessagesCurrentPartition(Partition partition)
                                            throws javax.mail.MessagingException,
                                                   java.lang.Exception
Throws:
javax.mail.MessagingException
java.lang.Exception

processMailboxRulesCurrentPartition

@Transactional(propagation=REQUIRES_NEW)
public void processMailboxRulesCurrentPartition(Partition partition)
                                         throws javax.mail.MessagingException,
                                                java.lang.Exception
Throws:
javax.mail.MessagingException
java.lang.Exception

moveAllRecipientsToCcn

public void moveAllRecipientsToCcn(MessageInstance messageInstance)
Description copied from interface: MessageboxService
Move all recipients to ccn.

Specified by:
moveAllRecipientsToCcn in interface MessageboxService
Parameters:
messageInstance - the message instance

checkPECSendLimits

public void checkPECSendLimits(MessageInstance messageInstance)
Description copied from interface: MessageboxService
Check pec send limits.

Specified by:
checkPECSendLimits in interface MessageboxService
Parameters:
messageInstance - the message instance