use of com.zimbra.cs.mailbox.calendar.cache.CalendarCacheManager in project zm-mailbox by Zimbra.
the class PurgeAccountCalendarCache method handle.
@Override
public Element handle(Element request, Map<String, Object> context) throws ServiceException {
ZimbraSoapContext zsc = getZimbraSoapContext(context);
// allow only system admin for now
checkRight(zsc, context, null, AdminRight.PR_SYSTEM_ADMIN_ONLY);
Provisioning prov = Provisioning.getInstance();
String id = request.getAttribute(AdminConstants.A_ID);
Account account = prov.get(AccountBy.id, id, zsc.getAuthToken());
if (account == null)
throw AccountServiceException.NO_SUCH_ACCOUNT(id);
if (!Provisioning.onLocalServer(account))
throw ServiceException.WRONG_HOST(account.getAttr(Provisioning.A_zimbraMailHost), null);
CalendarCacheManager calCache = CalendarCacheManager.getInstance();
ZimbraLog.calendar.info("Purging calendar cache for account " + account.getName());
Mailbox mbox = MailboxManager.getInstance().getMailboxByAccount(account, false);
if (mbox != null)
calCache.purgeMailbox(mbox);
Element response = zsc.createElement(AdminConstants.PURGE_ACCOUNT_CALENDAR_CACHE_RESPONSE);
return response;
}
Aggregations