use of com.zimbra.client.ZGrant in project zm-mailbox by Zimbra.
the class ZModifyFolderEvent method toZJSONObject.
public ZJSONObject toZJSONObject() throws JSONException {
try {
ZJSONObject zjo = new ZJSONObject();
zjo.put("id", getId());
if (getName(null) != null)
zjo.put("name", getName(null));
if (getParentId(null) != null)
zjo.put("parentId", getParentId(null));
if (getFlags(null) != null)
zjo.put("flags", getFlags(null));
if (getColor(null) != null)
zjo.put("color", getColor(null).getName());
if (getUnreadCount(-1) != -1)
zjo.put("unreadCount", getUnreadCount(-1));
if (getImapUnreadCount(-1) != -1)
zjo.put("imapUnreadCount", getImapUnreadCount(-1));
if (getMessageCount(-1) != -1)
zjo.put("messageCount", getMessageCount(-1));
if (getImapMessageCount(-1) != -1)
zjo.put("imapMessageCount", getImapMessageCount(-1));
if (getDefaultView(null) != null)
zjo.put("view", getDefaultView(null).name());
if (getImapUIDNEXT(-1) != -1)
zjo.put("imapUIDNEXT", getImapUIDNEXT(-1));
if (getImapMODSEQ(-1) != -1)
zjo.put("imapMODSEQ", getImapMODSEQ(-1));
if (getRemoteURL(null) != null)
zjo.put("url", getRemoteURL(null));
zjo.put("activeSyncDisabled", isActiveSyncDisabled(false));
if (getEffectivePerm(null) != null)
zjo.put("effectivePermissions", getEffectivePerm(null));
List<ZGrant> grants = getGrants(null);
if (grants != null)
zjo.put("grants", grants);
return zjo;
} catch (ServiceException se) {
throw new JSONException(se);
}
}
Aggregations