Package adams.flow.source.imapsource
Class ReceiveEmail
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.flow.source.imapsource.AbstractIMAPOperation<O>
-
- adams.flow.source.imapsource.AbstractIMAPFolderOperation<jodd.mail.ReceivedEmail[]>
-
- adams.flow.source.imapsource.ReceiveEmail
-
- All Implemented Interfaces:
Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,QuickInfoSupporter
,SizeOfHandler
,Serializable
public class ReceiveEmail extends AbstractIMAPFolderOperation<jodd.mail.ReceivedEmail[]>
Receives emails according to the filters.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected Flag[]
m_Flags
the flags to look for.protected String
m_From
the FROM filter.protected boolean
m_OnlyEnvelopes
whether to received only envelopes.protected PostReceptionAction
m_PostReceptionAction
the action to perform after receiving.protected String
m_Subject
the SUBJECT filter.protected String
m_To
the TO filter.-
Fields inherited from class adams.flow.source.imapsource.AbstractIMAPFolderOperation
m_Folder
-
Fields inherited from class adams.core.option.AbstractOptionHandler
m_OptionManager
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description ReceiveEmail()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
defineOptions()
Adds options to the internal list of options.protected jodd.mail.ReceivedEmail[]
doExecute(IMAPConnection conn, MessageCollection errors)
Executes the operation and returns the generated output.String
flagsTipText()
Returns the tip text for this property.String
fromTipText()
Returns the tip text for this property.Class
generates()
Returns the type of output the operation generates.Flag[]
getFlags()
Returns the flags to look for.String
getFrom()
Returns the FROM filter, ignored if empty.boolean
getOnlyEnvelopes()
Returns whether to only receive the envelopes or fully download them.PostReceptionAction
getPostReceptionAction()
Returns the action to perform after receiving the full messages (does not apply to envelopes).String
getQuickInfo()
Returns a quick info about the object, which can be displayed in the GUI.String
getSubject()
Returns the SUBJECT filter, ignored if empty.String
getTo()
Returns the TO filter, ignored if empty.String
globalInfo()
Returns a string describing the object.String
onlyEnvelopesTipText()
Returns the tip text for this property.String
postReceptionActionTipText()
Returns the tip text for this property.void
setFlags(Flag[] value)
Sets the flags to look for.void
setFrom(String value)
Sets the FROM filter, ignored if empty.void
setOnlyEnvelopes(boolean value)
Sets whether to only receive the envelopes or fully download them.void
setPostReceptionAction(PostReceptionAction value)
Sets the action to perform after receiving the full messages (does not apply to envelopes).void
setSubject(String value)
Sets the SUBJECT filter, ignored if empty.void
setTo(String value)
Sets the TO filter, ignored if empty.String
subjectTipText()
Returns the tip text for this property.String
toTipText()
Returns the tip text for this property.-
Methods inherited from class adams.flow.source.imapsource.AbstractIMAPFolderOperation
check, folderTipText, getDefaultFolder, getFolder, setFolder
-
Methods inherited from class adams.flow.source.imapsource.AbstractIMAPOperation
execute
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, initialize, loggingLevelTipText, newOptionManager, reset, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
-
-
-
Field Detail
-
m_OnlyEnvelopes
protected boolean m_OnlyEnvelopes
whether to received only envelopes.
-
m_From
protected String m_From
the FROM filter.
-
m_To
protected String m_To
the TO filter.
-
m_Subject
protected String m_Subject
the SUBJECT filter.
-
m_Flags
protected Flag[] m_Flags
the flags to look for.
-
m_PostReceptionAction
protected PostReceptionAction m_PostReceptionAction
the action to perform after receiving.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfo
in interfaceGlobalInfoSupporter
- Specified by:
globalInfo
in classAbstractOptionHandler
- Returns:
- a description suitable for displaying in the gui
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptions
in interfaceOptionHandler
- Overrides:
defineOptions
in classAbstractIMAPFolderOperation<jodd.mail.ReceivedEmail[]>
-
setOnlyEnvelopes
public void setOnlyEnvelopes(boolean value)
Sets whether to only receive the envelopes or fully download them.- Parameters:
value
- true if to receive only the envelopes
-
getOnlyEnvelopes
public boolean getOnlyEnvelopes()
Returns whether to only receive the envelopes or fully download them.- Returns:
- true if to mark read
-
onlyEnvelopesTipText
public String onlyEnvelopesTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setFrom
public void setFrom(String value)
Sets the FROM filter, ignored if empty.- Parameters:
value
- the filter value
-
getFrom
public String getFrom()
Returns the FROM filter, ignored if empty.- Returns:
- the filter value
-
fromTipText
public String fromTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setTo
public void setTo(String value)
Sets the TO filter, ignored if empty.- Parameters:
value
- the filter value
-
getTo
public String getTo()
Returns the TO filter, ignored if empty.- Returns:
- the filter value
-
toTipText
public String toTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setSubject
public void setSubject(String value)
Sets the SUBJECT filter, ignored if empty.- Parameters:
value
- the filter value
-
getSubject
public String getSubject()
Returns the SUBJECT filter, ignored if empty.- Returns:
- the filter value
-
subjectTipText
public String subjectTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setFlags
public void setFlags(Flag[] value)
Sets the flags to look for.- Parameters:
value
- the flags
-
getFlags
public Flag[] getFlags()
Returns the flags to look for.- Returns:
- the flags
-
flagsTipText
public String flagsTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setPostReceptionAction
public void setPostReceptionAction(PostReceptionAction value)
Sets the action to perform after receiving the full messages (does not apply to envelopes).- Parameters:
value
- the action
-
getPostReceptionAction
public PostReceptionAction getPostReceptionAction()
Returns the action to perform after receiving the full messages (does not apply to envelopes).- Returns:
- the action
-
postReceptionActionTipText
public String postReceptionActionTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
getQuickInfo
public String getQuickInfo()
Returns a quick info about the object, which can be displayed in the GUI.- Specified by:
getQuickInfo
in interfaceQuickInfoSupporter
- Overrides:
getQuickInfo
in classAbstractIMAPFolderOperation<jodd.mail.ReceivedEmail[]>
- Returns:
- null if no info available, otherwise short string
-
generates
public Class generates()
Returns the type of output the operation generates.- Specified by:
generates
in classAbstractIMAPOperation<jodd.mail.ReceivedEmail[]>
- Returns:
- the class
-
doExecute
protected jodd.mail.ReceivedEmail[] doExecute(IMAPConnection conn, MessageCollection errors)
Executes the operation and returns the generated output.- Specified by:
doExecute
in classAbstractIMAPOperation<jodd.mail.ReceivedEmail[]>
- Parameters:
conn
- the connection to useerrors
- for collecting errors- Returns:
- the generated output, null in case of error or failed check
-
-