use of com.zimbra.client.event.ZRefreshEvent 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.client.event.ZRefreshEvent in project zm-mailbox by Zimbra.
the class ZMailbox method handleRefresh.
private void handleRefresh(Element refresh) throws ServiceException {
for (Element mbx : refresh.listElements(MailConstants.E_MAILBOX)) {
// FIXME: logic should be different if ZMailbox points at another user's mailbox
if (mbx.getAttribute(HeaderConstants.A_ACCOUNT_ID, null) == null) {
mSize = mbx.getAttributeLong(MailConstants.A_SIZE);
}
}
Element tags = refresh.getOptionalElement(ZimbraNamespace.E_TAGS);
List<ZTag> tagList = new ArrayList<ZTag>();
if (tags != null) {
for (Element t : tags.listElements(MailConstants.E_TAG)) {
ZTag tag = new ZTag(t, this);
tagList.add(tag);
}
}
Element folderEl = refresh.getOptionalElement(MailConstants.E_FOLDER);
ZFolder userRoot = new ZFolder(folderEl, null, this);
ZRefreshEvent event = new ZRefreshEvent(mSize, userRoot, tagList);
for (ZEventHandler handler : mHandlers) {
handler.handleRefresh(event, this);
}
incomingRules = null;
outgoingRules = null;
}
use of com.zimbra.client.event.ZRefreshEvent in project zm-mailbox by Zimbra.
the class ZMailbox method populateTagCache.
private void populateTagCache() throws ServiceException {
if (mNameToTag != null) {
return;
}
if (mNotifyPreference == null || mNotifyPreference == NotifyPreference.full) {
noOp();
if (mNameToTag != null) {
return;
}
}
List<ZTag> tagList = new ArrayList<ZTag>();
if (!mNoTagCache) {
try {
Element response = invoke(newRequestElement(MailConstants.GET_TAG_REQUEST));
for (Element t : response.listElements(MailConstants.E_TAG)) {
tagList.add(new ZTag(t, this));
}
} catch (SoapFaultException sfe) {
if (!sfe.getCode().equals(ServiceException.PERM_DENIED)) {
throw sfe;
}
}
}
ZRefreshEvent event = new ZRefreshEvent(mSize, null, tagList);
for (ZEventHandler handler : mHandlers) {
handler.handleRefresh(event, this);
}
}
Aggregations