public final class MessageParser
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static javax.mail.internet.InternetAddress[] |
getFromField(org.json.JSONObject jo)
Parses "From" field out of passed JSON object.
|
static void |
parse(org.json.JSONObject jsonObj,
MailMessage mail,
com.openexchange.session.Session session,
int accountId)
Parses given instance of
JSONObject to given instance of MailMessage. |
static void |
parse(org.json.JSONObject jsonObj,
MailMessage mail,
java.util.TimeZone timeZone,
com.openexchange.session.Session session,
int accountId)
Parses given instance of
JSONObject to given instance of MailMessage. |
static ComposedMailMessage |
parse4Draft(org.json.JSONObject jsonObj,
com.openexchange.groupware.upload.impl.UploadEvent uploadEvent,
com.openexchange.session.Session session,
int accountId,
java.util.List<com.openexchange.exception.OXException> warnings)
Completely parses given instance of
JSONObject and given instance of UploadEvent to a corresponding
ComposedMailMessage object dedicated for being saved as a draft message. |
static ComposedMailMessage[] |
parse4Transport(org.json.JSONObject jsonObj,
com.openexchange.groupware.upload.impl.UploadEvent uploadEvent,
com.openexchange.session.Session session,
int accountId,
java.lang.String protocol,
java.lang.String hostName,
java.util.List<com.openexchange.exception.OXException> warnings)
Completely parses given instance of
JSONObject and given instance of UploadEvent to corresponding
ComposedMailMessage objects dedicated for being sent. |
static javax.mail.internet.InternetAddress[] |
parseAddressKey(java.lang.String key,
org.json.JSONObject jo)
Parses address field out of passed JSON object.
|
static javax.mail.internet.InternetAddress[] |
parseAddressKey(java.lang.String key,
org.json.JSONObject jo,
boolean failOnError)
Parses address field out of passed JSON object.
|
static void |
parseBasics(org.json.JSONObject jsonObj,
MailMessage mail,
java.util.TimeZone timeZone)
Takes a mail as jsonObj and extracts the values into a given MailMessage object.
|
public static ComposedMailMessage parse4Draft(org.json.JSONObject jsonObj, com.openexchange.groupware.upload.impl.UploadEvent uploadEvent, com.openexchange.session.Session session, int accountId, java.util.List<com.openexchange.exception.OXException> warnings) throws com.openexchange.exception.OXException
JSONObject and given instance of UploadEvent to a corresponding
ComposedMailMessage object dedicated for being saved as a draft message. Moreover the user's quota limitations are
considered.jsonObj - The JSON objectuploadEvent - The upload event containing the uploaded files to attachsession - The sessionaccountId - The account IDwarnings - monitor - The monitorComposedMailMessagecom.openexchange.exception.OXException - If parsing failspublic static ComposedMailMessage[] parse4Transport(org.json.JSONObject jsonObj, com.openexchange.groupware.upload.impl.UploadEvent uploadEvent, com.openexchange.session.Session session, int accountId, java.lang.String protocol, java.lang.String hostName, java.util.List<com.openexchange.exception.OXException> warnings) throws com.openexchange.exception.OXException
JSONObject and given instance of UploadEvent to corresponding
ComposedMailMessage objects dedicated for being sent. Moreover the user's quota limitations are considered.jsonObj - The JSON objectuploadEvent - The upload event containing the uploaded files to attachsession - The sessionaccountId - The account IDprotocol - The server's protocolwarnings - monitor - The monitorhostname - The server's host nameComposedMailMessagecom.openexchange.exception.OXException - If parsing failspublic static void parse(org.json.JSONObject jsonObj,
MailMessage mail,
com.openexchange.session.Session session,
int accountId)
throws com.openexchange.exception.OXException
JSONObject to given instance of MailMessage. Moreover the user's quota limitations are
considered.jsonObj - The JSON object (source)mail - The mail(target), which should be emptysession - The sessionaccountId - The account IDcom.openexchange.exception.OXException - If parsing failspublic static void parse(org.json.JSONObject jsonObj,
MailMessage mail,
java.util.TimeZone timeZone,
com.openexchange.session.Session session,
int accountId)
throws com.openexchange.exception.OXException
JSONObject to given instance of MailMessage. Moreover the user's quota limitations are
considered.jsonObj - The JSON object (source)mail - The mail(target), which should be emptytimeZone - The user time zonesession - The sessionaccountId - The account IDcom.openexchange.exception.OXException - If parsing failspublic static void parseBasics(org.json.JSONObject jsonObj,
MailMessage mail,
java.util.TimeZone timeZone)
throws org.json.JSONException,
javax.mail.internet.AddressException,
com.openexchange.exception.OXException
jsonObj - mail - timeZone - org.json.JSONExceptionjavax.mail.internet.AddressExceptioncom.openexchange.exception.OXExceptionpublic static javax.mail.internet.InternetAddress[] getFromField(org.json.JSONObject jo)
throws javax.mail.internet.AddressException,
org.json.JSONException
jo - The JSON objectjavax.mail.internet.AddressException - If parsing the address failsorg.json.JSONException - If a JSON error occurredpublic static javax.mail.internet.InternetAddress[] parseAddressKey(java.lang.String key,
org.json.JSONObject jo)
throws org.json.JSONException,
javax.mail.internet.AddressException
key - The key of the address fieldjo - The JSON objectorg.json.JSONException - If a JSON error occurredjavax.mail.internet.AddressException - If parsing an address failspublic static javax.mail.internet.InternetAddress[] parseAddressKey(java.lang.String key,
org.json.JSONObject jo,
boolean failOnError)
throws org.json.JSONException,
javax.mail.internet.AddressException
key - The key of the address fieldjo - The JSON objectorg.json.JSONException - If a JSON error occurredjavax.mail.internet.AddressException - If parsing an address fails