Package org.compiere.process
Class RequestEMailProcessor
java.lang.Object
org.compiere.process.SvrProcess
org.compiere.process.RequestEMailProcessor
- All Implemented Interfaces:
ProcessCall,EmailSrv.ProcessEmailHandle
Request Email Processor
- Version:
- $Id: RequestEMailProcessor.java,v 1.2 2006/10/23 06:01:20 cruiz Exp $ hieplq:separate email process to other class for easy re-use and do IDEMPIERE-2244 IMAPHost format: {imap|imaps}://[IMAPHostURL]:[Port] example: imaps://imap.gmail.com:993
- Author:
- Carlos Ruiz based on initial work by Jorg Janke - sponsored by DigitalArmour
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intprotected intprotected intprotected static final intProcess Errorprotected javax.mail.Folderprotected Booleanprotected List<javax.mail.Folder>protected javax.mail.SessionSessionprotected javax.mail.StoreStoreprotected intprotected intprotected intprotected Stringprotected Stringprotected Stringprotected Stringprotected Stringprotected intprotected Stringprotected Stringprotected Stringprotected Booleanprotected Stringprotected intprotected static final intProcess Requestprotected javax.mail.Folderprotected intFields inherited from class org.compiere.process.SvrProcess
log, MSG_InvalidArguments, MSG_SaveErrorRowNotFound, PROCESS_INFO_CTX_KEY, PROCESS_UI_CTX_KEY, processUI -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancheckEmailHeader(EmailSrv.EmailContent emailHeader, javax.mail.Message emailRaw) after read header of email (from, subject, message_id,...), will call this function to evaluate will continue process or cancel this email at this time, in EmailInfo just has header info, content and attach is not manipulateprotected voidcheckInputParameter(EmailSrv emailSrv) protected voidcreateRequest(EmailSrv.EmailContent emailContent, String trxName) Create requestprotected StringdoIt()Perform process.List<javax.mail.Folder>List all folder use when process message this function make handle close folder and close session can reopen it.protected voidprotected voidprepare()Prepare - e.g., get Parameters.voidprocessEmailContent(EmailSrv.EmailContent emailHeader, javax.mail.Message emailRaw, javax.mail.Store mailStore, javax.mail.Folder mailFolder) main where to process email. this time, every email info is manipulate to emailContentvoidprocessEmailError(EmailSrv.EmailContent emailHeader, javax.mail.Message emailRaw, javax.mail.Store mailStore, javax.mail.Folder mailFolder) when read email for process, after some time try when has error, will call this function to ensure this email is can't processprotected voidupdateRequest(int request_upd, EmailSrv.EmailContent emailContent, String trxName) Methods inherited from class org.compiere.process.SvrProcess
addBufferLog, addLog, addLog, addLog, commit, commitEx, doIt, get_TrxName, getAD_Client_ID, getAD_PInstance_ID, getAD_User_ID, getCtx, getName, getParameter, getProcessInfo, getRecord_ID, getRecord_IDs, getRecord_UU, getRecord_UUs, getTable_ID, isLocked, lockObject, postProcess, rollback, saveProgress, saveStatus, setProcessUI, startProcess, statusUpdate, unlockObject, updateProgress
-
Field Details
-
p_IMAPHost
-
p_IMAPPort
protected int p_IMAPPort -
p_IMAPUser
-
p_IMAPPwd
-
p_RequestFolder
-
p_InboxFolder
-
p_NestInbox
-
p_ErrorFolder
-
isSSL
-
C_BPartner_ID
protected int C_BPartner_ID -
AD_User_ID
protected int AD_User_ID -
AD_Role_ID
protected int AD_Role_ID -
SalesRep_ID
protected int SalesRep_ID -
R_RequestType_ID
protected int R_RequestType_ID -
p_DefaultPriority
-
p_DefaultConfidentiality
-
p_HTMLAttachmentType
-
noProcessed
protected int noProcessed -
noRequest
protected int noRequest -
noError
protected int noError -
m_session
protected javax.mail.Session m_sessionSession -
m_store
protected javax.mail.Store m_storeStore -
ERROR
protected static final int ERRORProcess Error- See Also:
-
REQUEST
protected static final int REQUESTProcess Request- See Also:
-
errorFolder
protected javax.mail.Folder errorFolder -
requestFolder
protected javax.mail.Folder requestFolder -
lsFolderProcess
-
-
Constructor Details
-
RequestEMailProcessor
public RequestEMailProcessor()
-
-
Method Details
-
prepare
protected void prepare()Prepare - e.g., get Parameters.- Specified by:
preparein classSvrProcess- See Also:
-
doIt
Perform process.- Specified by:
doItin classSvrProcess- Returns:
- Message (clear text)
- Throws:
Exception- if not successful
-
parseParameter
protected void parseParameter() -
checkInputParameter
protected void checkInputParameter(EmailSrv emailSrv) throws javax.mail.MessagingException, Exception - Throws:
javax.mail.MessagingExceptionException
-
checkEmailHeader
public boolean checkEmailHeader(EmailSrv.EmailContent emailHeader, javax.mail.Message emailRaw) throws javax.mail.MessagingException Description copied from interface:EmailSrv.ProcessEmailHandleafter read header of email (from, subject, message_id,...), will call this function to evaluate will continue process or cancel this email at this time, in EmailInfo just has header info, content and attach is not manipulate- Specified by:
checkEmailHeaderin interfaceEmailSrv.ProcessEmailHandle- Returns:
- Throws:
javax.mail.MessagingException
-
processEmailContent
public void processEmailContent(EmailSrv.EmailContent emailHeader, javax.mail.Message emailRaw, javax.mail.Store mailStore, javax.mail.Folder mailFolder) throws javax.mail.MessagingException, IOException Description copied from interface:EmailSrv.ProcessEmailHandlemain where to process email. this time, every email info is manipulate to emailContent- Specified by:
processEmailContentin interfaceEmailSrv.ProcessEmailHandle- Throws:
javax.mail.MessagingExceptionIOException
-
createRequest
Create request- Parameters:
emailContent-trxName-- Throws:
Exception
-
updateRequest
protected void updateRequest(int request_upd, EmailSrv.EmailContent emailContent, String trxName) throws javax.mail.MessagingException, SQLException - Throws:
javax.mail.MessagingExceptionSQLException
-
processEmailError
public void processEmailError(EmailSrv.EmailContent emailHeader, javax.mail.Message emailRaw, javax.mail.Store mailStore, javax.mail.Folder mailFolder) throws javax.mail.MessagingException Description copied from interface:EmailSrv.ProcessEmailHandlewhen read email for process, after some time try when has error, will call this function to ensure this email is can't process- Specified by:
processEmailErrorin interfaceEmailSrv.ProcessEmailHandle- Throws:
javax.mail.MessagingException
-
getListFolder
Description copied from interface:EmailSrv.ProcessEmailHandleList all folder use when process message this function make handle close folder and close session can reopen it.- Specified by:
getListFolderin interfaceEmailSrv.ProcessEmailHandle- Returns:
-