Search in sources :

Example 1 with SaveIMAPSubscriptionsResponse

use of com.zimbra.soap.mail.message.SaveIMAPSubscriptionsResponse 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);
}
Also used : MetadataList(com.zimbra.cs.mailbox.MetadataList) Account(com.zimbra.cs.account.Account) SaveIMAPSubscriptionsResponse(com.zimbra.soap.mail.message.SaveIMAPSubscriptionsResponse) ZimbraSoapContext(com.zimbra.soap.ZimbraSoapContext) Metadata(com.zimbra.cs.mailbox.Metadata) SaveIMAPSubscriptionsRequest(com.zimbra.soap.mail.message.SaveIMAPSubscriptionsRequest)

Aggregations

Account (com.zimbra.cs.account.Account)1 Metadata (com.zimbra.cs.mailbox.Metadata)1 MetadataList (com.zimbra.cs.mailbox.MetadataList)1 ZimbraSoapContext (com.zimbra.soap.ZimbraSoapContext)1 SaveIMAPSubscriptionsRequest (com.zimbra.soap.mail.message.SaveIMAPSubscriptionsRequest)1 SaveIMAPSubscriptionsResponse (com.zimbra.soap.mail.message.SaveIMAPSubscriptionsResponse)1