use of com.zimbra.client.ToZJSONObject in project zm-mailbox by Zimbra.
the class ZCreateMessageEvent method toZJSONObject.
public ZJSONObject toZJSONObject() throws JSONException {
try {
ZJSONObject zjo = new ZJSONObject();
zjo.put("id", getId());
if (getFolderId(null) != null)
zjo.put("folderId", getFolderId(null));
if (getConversationId(null) != null)
zjo.put("conversationId", getConversationId(null));
if (getFlags(null) != null)
zjo.put("flags", getFlags(null));
if (getTagIds(null) != null)
zjo.put("tags", getTagIds(null));
if (getSubject(null) != null)
zjo.put("subject", getSubject(null));
if (getFragment(null) != null)
zjo.put("fragment", getFragment(null));
if (getSize(-1) != -1)
zjo.put("size", getSize(-1));
if (getReceivedDate(-1) != -1)
zjo.put("receivedDate", getReceivedDate(-1));
if (getSentDate(-1) != -1)
zjo.put("sentDate", getSentDate(-1));
List<ZEmailAddress> addrs = getEmailAddresses(null);
if (addrs != null)
zjo.put("addresses", addrs);
return zjo;
} catch (ServiceException se) {
throw new JSONException(se);
}
}
Aggregations