public abstract class

BaseGmailConnector

extends AbstractGoogleOAuthConnector
java.lang.Object
   ↳ org.mule.modules.google.AbstractGoogleOAuthConnector
     ↳ org.mule.module.gmail.BaseGmailConnector
Known Direct Subclasses
Known Indirect Subclasses

Summary

[Expand]
Inherited Constants
From class org.mule.modules.google.AbstractGoogleOAuthConnector
[Expand]
Inherited Fields
From class org.mule.modules.google.AbstractGoogleOAuthConnector
Public Constructors
BaseGmailConnector()
Public Methods
List<MailMessage> advancedSearch(String username, String password, GmailFolder folder, SearchTerm searchTerm, Boolean expunge, Boolean includeAttachments)
Search and returns messages on a folder of the given username using a search criteria provided by the user via the searchTerm parameter.
void delete(MailMessage mailMessage, String username, String password)
Moves the given message to the trash and deletes it from its current folder
List<MailMessage> search(String username, GmailFolder folder, String password, String receivedBefore, String receivedAfter, String sentBefore, String sentAfter, List<String> fromAddresses, List<String> toAddresses, Integer messageNumber, SearchCriteria size, List<FlagCriteria> flags, List<String> labels, List<String> rawSearchTerms, String threadId, List<String> bodyTerms, List<String> headerTerms, String messageId, List<String> subjectTerms, String dateFormat, Boolean expunge, Boolean includeAttachments)
Returns messages in the user mailbox applying optional search criterias.
Protected Methods
abstract Store getStore(String username, String password)
[Expand]
Inherited Methods
From class org.mule.modules.google.AbstractGoogleOAuthConnector
From class java.lang.Object

Public Constructors

public BaseGmailConnector ()

Public Methods

public List<MailMessage> advancedSearch (String username, String password, GmailFolder folder, SearchTerm searchTerm, Boolean expunge, Boolean includeAttachments)

Search and returns messages on a folder of the given username using a search criteria provided by the user via the searchTerm parameter. Returns messages in the user mailbox applying optional search criterias. The messages are returned in the form of MailMessage instances which allows the connector's user to be decoupled from the IMAP protocol internals but also allows for the mailbox connection to be closed automatically.

Parameters
username The account's username
password Only needed is you're using basic authentication. If you're using OAuth2 then this parameter is not used
folder The folder in which to search. If you want all of them then use ALL_MAIL
searchTerm An instance of SearchTerm. If not provided, then no filtering criteria is applied
expunge If true, all read messages will be deleted upon operation completion
includeAttachments Wether or not to also download the message's attachments. Default value is false bandwidth wise.
Returns
Throws
MessagingException if an error is found accessing the mailbox

public void delete (MailMessage mailMessage, String username, String password)

Moves the given message to the trash and deletes it from its current folder

Parameters
mailMessage An instance of MailMessage representing the message to be deleted. At the very least, the googleId property must be not null
username The mailbox username
password Optional value only required when using basic auth. Ignore this if you're using OAuth
Throws
MessagingException if the mailbox throws an exception
IllegalArgumentException if the mailbox contains no email with that id

public List<MailMessage> search (String username, GmailFolder folder, String password, String receivedBefore, String receivedAfter, String sentBefore, String sentAfter, List<String> fromAddresses, List<String> toAddresses, Integer messageNumber, SearchCriteria size, List<FlagCriteria> flags, List<String> labels, List<String> rawSearchTerms, String threadId, List<String> bodyTerms, List<String> headerTerms, String messageId, List<String> subjectTerms, String dateFormat, Boolean expunge, Boolean includeAttachments)

Returns messages in the user mailbox applying optional search criterias. The messages are returned in the form of MailMessage instances which allows the connector's user to be decoupled from the IMAP protocol internals but also allows for the mailbox connection to be closed automatically.

Parameters
username The account's username
folder The folder in which to search. If you want all of them then use ALL_MAIL
password Only needed is you're using basic authentication. If you're using OAuth2 then this parameter is not used
receivedBefore A date in the specified string format giving a lower bound filter to the received date. If no dateFormat is specified, then RFC3339 is assumed
receivedAfter A date in the specified string format giving an upper bound filter to the received date. If no dateFormat is specified, then RFC3339 is assumed
sentBefore A date in the specified string format giving a lower bound filter to the sent date. If no dateFormat is specified, then RFC3339 is assumed
sentAfter A date in the specified string format giving an upper bound filter to the sent date. If no dateFormat is specified, then RFC3339 is assumed
fromAddresses A list of addresses to be found in the from attribute. This is an OR operation logic. All messages with any one of these addresses will be returned
toAddresses A list of addresses to be found in the to attribute. This is an OR operation logic. All messages with any one of these addresses will be returned
messageNumber Used to look for the message with the specified number
size An instance of SearchCriteria to specify restrictions on the message's size
flags A list of FlagCriteria to specify flag values that the messages should have
labels A list of Strings which represent the labels that the messages need to have. This is an OR operation logic. All messages with any one of these labels will be returned
rawSearchTerms A list of Strings which represent terms that the message should have. This is an OR operation logic. All messages with any one of these terms will be returned
threadId The id of the thread for which the message should belong
bodyTerms A list of Strings which represent the body terms that the messages need to have. This is an OR operation logic. All messages with any one of these terms will be returned
headerTerms A list of Strings which represent the header terms that the messages need to have. This is an OR operation logic. All messages with any one of these terms will be returned
messageId Used to fetch one given message by id
subjectTerms A list of Strings which represent the subject terms that the messages need to have. This is an OR operation logic. All messages with any one of these terms will be returned
dateFormat The format to be used to parse the date attributes. If no dateFormat is specified, then RFC3339 is assumed
expunge If true, all read messages will be deleted upon operation completion
includeAttachments Wether or not to also download the message's attachments. Default value is false bandwidth wise.
Returns
Throws
MessagingException if an error is found accessing the mailbox

Protected Methods

protected abstract Store getStore (String username, String password)

Parameters
username
password