use of com.zimbra.soap.mail.message.SaveIMAPSubscriptionsRequest in project zm-mailbox by Zimbra.
the class ZMailbox method saveIMAPsubscriptions.
public void saveIMAPsubscriptions(Set<String> subscriptions) throws ServiceException {
SaveIMAPSubscriptionsRequest req = new SaveIMAPSubscriptionsRequest(subscriptions);
invokeJaxb(req);
}
use of com.zimbra.soap.mail.message.SaveIMAPSubscriptionsRequest in project zm-mailbox by Zimbra.
the class SaveIMAPSubscriptions method handle.
@Override
public Element handle(Element request, Map<String, Object> context) throws ServiceException {
ZimbraSoapContext zsc = getZimbraSoapContext(context);
Account account = getRequestedAccount(zsc);
if (!canAccessAccount(zsc, account)) {
throw ServiceException.PERM_DENIED("can not access account");
}
SaveIMAPSubscriptionsRequest req = zsc.elementToJaxb(request);
if (req != null) {
MetadataList slist = new MetadataList();
Set<String> subs = req.getSubscriptions();
if (subs != null && !subs.isEmpty()) {
for (String sub : subs) slist.add(sub);
}
getRequestedMailbox(zsc).setConfig(getOperationContext(zsc, context), AccountUtil.SN_IMAP, new Metadata().put(AccountUtil.FN_SUBSCRIPTIONS, slist));
}
SaveIMAPSubscriptionsResponse resp = new SaveIMAPSubscriptionsResponse();
return zsc.jaxbToElement(resp);
}
Aggregations