Search in sources :

Example 6 with ZGrant

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);
    }
}
Also used : ZGrant(com.zimbra.client.ZGrant) ServiceException(com.zimbra.common.service.ServiceException) ZJSONObject(com.zimbra.client.ZJSONObject) ToZJSONObject(com.zimbra.client.ToZJSONObject) JSONException(org.json.JSONException)

Aggregations

ZGrant (com.zimbra.client.ZGrant)6 ZFolder (com.zimbra.client.ZFolder)5 ServiceException (com.zimbra.common.service.ServiceException)3 GranteeType (com.zimbra.client.ZGrant.GranteeType)2 AccountServiceException (com.zimbra.cs.account.AccountServiceException)2 NamedEntry (com.zimbra.cs.account.NamedEntry)2 ACL (com.zimbra.cs.mailbox.ACL)2 Folder (com.zimbra.cs.mailbox.Folder)2 MailServiceException (com.zimbra.cs.mailbox.MailServiceException)2 SearchFolder (com.zimbra.cs.mailbox.SearchFolder)2 ToZJSONObject (com.zimbra.client.ToZJSONObject)1 ZJSONObject (com.zimbra.client.ZJSONObject)1 ZMailbox (com.zimbra.client.ZMailbox)1 Account (com.zimbra.cs.account.Account)1 GuestAccount (com.zimbra.cs.account.GuestAccount)1 Mailbox (com.zimbra.cs.mailbox.Mailbox)1 Mountpoint (com.zimbra.cs.mailbox.Mountpoint)1 JSONException (org.json.JSONException)1