Search in sources :

Example 1 with GetFolderRequest

use of com.zimbra.soap.mail.message.GetFolderRequest in project zm-mailbox by Zimbra.

the class ZMailbox method getSharedFolderById.

/**
 * always bypass caching and issues a GetFolderRequest
 */
public ZSharedFolder getSharedFolderById(String id) throws ServiceException {
    GetFolderRequest req = new GetFolderRequest(GetFolderSpec.forID(id));
    req.setVisible(true);
    GetFolderResponse resp = invokeJaxb(req);
    Folder folderInfo = resp.getFolder();
    ZSharedFolder folder = new ZSharedFolder(folderInfo, null, /* parent */
    id, this);
    return folder.isHierarchyPlaceholder() ? null : folder;
}
Also used : GetFolderRequest(com.zimbra.soap.mail.message.GetFolderRequest) GetFolderResponse(com.zimbra.soap.mail.message.GetFolderResponse) Folder(com.zimbra.soap.mail.type.Folder)

Example 2 with GetFolderRequest

use of com.zimbra.soap.mail.message.GetFolderRequest in project zm-mailbox by Zimbra.

the class ZMailbox method populateFolderCache.

private void populateFolderCache() throws ServiceException {
    if (mUserRoot != null) {
        if (alwaysRefreshFolders) {
            noOp();
        }
        return;
    }
    if (mNotifyPreference == null || mNotifyPreference == SessionPreference.full) {
        noOp();
        if (mUserRoot != null) {
            return;
        }
    }
    GetFolderRequest req = new GetFolderRequest(null, true);
    GetFolderResponse res = invokeJaxb(req);
    Folder root = res.getFolder();
    ZFolder userRoot = (root != null ? new ZFolder(root, null, this) : null);
    ZRefreshEvent event = new ZRefreshEvent(mSize, userRoot, null);
    for (ZEventHandler handler : mHandlers) {
        handler.handleRefresh(event, this);
    }
}
Also used : GetFolderRequest(com.zimbra.soap.mail.message.GetFolderRequest) GetFolderResponse(com.zimbra.soap.mail.message.GetFolderResponse) ZEventHandler(com.zimbra.client.event.ZEventHandler) ZRefreshEvent(com.zimbra.client.event.ZRefreshEvent) Folder(com.zimbra.soap.mail.type.Folder)

Example 3 with GetFolderRequest

use of com.zimbra.soap.mail.message.GetFolderRequest in project zm-mailbox by Zimbra.

the class TestJaxb method testGetFolderWithCacheContainingNullParent.

@Test
public void testGetFolderWithCacheContainingNullParent() throws Exception {
    TestUtil.createAccount(USER_NAME);
    ZMailbox zmbox = TestUtil.getZMailbox(USER_NAME);
    ZFolder f1 = TestUtil.createFolder(zmbox, FOLDER_F1);
    ZFolder f2 = TestUtil.createFolder(zmbox, SUB_FOLDER_F2);
    Mailbox mbox = TestUtil.getMailbox(USER_NAME);
    OperationContext octxt = new OperationContext(mbox);
    ItemId f1ItemId = new ItemId(mbox, Integer.parseInt(f1.getId()));
    ItemId f2ItemId = new ItemId(mbox, Integer.parseInt(f2.getId()));
    // ItemId rootItemId = new ItemId(mbox, Mailbox.ID_FOLDER_USER_ROOT);
    // mbox.getFolderTree(octxt, rootItemId, false);
    Folder f1folder = mbox.getFolderById(octxt, f1ItemId.getId());
    Folder f2folder = mbox.getFolderById(octxt, f2ItemId.getId());
    // Bug 100588 f1folder/f2folder will have been retrieved from the folder cache.  Deliberately poison it
    // by setting the parent folder to null, and ensure that can still successfully do a GetFolderRequest
    f1folder.setParent(null);
    f2folder.setParent(null);
    GetFolderResponse gfResp = zmbox.invokeJaxb(new GetFolderRequest());
    Assert.assertNotNull("GetFolderResponse null", gfResp);
}
Also used : OperationContext(com.zimbra.cs.mailbox.OperationContext) ZMailbox(com.zimbra.client.ZMailbox) GetFolderResponse(com.zimbra.soap.mail.message.GetFolderResponse) GetFolderRequest(com.zimbra.soap.mail.message.GetFolderRequest) Mailbox(com.zimbra.cs.mailbox.Mailbox) ZMailbox(com.zimbra.client.ZMailbox) ZFolder(com.zimbra.client.ZFolder) Folder(com.zimbra.cs.mailbox.Folder) ZFolder(com.zimbra.client.ZFolder) ItemId(com.zimbra.cs.service.util.ItemId) Test(org.junit.Test)

Aggregations

GetFolderRequest (com.zimbra.soap.mail.message.GetFolderRequest)3 GetFolderResponse (com.zimbra.soap.mail.message.GetFolderResponse)3 Folder (com.zimbra.soap.mail.type.Folder)2 ZFolder (com.zimbra.client.ZFolder)1 ZMailbox (com.zimbra.client.ZMailbox)1 ZEventHandler (com.zimbra.client.event.ZEventHandler)1 ZRefreshEvent (com.zimbra.client.event.ZRefreshEvent)1 Folder (com.zimbra.cs.mailbox.Folder)1 Mailbox (com.zimbra.cs.mailbox.Mailbox)1 OperationContext (com.zimbra.cs.mailbox.OperationContext)1 ItemId (com.zimbra.cs.service.util.ItemId)1 Test (org.junit.Test)1