@Test public void testFetchOneFolderModeIMAPWithNonDefFolder() throws KettleException, MessagingException { entry.fetchOneFolder( mailConn, false, "junitImapFolder", "junitRealOutputFolder", "junitTargetAttachmentFolder", "junitRealMoveToIMAPFolder", "junitRealFilenamePattern", 0, Mockito.mock( SimpleDateFormat.class ) ); Mockito.verify( mailConn ).openFolder( "junitImapFolder", true ); Mockito.verify( message ).setFlag( Flag.SEEN, true ); }
void fetchOneFolder( MailConnection mailConn, boolean usePOP3, String realIMAPFolder, String realOutputFolder, String targetAttachmentFolder, String realMoveToIMAPFolder, String realFilenamePattern, int nbrmailtoretrieve, SimpleDateFormat df ) throws KettleException { try { if ( !usePOP3 && !Utils.isEmpty( realIMAPFolder ) ) { mailConn.openFolder( realIMAPFolder, true ); } else { mailConn.openFolder( true ); } mailConn.retrieveMessages(); int messagesCount = mailConn.getMessagesCount(); if ( isDetailed() ) { logDetailed( BaseMessages.getString( PKG, "JobGetMailsFromPOP.TotalMessagesFolder.Label", "" + messagesCount, Const.NVL( mailConn.getFolderName(), MailConnectionMeta.INBOX_FOLDER ) ) ); } messagesCount = nbrmailtoretrieve > 0 ? ( nbrmailtoretrieve > messagesCount ? messagesCount : nbrmailtoretrieve ) : messagesCount; if ( messagesCount > 0 ) { switch ( getActionType() ) { case MailConnectionMeta.ACTION_TYPE_DELETE: if ( nbrmailtoretrieve > 0 ) { for ( int i = 0; i < messagesCount && !parentJob.isStopped(); i++ ) { mailConn.fetchNext(); mailConn.deleteMessage(); if ( isDebug() ) { logDebug( BaseMessages.getString( PKG, "JobGetMailsFromPOP.MessageDeleted", "" + i ) ); } } } else { mailConn.deleteMessages( true ); if ( isDebug() ) { logDebug( BaseMessages.getString( PKG, "JobGetMailsFromPOP.MessagesDeleted", "" + messagesCount ) ); } } break; case MailConnectionMeta.ACTION_TYPE_MOVE: if ( nbrmailtoretrieve > 0 ) { for ( int i = 0; i < messagesCount && !parentJob.isStopped(); i++ ) { mailConn.fetchNext(); mailConn.moveMessage(); if ( isDebug() ) { logDebug( BaseMessages.getString( PKG, "JobGetMailsFromPOP.MessageMoved", "" + i, realMoveToIMAPFolder ) ); } } } else { mailConn.moveMessages(); if ( isDebug() ) { logDebug( BaseMessages.getString( PKG, "JobGetMailsFromPOP.MessagesMoved", "" + messagesCount, realMoveToIMAPFolder ) ); } } break; default: for ( int i = 0; i < messagesCount && !parentJob.isStopped(); i++ ) { mailConn.fetchNext(); int messagenumber = mailConn.getMessage().getMessageNumber(); boolean okPOP3 = usePOP3 ? true : false; boolean okIMAP = !usePOP3; if ( okPOP3 || okIMAP ) { if ( isDebug() && mailConn.getMessage() != null ) { logDebug( "--------------------------------------------------" ); logDebug( BaseMessages.getString( PKG, "JobGetMailsFromPOP.MessageNumber.Label", "" + messagenumber ) ); if ( mailConn.getMessage().getReceivedDate() != null ) { logDebug( BaseMessages.getString( PKG, "JobGetMailsFromPOP.ReceivedDate.Label", df .format( mailConn.getMessage().getReceivedDate() ) ) ); } logDebug( BaseMessages.getString( PKG, "JobGetMailsFromPOP.ContentType.Label", mailConn .getMessage().getContentType() ) ); logDebug( BaseMessages.getString( PKG, "JobGetMailsFromPOP.EmailFrom.Label", Const.NVL( mailConn .getMessage().getFrom()[0].toString(), "" ) ) ); logDebug( BaseMessages.getString( PKG, "JobGetMailsFromPOP.EmailSubject.Label", Const.NVL( mailConn.getMessage().getSubject(), "" ) ) ); } if ( isSaveMessage() ) { String localfilename_message = replaceTokens( realFilenamePattern, i ); if ( isDebug() ) { logDebug( BaseMessages.getString( PKG, "JobGetMailsFromPOP.LocalFilename.Label", localfilename_message ) ); } mailConn.saveMessageContentToFile( localfilename_message, realOutputFolder ); mailConn.getMessage().setFlag( Flag.SEEN, true ); if ( isDetailed() ) { logDetailed( BaseMessages.getString( PKG, "JobGetMailsFromPOP.MessageSaved.Label", "" + messagenumber, localfilename_message, realOutputFolder ) ); } } if ( isSaveAttachment() ) { mailConn.saveAttachedFiles( targetAttachmentFolder, attachementPattern ); } if ( usePOP3 ) { if ( getDelete() ) { mailConn.deleteMessage(); if ( isDebug() ) { logDebug( BaseMessages.getString( PKG, "JobGetMailsFromPOP.MessageDeleted", "" + messagenumber ) ); } } } else { switch ( getAfterGetIMAP() ) { case MailConnectionMeta.AFTER_GET_IMAP_DELETE: mailConn.deleteMessage(); if ( isDebug() ) { logDebug( BaseMessages.getString( PKG, "JobGetMailsFromPOP.MessageDeleted", "" + messagenumber ) ); } break; case MailConnectionMeta.AFTER_GET_IMAP_MOVE: mailConn.moveMessage(); if ( isDebug() ) { logDebug( BaseMessages.getString( PKG, "JobGetMailsFromPOP.MessageMoved", "" + messagenumber, realMoveToIMAPFolder ) ); } break; default: } } } } break; } } } catch ( Exception e ) { throw new KettleException( e ); } }
JobEntryGetPOP extends JobEntryBase implements Cloneable, JobEntryInterface { void fetchOneFolder( MailConnection mailConn, boolean usePOP3, String realIMAPFolder, String realOutputFolder, String targetAttachmentFolder, String realMoveToIMAPFolder, String realFilenamePattern, int nbrmailtoretrieve, SimpleDateFormat df ) throws KettleException { try { if ( !usePOP3 && !Utils.isEmpty( realIMAPFolder ) ) { mailConn.openFolder( realIMAPFolder, true ); } else { mailConn.openFolder( true ); } mailConn.retrieveMessages(); int messagesCount = mailConn.getMessagesCount(); if ( isDetailed() ) { logDetailed( BaseMessages.getString( PKG, "JobGetMailsFromPOP.TotalMessagesFolder.Label", "" + messagesCount, Const.NVL( mailConn.getFolderName(), MailConnectionMeta.INBOX_FOLDER ) ) ); } messagesCount = nbrmailtoretrieve > 0 ? ( nbrmailtoretrieve > messagesCount ? messagesCount : nbrmailtoretrieve ) : messagesCount; if ( messagesCount > 0 ) { switch ( getActionType() ) { case MailConnectionMeta.ACTION_TYPE_DELETE: if ( nbrmailtoretrieve > 0 ) { for ( int i = 0; i < messagesCount && !parentJob.isStopped(); i++ ) { mailConn.fetchNext(); mailConn.deleteMessage(); if ( isDebug() ) { logDebug( BaseMessages.getString( PKG, "JobGetMailsFromPOP.MessageDeleted", "" + i ) ); } } } else { mailConn.deleteMessages( true ); if ( isDebug() ) { logDebug( BaseMessages.getString( PKG, "JobGetMailsFromPOP.MessagesDeleted", "" + messagesCount ) ); } } break; case MailConnectionMeta.ACTION_TYPE_MOVE: if ( nbrmailtoretrieve > 0 ) { for ( int i = 0; i < messagesCount && !parentJob.isStopped(); i++ ) { mailConn.fetchNext(); mailConn.moveMessage(); if ( isDebug() ) { logDebug( BaseMessages.getString( PKG, "JobGetMailsFromPOP.MessageMoved", "" + i, realMoveToIMAPFolder ) ); } } } else { mailConn.moveMessages(); if ( isDebug() ) { logDebug( BaseMessages.getString( PKG, "JobGetMailsFromPOP.MessagesMoved", "" + messagesCount, realMoveToIMAPFolder ) ); } } break; default: for ( int i = 0; i < messagesCount && !parentJob.isStopped(); i++ ) { mailConn.fetchNext(); int messagenumber = mailConn.getMessage().getMessageNumber(); boolean okPOP3 = usePOP3 ? true : false; boolean okIMAP = !usePOP3; if ( okPOP3 || okIMAP ) { if ( isDebug() && mailConn.getMessage() != null ) { logDebug( "--------------------------------------------------" ); logDebug( BaseMessages.getString( PKG, "JobGetMailsFromPOP.MessageNumber.Label", "" + messagenumber ) ); if ( mailConn.getMessage().getReceivedDate() != null ) { logDebug( BaseMessages.getString( PKG, "JobGetMailsFromPOP.ReceivedDate.Label", df .format( mailConn.getMessage().getReceivedDate() ) ) ); } logDebug( BaseMessages.getString( PKG, "JobGetMailsFromPOP.ContentType.Label", mailConn .getMessage().getContentType() ) ); logDebug( BaseMessages.getString( PKG, "JobGetMailsFromPOP.EmailFrom.Label", Const.NVL( mailConn .getMessage().getFrom()[0].toString(), "" ) ) ); logDebug( BaseMessages.getString( PKG, "JobGetMailsFromPOP.EmailSubject.Label", Const.NVL( mailConn.getMessage().getSubject(), "" ) ) ); } if ( isSaveMessage() ) { String localfilename_message = replaceTokens( realFilenamePattern, i ); if ( isDebug() ) { logDebug( BaseMessages.getString( PKG, "JobGetMailsFromPOP.LocalFilename.Label", localfilename_message ) ); } mailConn.saveMessageContentToFile( localfilename_message, realOutputFolder ); mailConn.getMessage().setFlag( Flag.SEEN, true ); if ( isDetailed() ) { logDetailed( BaseMessages.getString( PKG, "JobGetMailsFromPOP.MessageSaved.Label", "" + messagenumber, localfilename_message, realOutputFolder ) ); } } if ( isSaveAttachment() ) { mailConn.saveAttachedFiles( targetAttachmentFolder, attachementPattern ); } if ( usePOP3 ) { if ( getDelete() ) { mailConn.deleteMessage(); if ( isDebug() ) { logDebug( BaseMessages.getString( PKG, "JobGetMailsFromPOP.MessageDeleted", "" + messagenumber ) ); } } } else { switch ( getAfterGetIMAP() ) { case MailConnectionMeta.AFTER_GET_IMAP_DELETE: mailConn.deleteMessage(); if ( isDebug() ) { logDebug( BaseMessages.getString( PKG, "JobGetMailsFromPOP.MessageDeleted", "" + messagenumber ) ); } break; case MailConnectionMeta.AFTER_GET_IMAP_MOVE: mailConn.moveMessage(); if ( isDebug() ) { logDebug( BaseMessages.getString( PKG, "JobGetMailsFromPOP.MessageMoved", "" + messagenumber, realMoveToIMAPFolder ) ); } break; default: } } } } break; } } } catch ( Exception e ) { throw new KettleException( e ); } } }
JobEntryGetPOP extends JobEntryBase implements Cloneable, JobEntryInterface { void fetchOneFolder( MailConnection mailConn, boolean usePOP3, String realIMAPFolder, String realOutputFolder, String targetAttachmentFolder, String realMoveToIMAPFolder, String realFilenamePattern, int nbrmailtoretrieve, SimpleDateFormat df ) throws KettleException { try { if ( !usePOP3 && !Utils.isEmpty( realIMAPFolder ) ) { mailConn.openFolder( realIMAPFolder, true ); } else { mailConn.openFolder( true ); } mailConn.retrieveMessages(); int messagesCount = mailConn.getMessagesCount(); if ( isDetailed() ) { logDetailed( BaseMessages.getString( PKG, "JobGetMailsFromPOP.TotalMessagesFolder.Label", "" + messagesCount, Const.NVL( mailConn.getFolderName(), MailConnectionMeta.INBOX_FOLDER ) ) ); } messagesCount = nbrmailtoretrieve > 0 ? ( nbrmailtoretrieve > messagesCount ? messagesCount : nbrmailtoretrieve ) : messagesCount; if ( messagesCount > 0 ) { switch ( getActionType() ) { case MailConnectionMeta.ACTION_TYPE_DELETE: if ( nbrmailtoretrieve > 0 ) { for ( int i = 0; i < messagesCount && !parentJob.isStopped(); i++ ) { mailConn.fetchNext(); mailConn.deleteMessage(); if ( isDebug() ) { logDebug( BaseMessages.getString( PKG, "JobGetMailsFromPOP.MessageDeleted", "" + i ) ); } } } else { mailConn.deleteMessages( true ); if ( isDebug() ) { logDebug( BaseMessages.getString( PKG, "JobGetMailsFromPOP.MessagesDeleted", "" + messagesCount ) ); } } break; case MailConnectionMeta.ACTION_TYPE_MOVE: if ( nbrmailtoretrieve > 0 ) { for ( int i = 0; i < messagesCount && !parentJob.isStopped(); i++ ) { mailConn.fetchNext(); mailConn.moveMessage(); if ( isDebug() ) { logDebug( BaseMessages.getString( PKG, "JobGetMailsFromPOP.MessageMoved", "" + i, realMoveToIMAPFolder ) ); } } } else { mailConn.moveMessages(); if ( isDebug() ) { logDebug( BaseMessages.getString( PKG, "JobGetMailsFromPOP.MessagesMoved", "" + messagesCount, realMoveToIMAPFolder ) ); } } break; default: for ( int i = 0; i < messagesCount && !parentJob.isStopped(); i++ ) { mailConn.fetchNext(); int messagenumber = mailConn.getMessage().getMessageNumber(); boolean okPOP3 = usePOP3 ? true : false; boolean okIMAP = !usePOP3; if ( okPOP3 || okIMAP ) { if ( isDebug() && mailConn.getMessage() != null ) { logDebug( "--------------------------------------------------" ); logDebug( BaseMessages.getString( PKG, "JobGetMailsFromPOP.MessageNumber.Label", "" + messagenumber ) ); if ( mailConn.getMessage().getReceivedDate() != null ) { logDebug( BaseMessages.getString( PKG, "JobGetMailsFromPOP.ReceivedDate.Label", df .format( mailConn.getMessage().getReceivedDate() ) ) ); } logDebug( BaseMessages.getString( PKG, "JobGetMailsFromPOP.ContentType.Label", mailConn .getMessage().getContentType() ) ); logDebug( BaseMessages.getString( PKG, "JobGetMailsFromPOP.EmailFrom.Label", Const.NVL( mailConn .getMessage().getFrom()[0].toString(), "" ) ) ); logDebug( BaseMessages.getString( PKG, "JobGetMailsFromPOP.EmailSubject.Label", Const.NVL( mailConn.getMessage().getSubject(), "" ) ) ); } if ( isSaveMessage() ) { String localfilename_message = replaceTokens( realFilenamePattern, i ); if ( isDebug() ) { logDebug( BaseMessages.getString( PKG, "JobGetMailsFromPOP.LocalFilename.Label", localfilename_message ) ); } mailConn.saveMessageContentToFile( localfilename_message, realOutputFolder ); mailConn.getMessage().setFlag( Flag.SEEN, true ); if ( isDetailed() ) { logDetailed( BaseMessages.getString( PKG, "JobGetMailsFromPOP.MessageSaved.Label", "" + messagenumber, localfilename_message, realOutputFolder ) ); } } if ( isSaveAttachment() ) { mailConn.saveAttachedFiles( targetAttachmentFolder, attachementPattern ); } if ( usePOP3 ) { if ( getDelete() ) { mailConn.deleteMessage(); if ( isDebug() ) { logDebug( BaseMessages.getString( PKG, "JobGetMailsFromPOP.MessageDeleted", "" + messagenumber ) ); } } } else { switch ( getAfterGetIMAP() ) { case MailConnectionMeta.AFTER_GET_IMAP_DELETE: mailConn.deleteMessage(); if ( isDebug() ) { logDebug( BaseMessages.getString( PKG, "JobGetMailsFromPOP.MessageDeleted", "" + messagenumber ) ); } break; case MailConnectionMeta.AFTER_GET_IMAP_MOVE: mailConn.moveMessage(); if ( isDebug() ) { logDebug( BaseMessages.getString( PKG, "JobGetMailsFromPOP.MessageMoved", "" + messagenumber, realMoveToIMAPFolder ) ); } break; default: } } } } break; } } } catch ( Exception e ) { throw new KettleException( e ); } } JobEntryGetPOP( String n );  JobEntryGetPOP(); }
JobEntryGetPOP extends JobEntryBase implements Cloneable, JobEntryInterface { void fetchOneFolder( MailConnection mailConn, boolean usePOP3, String realIMAPFolder, String realOutputFolder, String targetAttachmentFolder, String realMoveToIMAPFolder, String realFilenamePattern, int nbrmailtoretrieve, SimpleDateFormat df ) throws KettleException { try { if ( !usePOP3 && !Utils.isEmpty( realIMAPFolder ) ) { mailConn.openFolder( realIMAPFolder, true ); } else { mailConn.openFolder( true ); } mailConn.retrieveMessages(); int messagesCount = mailConn.getMessagesCount(); if ( isDetailed() ) { logDetailed( BaseMessages.getString( PKG, "JobGetMailsFromPOP.TotalMessagesFolder.Label", "" + messagesCount, Const.NVL( mailConn.getFolderName(), MailConnectionMeta.INBOX_FOLDER ) ) ); } messagesCount = nbrmailtoretrieve > 0 ? ( nbrmailtoretrieve > messagesCount ? messagesCount : nbrmailtoretrieve ) : messagesCount; if ( messagesCount > 0 ) { switch ( getActionType() ) { case MailConnectionMeta.ACTION_TYPE_DELETE: if ( nbrmailtoretrieve > 0 ) { for ( int i = 0; i < messagesCount && !parentJob.isStopped(); i++ ) { mailConn.fetchNext(); mailConn.deleteMessage(); if ( isDebug() ) { logDebug( BaseMessages.getString( PKG, "JobGetMailsFromPOP.MessageDeleted", "" + i ) ); } } } else { mailConn.deleteMessages( true ); if ( isDebug() ) { logDebug( BaseMessages.getString( PKG, "JobGetMailsFromPOP.MessagesDeleted", "" + messagesCount ) ); } } break; case MailConnectionMeta.ACTION_TYPE_MOVE: if ( nbrmailtoretrieve > 0 ) { for ( int i = 0; i < messagesCount && !parentJob.isStopped(); i++ ) { mailConn.fetchNext(); mailConn.moveMessage(); if ( isDebug() ) { logDebug( BaseMessages.getString( PKG, "JobGetMailsFromPOP.MessageMoved", "" + i, realMoveToIMAPFolder ) ); } } } else { mailConn.moveMessages(); if ( isDebug() ) { logDebug( BaseMessages.getString( PKG, "JobGetMailsFromPOP.MessagesMoved", "" + messagesCount, realMoveToIMAPFolder ) ); } } break; default: for ( int i = 0; i < messagesCount && !parentJob.isStopped(); i++ ) { mailConn.fetchNext(); int messagenumber = mailConn.getMessage().getMessageNumber(); boolean okPOP3 = usePOP3 ? true : false; boolean okIMAP = !usePOP3; if ( okPOP3 || okIMAP ) { if ( isDebug() && mailConn.getMessage() != null ) { logDebug( "--------------------------------------------------" ); logDebug( BaseMessages.getString( PKG, "JobGetMailsFromPOP.MessageNumber.Label", "" + messagenumber ) ); if ( mailConn.getMessage().getReceivedDate() != null ) { logDebug( BaseMessages.getString( PKG, "JobGetMailsFromPOP.ReceivedDate.Label", df .format( mailConn.getMessage().getReceivedDate() ) ) ); } logDebug( BaseMessages.getString( PKG, "JobGetMailsFromPOP.ContentType.Label", mailConn .getMessage().getContentType() ) ); logDebug( BaseMessages.getString( PKG, "JobGetMailsFromPOP.EmailFrom.Label", Const.NVL( mailConn .getMessage().getFrom()[0].toString(), "" ) ) ); logDebug( BaseMessages.getString( PKG, "JobGetMailsFromPOP.EmailSubject.Label", Const.NVL( mailConn.getMessage().getSubject(), "" ) ) ); } if ( isSaveMessage() ) { String localfilename_message = replaceTokens( realFilenamePattern, i ); if ( isDebug() ) { logDebug( BaseMessages.getString( PKG, "JobGetMailsFromPOP.LocalFilename.Label", localfilename_message ) ); } mailConn.saveMessageContentToFile( localfilename_message, realOutputFolder ); mailConn.getMessage().setFlag( Flag.SEEN, true ); if ( isDetailed() ) { logDetailed( BaseMessages.getString( PKG, "JobGetMailsFromPOP.MessageSaved.Label", "" + messagenumber, localfilename_message, realOutputFolder ) ); } } if ( isSaveAttachment() ) { mailConn.saveAttachedFiles( targetAttachmentFolder, attachementPattern ); } if ( usePOP3 ) { if ( getDelete() ) { mailConn.deleteMessage(); if ( isDebug() ) { logDebug( BaseMessages.getString( PKG, "JobGetMailsFromPOP.MessageDeleted", "" + messagenumber ) ); } } } else { switch ( getAfterGetIMAP() ) { case MailConnectionMeta.AFTER_GET_IMAP_DELETE: mailConn.deleteMessage(); if ( isDebug() ) { logDebug( BaseMessages.getString( PKG, "JobGetMailsFromPOP.MessageDeleted", "" + messagenumber ) ); } break; case MailConnectionMeta.AFTER_GET_IMAP_MOVE: mailConn.moveMessage(); if ( isDebug() ) { logDebug( BaseMessages.getString( PKG, "JobGetMailsFromPOP.MessageMoved", "" + messagenumber, realMoveToIMAPFolder ) ); } break; default: } } } } break; } } } catch ( Exception e ) { throw new KettleException( e ); } } JobEntryGetPOP( String n );  JobEntryGetPOP(); Object clone(); String getXML(); void loadXML( Node entrynode, List<DatabaseMeta> databases, List<SlaveServer> slaveServers,
    Repository rep, IMetaStore metaStore ); int getValueImapList(); void setValueImapList( int value ); void loadRep( Repository rep, IMetaStore metaStore, ObjectId id_jobentry, List<DatabaseMeta> databases,
    List<SlaveServer> slaveServers ); void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_job ); String getPort(); String getRealPort(); void setPort( String sslport ); void setFirstMails( String firstmails ); String getFirstMails(); boolean isIncludeSubFolders(); void setIncludeSubFolders( boolean includesubfolders ); void setFirstIMAPMails( String firstmails ); String getFirstIMAPMails(); void setSenderSearchTerm( String senderSearch ); String getSenderSearchTerm(); void setNotTermSenderSearch( boolean notTermSenderSearch ); boolean isNotTermSenderSearch(); void setNotTermSubjectSearch( boolean notTermSubjectSearch ); void setNotTermBodySearch( boolean notTermBodySearch ); boolean isNotTermSubjectSearch(); boolean isNotTermBodySearch(); void setNotTermReceivedDateSearch( boolean notTermReceivedDateSearch ); boolean isNotTermReceivedDateSearch(); void setNotTermReceipientSearch( boolean notTermReceipientSearch ); boolean isNotTermReceipientSearch(); void setCreateMoveToFolder( boolean createfolder ); boolean isCreateMoveToFolder(); void setReceipientSearch( String receipientSearch ); String getReceipientSearch(); void setSubjectSearch( String subjectSearch ); String getSubjectSearch(); void setBodySearch( String bodySearch ); String getBodySearch(); String getReceivedDate1(); void setReceivedDate1( String inputDate ); String getReceivedDate2(); void setReceivedDate2( String inputDate ); void setMoveToIMAPFolder( String foldername ); String getMoveToIMAPFolder(); void setCreateLocalFolder( boolean createfolder ); boolean isCreateLocalFolder(); void setConditionOnReceivedDate( int conditionReceivedDate ); int getConditionOnReceivedDate(); void setActionType( int actiontype ); int getActionType(); void setAfterGetIMAP( int afterget ); int getAfterGetIMAP(); String getRealFirstMails(); void setServerName( String servername ); String getServerName(); void setUserName( String username ); String getUserName(); void setOutputDirectory( String outputdirectory ); void setFilenamePattern( String filenamepattern ); void setRetrievemails( int nr ); int getRetrievemails(); String getFilenamePattern(); String getOutputDirectory(); String getRealOutputDirectory(); String getRealFilenamePattern(); String getRealUsername(); String getRealServername(); String getRealProxyUsername(); String geProxyUsername(); String getPassword(); String getRealPassword( String password ); String getAttachmentFolder(); String getRealAttachmentFolder(); void setAttachmentFolder( String foldername ); void setDelete( boolean delete ); boolean getDelete(); String getProtocol(); void setProtocol( String protocol ); String getIMAPFolder(); void setIMAPFolder( String folder ); void setAttachmentWildcard( String wildcard ); String getAttachmentWildcard(); void setUseSSL( boolean usessl ); boolean isUseSSL(); boolean isUseProxy(); void setUseProxy( boolean useprox ); boolean isSaveAttachment(); void setProxyUsername( String username ); String getProxyUsername(); void setSaveAttachment( boolean saveattachment ); boolean isSaveMessage(); void setSaveMessage( boolean savemessage ); void setDifferentFolderForAttachment( boolean usedifferentfolder ); boolean isDifferentFolderForAttachment(); void setPassword( String password ); Result execute( Result previousResult, int nr ); boolean evaluates(); void check( List<CheckResultInterface> remarks, JobMeta jobMeta, VariableSpace space,
    Repository repository, IMetaStore metaStore ); List<ResourceReference> getResourceDependencies( JobMeta jobMeta ); }
JobEntryGetPOP extends JobEntryBase implements Cloneable, JobEntryInterface { void fetchOneFolder( MailConnection mailConn, boolean usePOP3, String realIMAPFolder, String realOutputFolder, String targetAttachmentFolder, String realMoveToIMAPFolder, String realFilenamePattern, int nbrmailtoretrieve, SimpleDateFormat df ) throws KettleException { try { if ( !usePOP3 && !Utils.isEmpty( realIMAPFolder ) ) { mailConn.openFolder( realIMAPFolder, true ); } else { mailConn.openFolder( true ); } mailConn.retrieveMessages(); int messagesCount = mailConn.getMessagesCount(); if ( isDetailed() ) { logDetailed( BaseMessages.getString( PKG, "JobGetMailsFromPOP.TotalMessagesFolder.Label", "" + messagesCount, Const.NVL( mailConn.getFolderName(), MailConnectionMeta.INBOX_FOLDER ) ) ); } messagesCount = nbrmailtoretrieve > 0 ? ( nbrmailtoretrieve > messagesCount ? messagesCount : nbrmailtoretrieve ) : messagesCount; if ( messagesCount > 0 ) { switch ( getActionType() ) { case MailConnectionMeta.ACTION_TYPE_DELETE: if ( nbrmailtoretrieve > 0 ) { for ( int i = 0; i < messagesCount && !parentJob.isStopped(); i++ ) { mailConn.fetchNext(); mailConn.deleteMessage(); if ( isDebug() ) { logDebug( BaseMessages.getString( PKG, "JobGetMailsFromPOP.MessageDeleted", "" + i ) ); } } } else { mailConn.deleteMessages( true ); if ( isDebug() ) { logDebug( BaseMessages.getString( PKG, "JobGetMailsFromPOP.MessagesDeleted", "" + messagesCount ) ); } } break; case MailConnectionMeta.ACTION_TYPE_MOVE: if ( nbrmailtoretrieve > 0 ) { for ( int i = 0; i < messagesCount && !parentJob.isStopped(); i++ ) { mailConn.fetchNext(); mailConn.moveMessage(); if ( isDebug() ) { logDebug( BaseMessages.getString( PKG, "JobGetMailsFromPOP.MessageMoved", "" + i, realMoveToIMAPFolder ) ); } } } else { mailConn.moveMessages(); if ( isDebug() ) { logDebug( BaseMessages.getString( PKG, "JobGetMailsFromPOP.MessagesMoved", "" + messagesCount, realMoveToIMAPFolder ) ); } } break; default: for ( int i = 0; i < messagesCount && !parentJob.isStopped(); i++ ) { mailConn.fetchNext(); int messagenumber = mailConn.getMessage().getMessageNumber(); boolean okPOP3 = usePOP3 ? true : false; boolean okIMAP = !usePOP3; if ( okPOP3 || okIMAP ) { if ( isDebug() && mailConn.getMessage() != null ) { logDebug( "--------------------------------------------------" ); logDebug( BaseMessages.getString( PKG, "JobGetMailsFromPOP.MessageNumber.Label", "" + messagenumber ) ); if ( mailConn.getMessage().getReceivedDate() != null ) { logDebug( BaseMessages.getString( PKG, "JobGetMailsFromPOP.ReceivedDate.Label", df .format( mailConn.getMessage().getReceivedDate() ) ) ); } logDebug( BaseMessages.getString( PKG, "JobGetMailsFromPOP.ContentType.Label", mailConn .getMessage().getContentType() ) ); logDebug( BaseMessages.getString( PKG, "JobGetMailsFromPOP.EmailFrom.Label", Const.NVL( mailConn .getMessage().getFrom()[0].toString(), "" ) ) ); logDebug( BaseMessages.getString( PKG, "JobGetMailsFromPOP.EmailSubject.Label", Const.NVL( mailConn.getMessage().getSubject(), "" ) ) ); } if ( isSaveMessage() ) { String localfilename_message = replaceTokens( realFilenamePattern, i ); if ( isDebug() ) { logDebug( BaseMessages.getString( PKG, "JobGetMailsFromPOP.LocalFilename.Label", localfilename_message ) ); } mailConn.saveMessageContentToFile( localfilename_message, realOutputFolder ); mailConn.getMessage().setFlag( Flag.SEEN, true ); if ( isDetailed() ) { logDetailed( BaseMessages.getString( PKG, "JobGetMailsFromPOP.MessageSaved.Label", "" + messagenumber, localfilename_message, realOutputFolder ) ); } } if ( isSaveAttachment() ) { mailConn.saveAttachedFiles( targetAttachmentFolder, attachementPattern ); } if ( usePOP3 ) { if ( getDelete() ) { mailConn.deleteMessage(); if ( isDebug() ) { logDebug( BaseMessages.getString( PKG, "JobGetMailsFromPOP.MessageDeleted", "" + messagenumber ) ); } } } else { switch ( getAfterGetIMAP() ) { case MailConnectionMeta.AFTER_GET_IMAP_DELETE: mailConn.deleteMessage(); if ( isDebug() ) { logDebug( BaseMessages.getString( PKG, "JobGetMailsFromPOP.MessageDeleted", "" + messagenumber ) ); } break; case MailConnectionMeta.AFTER_GET_IMAP_MOVE: mailConn.moveMessage(); if ( isDebug() ) { logDebug( BaseMessages.getString( PKG, "JobGetMailsFromPOP.MessageMoved", "" + messagenumber, realMoveToIMAPFolder ) ); } break; default: } } } } break; } } } catch ( Exception e ) { throw new KettleException( e ); } } JobEntryGetPOP( String n );  JobEntryGetPOP(); Object clone(); String getXML(); void loadXML( Node entrynode, List<DatabaseMeta> databases, List<SlaveServer> slaveServers,
    Repository rep, IMetaStore metaStore ); int getValueImapList(); void setValueImapList( int value ); void loadRep( Repository rep, IMetaStore metaStore, ObjectId id_jobentry, List<DatabaseMeta> databases,
    List<SlaveServer> slaveServers ); void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_job ); String getPort(); String getRealPort(); void setPort( String sslport ); void setFirstMails( String firstmails ); String getFirstMails(); boolean isIncludeSubFolders(); void setIncludeSubFolders( boolean includesubfolders ); void setFirstIMAPMails( String firstmails ); String getFirstIMAPMails(); void setSenderSearchTerm( String senderSearch ); String getSenderSearchTerm(); void setNotTermSenderSearch( boolean notTermSenderSearch ); boolean isNotTermSenderSearch(); void setNotTermSubjectSearch( boolean notTermSubjectSearch ); void setNotTermBodySearch( boolean notTermBodySearch ); boolean isNotTermSubjectSearch(); boolean isNotTermBodySearch(); void setNotTermReceivedDateSearch( boolean notTermReceivedDateSearch ); boolean isNotTermReceivedDateSearch(); void setNotTermReceipientSearch( boolean notTermReceipientSearch ); boolean isNotTermReceipientSearch(); void setCreateMoveToFolder( boolean createfolder ); boolean isCreateMoveToFolder(); void setReceipientSearch( String receipientSearch ); String getReceipientSearch(); void setSubjectSearch( String subjectSearch ); String getSubjectSearch(); void setBodySearch( String bodySearch ); String getBodySearch(); String getReceivedDate1(); void setReceivedDate1( String inputDate ); String getReceivedDate2(); void setReceivedDate2( String inputDate ); void setMoveToIMAPFolder( String foldername ); String getMoveToIMAPFolder(); void setCreateLocalFolder( boolean createfolder ); boolean isCreateLocalFolder(); void setConditionOnReceivedDate( int conditionReceivedDate ); int getConditionOnReceivedDate(); void setActionType( int actiontype ); int getActionType(); void setAfterGetIMAP( int afterget ); int getAfterGetIMAP(); String getRealFirstMails(); void setServerName( String servername ); String getServerName(); void setUserName( String username ); String getUserName(); void setOutputDirectory( String outputdirectory ); void setFilenamePattern( String filenamepattern ); void setRetrievemails( int nr ); int getRetrievemails(); String getFilenamePattern(); String getOutputDirectory(); String getRealOutputDirectory(); String getRealFilenamePattern(); String getRealUsername(); String getRealServername(); String getRealProxyUsername(); String geProxyUsername(); String getPassword(); String getRealPassword( String password ); String getAttachmentFolder(); String getRealAttachmentFolder(); void setAttachmentFolder( String foldername ); void setDelete( boolean delete ); boolean getDelete(); String getProtocol(); void setProtocol( String protocol ); String getIMAPFolder(); void setIMAPFolder( String folder ); void setAttachmentWildcard( String wildcard ); String getAttachmentWildcard(); void setUseSSL( boolean usessl ); boolean isUseSSL(); boolean isUseProxy(); void setUseProxy( boolean useprox ); boolean isSaveAttachment(); void setProxyUsername( String username ); String getProxyUsername(); void setSaveAttachment( boolean saveattachment ); boolean isSaveMessage(); void setSaveMessage( boolean savemessage ); void setDifferentFolderForAttachment( boolean usedifferentfolder ); boolean isDifferentFolderForAttachment(); void setPassword( String password ); Result execute( Result previousResult, int nr ); boolean evaluates(); void check( List<CheckResultInterface> remarks, JobMeta jobMeta, VariableSpace space,
    Repository repository, IMetaStore metaStore ); List<ResourceReference> getResourceDependencies( JobMeta jobMeta ); public int actiontype; public int conditionReceivedDate; public int valueimaplist; public int aftergetimap; public int retrievemails; static final String DATE_PATTERN; }