use of com.zimbra.soap.mail.type.Folder in project zm-mailbox by Zimbra.
the class ZMailbox method populateFolderCache.
private void populateFolderCache() throws ServiceException {
if (mUserRoot != null) {
return;
}
if (mNotifyPreference == null || mNotifyPreference == NotifyPreference.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.type.Folder in project zm-mailbox by Zimbra.
the class GetFolderTest method unmarshallGetFolderResponseContainingGrant.
/**
* Motivated by Bug 55153 failure in ZGrant.java line 134:
* mGranteeType = GranteeType.fromString(grant.getGranteeType().toString());
*/
@Test
public void unmarshallGetFolderResponseContainingGrant() throws Exception {
GetFolderResponse result = (GetFolderResponse) unmarshaller.unmarshal(getClass().getResourceAsStream("GetFolderResponseWithGrant.xml"));
Folder top = result.getFolder();
boolean foundGrant = false;
for (Folder child : top.getSubfolders()) {
Acl acl = child.getAcl();
if (acl != null) {
List<Grant> myGrants = acl.getGrants();
if (myGrants.size() > 0) {
foundGrant = true;
Grant first = myGrants.get(0);
GrantGranteeType mGranteeType = GrantGranteeType.fromString(first.getGranteeType().toString());
Assert.assertEquals(GrantGranteeType.usr, mGranteeType);
}
}
}
Assert.assertTrue("Should have processed a valid <grant>", foundGrant);
result = (GetFolderResponse) unmarshaller.unmarshal(getClass().getResourceAsStream("GetFolderResponseWithBadGrant.xml"));
top = result.getFolder();
foundGrant = false;
for (Folder child : top.getSubfolders()) {
Acl acl = child.getAcl();
if (acl != null) {
List<Grant> myGrants = acl.getGrants();
if (myGrants.size() > 0) {
foundGrant = true;
Grant first = myGrants.get(0);
GrantGranteeType mGranteeType = first.getGranteeType();
Assert.assertNull("There was no 'gt' attribute", mGranteeType);
}
}
}
Assert.assertTrue("Should have processed a bad <grant>", foundGrant);
}
Aggregations