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;
}
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);
}
}
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);
}
Aggregations