Class ImapManagerImpl

java.lang.Object
io.jmix.imap.impl.ImapManagerImpl
All Implemented Interfaces:
ImapManager

@Component("imap_ImapManager") public class ImapManagerImpl extends Object implements ImapManager
  • Field Details

    • imapHelper

      @Autowired protected ImapHelper imapHelper
    • imapOperations

      @Autowired protected ImapOperations imapOperations
    • metadata

      @Autowired protected Metadata metadata
  • Constructor Details

    • ImapManagerImpl

      public ImapManagerImpl()
  • Method Details

    • testConnection

      public ImapConnectResult testConnection(ImapMailBox box)
      Description copied from interface: ImapManager
      Check a connection for specified mail box
      Specified by:
      testConnection in interface ImapManager
      Parameters:
      box - mail box to connect
      Returns:
      result of set connection
    • fetchFolders

      public Collection<ImapFolderDto> fetchFolders(ImapMailBox box)
      Description copied from interface: ImapManager
      Retrieve all folders of mailbox preserving tree structure
      Specified by:
      fetchFolders in interface ImapManager
      Parameters:
      box - IMAP mailbox connection details
      Returns:
      root folders of IMAP mailbox, each folder can contain nested child folders forming tree structure
    • fetchFolders

      public List<ImapFolderDto> fetchFolders(ImapMailBox box, String... folderNames)
      Description copied from interface: ImapManager
      Retrieve folders of mailbox with specified full names, result is presented in flat structure hiding parent\child relationship
      Specified by:
      fetchFolders in interface ImapManager
      Parameters:
      box - IMAP mailbox connection details
      folderNames - full names of folders to retrieve
      Returns:
      folders of IMAP mailbox with specified full names, result is ordered according to order of names input
    • fetchMessage

      public ImapMessageDto fetchMessage(ImapMessage message)
      Description copied from interface: ImapManager
      Retrieve single message
      Specified by:
      fetchMessage in interface ImapManager
      Parameters:
      message - reference object for IMAP message
      Returns:
      fully fetched message or null if there is no message with such UID in corresponding folder
    • toDto

      protected ImapMessageDto toDto(ImapMailBox mailBox, ImapMessage imapMessage, com.sun.mail.imap.IMAPMessage nativeMessage) throws javax.mail.MessagingException
      Throws:
      javax.mail.MessagingException
    • deleteMessage

      public void deleteMessage(ImapMessage message)
      Description copied from interface: ImapManager
      Delete message
      Specified by:
      deleteMessage in interface ImapManager
      Parameters:
      message - reference object for IMAP message
    • moveMessage

      public void moveMessage(ImapMessage msg, String folderName)
      Description copied from interface: ImapManager
      Move message in different folder, if folder is the same - nothing changed, if folder with specified full name doesn't exist - results in throwing ImapException
      Specified by:
      moveMessage in interface ImapManager
      Parameters:
      msg - reference object for IMAP message
      folderName - full name of new folder
    • doMove

      protected void doMove(ImapMessage msg, String newFolderName, ImapMailBox mailBox)
    • setFlag

      public void setFlag(ImapMessage message, ImapFlag flag, boolean set)
      Description copied from interface: ImapManager
      Change meta data flag for message, flag can be either standard or custom one
      Specified by:
      setFlag in interface ImapManager
      Parameters:
      message - reference object for IMAP message
      flag - flag to change
      set - if true - set the flag, if false - clear the flag
    • consumeMessage

      protected <T> T consumeMessage(ImapMessage msg, ImapManagerImpl.ImapFunction<com.sun.mail.imap.IMAPMessage,T> consumer, String actionDescription)
    • getAddressList

      protected List<String> getAddressList(javax.mail.Address[] addresses)
    • getFlags

      protected List<String> getFlags(javax.mail.Message message) throws javax.mail.MessagingException
      Throws:
      javax.mail.MessagingException