|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcern.jira.emailhandler.MessageParser
public class MessageParser
A class containing some useful method to parse a message.
Released under the BSD License: see file license.txt for details.
Field Summary | |
---|---|
private static Category |
log
|
static java.lang.String |
REGEX_ANYCHAR
Regex for "any number of characters, even zero". |
Constructor Summary | |
---|---|
MessageParser()
|
Method Summary | |
---|---|
static java.lang.String |
emailAddressToRegex(java.lang.String emailAddress)
Transforms an email address into a regular expression matching that address. |
static java.lang.String |
getFullnameFromHeader(java.lang.String emailAddress,
java.lang.String fullEmail)
Extract the "Full Name" part from a full email address (which could be contained in a From:, To:, Cc:, or Bcc: header). |
static java.lang.String |
getRecipientFromMessage(java.lang.String recipient,
Message message)
Retrieves the To:, CCc:, or Bcc: header purporting to a given recipient of a email message. |
static IssueDescriptor |
parse(Message message,
java.lang.String[] emailAddresses)
Parses a message that contains directives about an issue. |
private static void |
parseSubject(java.lang.String subject,
IssueDescriptorImpl issue)
Extracts issue attributes from the email subject and assign them to
issue . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final Category log
public static final java.lang.String REGEX_ANYCHAR
Constructor Detail |
---|
public MessageParser()
Method Detail |
---|
public static final IssueDescriptor parse(Message message, java.lang.String[] emailAddresses)
message
- the message to parseemailAddresses
- an array defining all JIRA email addresses
message
private static final void parseSubject(java.lang.String subject, IssueDescriptorImpl issue)
subject
and assign them to
issue
.
public static final java.lang.String getRecipientFromMessage(java.lang.String recipient, Message message) throws MessagingException
recipient
- a regex describing the recipient email addressmessage
- an email message
message
containing recipient
,
or null
if the recipient
was not found
MessagingException
- if there were problems handling the messagepublic static final java.lang.String getFullnameFromHeader(java.lang.String emailAddress, java.lang.String fullEmail)
fullEmail
is "Arthur Dent <arthur@vogon.org>" and
emailAddress
is "arthur@vogon\\.org", it returns "Arthur Dent".
This method correctly manages the fact that the emailclient could surround
email address and/or full name with characters like <> " ' ()
, etc.
emailAddress
- a regex specifying the bare email address to extractfullEmail
- the full email address
public static final java.lang.String emailAddressToRegex(java.lang.String emailAddress)
emailAddress
- an email address of kind user.login@domain.xx
emailAddress
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |