public void importMailsFromJames23(String james23MailRepositoryPath) throws MessagingException, MailRepositoryStoreException, UsersRepositoryException, MailboxException, DomainListException {
  Flags flags=new Flags();
  boolean isRecent=false;
  Iterator<String> james23userRepositoryIterator=james23UsersRepository.list();
  while (james23userRepositoryIterator.hasNext()) {
    String userName23=james23userRepositoryIterator.next();
    MailRepository mailRepository=mailRepositoryStore.select(james23MailRepositoryPath + "/" + userName23);
    Iterator<String> mailRepositoryIterator=mailRepository.list();
    String userName30=convert23UserTo30(userName23);
    MailboxSession mailboxSession=mailboxManager.createSystemSession(userName30,log);
    MailboxPath mailboxPath=MailboxPath.inbox(mailboxSession);
    mailboxManager.startProcessingRequest(mailboxSession);
    try {
      mailboxManager.createMailbox(mailboxPath,mailboxSession);
    }
 catch (    MailboxExistsException e) {
    }
    mailboxManager.endProcessingRequest(mailboxSession);
    MessageManager messageManager=mailboxManager.getMailbox(mailboxPath,mailboxSession);
    while (mailRepositoryIterator.hasNext()) {
      Mail mail=mailRepository.retrieve(mailRepositoryIterator.next());
      mailboxManager.startProcessingRequest(mailboxSession);
      messageManager.appendMessage(new MimeMessageInputStream(mail.getMessage()),new Date(),mailboxSession,isRecent,flags);
      mailboxManager.endProcessingRequest(mailboxSession);
    }
  }
}

public void importMailsFromJames23 ( String james23MailRepositoryPath ) throws MessagingException , MailRepositoryStoreException , UsersRepositoryException , MailboxException , DomainListException { Flags flags = new Flags ( ) ; boolean isRecent = false ; Iterator < String > james23userRepositoryIterator = james23UsersRepository . list ( ) ; while ( james23userRepositoryIterator . hasNext ( ) ) { String userName23 = james23userRepositoryIterator . next ( ) ; MailRepository mailRepository = mailRepositoryStore . select ( james23MailRepositoryPath + "/" + userName23 ) ; Iterator < String > mailRepositoryIterator = mailRepository . list ( ) ; String userName30 = convert23UserTo30 ( userName23 ) ; MailboxSession mailboxSession = mailboxManager . createSystemSession ( userName30 , log ) ; MailboxPath mailboxPath = MailboxPath . inbox ( mailboxSession ) ; mailboxManager . startProcessingRequest ( mailboxSession ) ; try { mailboxManager . createMailbox ( mailboxPath , mailboxSession ) ; } catch ( MailboxExistsException e ) { } mailboxManager . endProcessingRequest ( mailboxSession ) ; MessageManager messageManager = mailboxManager . getMailbox ( mailboxPath , mailboxSession ) ; while ( mailRepositoryIterator . hasNext ( ) ) { Mail mail = mailRepository . retrieve ( mailRepositoryIterator . next ( ) ) ; mailboxManager . startProcessingRequest ( mailboxSession ) ; messageManager . appendMessage ( new MimeMessageInputStream ( mail . getMessage ( ) ) , new Date ( ) , mailboxSession , isRecent , flags ) ; mailboxManager . endProcessingRequest ( mailboxSession ) ; } } }
import 2 . 3 mails to 3 . 0 mails .
