Search in sources :

Example 1 with FreeBusyProvider

use of com.zimbra.cs.fb.FreeBusyProvider in project zm-mailbox by Zimbra.

the class GetAllFreeBusyProviders method handle.

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, Admin.R_getAllFreeBusyProviders);
    Element response = zsc.createElement(AdminConstants.GET_ALL_FREE_BUSY_PROVIDERS_RESPONSE);
    for (FreeBusyProvider prov : FreeBusyProvider.getProviders()) {
        if (!(prov instanceof ExchangeEWSFreeBusyProvider)) {
            Element provElem = response.addElement(AdminConstants.E_PROVIDER);
            provElem.addAttribute(AdminConstants.A_NAME, prov.getName());
            provElem.addAttribute(AdminConstants.A_PROPAGATE, prov.registerForMailboxChanges());
            provElem.addAttribute(AdminConstants.A_START, prov.cachedFreeBusyStartTime());
            provElem.addAttribute(AdminConstants.A_END, prov.cachedFreeBusyEndTime());
            provElem.addAttribute(AdminConstants.A_QUEUE, prov.getQueueFilename());
            provElem.addAttribute(AdminConstants.A_PREFIX, prov.foreignPrincipalPrefix());
        }
    }
    return response;
}
Also used : ZimbraSoapContext(com.zimbra.soap.ZimbraSoapContext) ExchangeEWSFreeBusyProvider(com.zimbra.cs.fb.ExchangeEWSFreeBusyProvider) Element(com.zimbra.common.soap.Element) FreeBusyProvider(com.zimbra.cs.fb.FreeBusyProvider) ExchangeEWSFreeBusyProvider(com.zimbra.cs.fb.ExchangeEWSFreeBusyProvider)

Example 2 with FreeBusyProvider

use of com.zimbra.cs.fb.FreeBusyProvider in project zm-mailbox by Zimbra.

the class GetFreeBusyQueueInfo method handle.

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);
    String name = null;
    Element provider = request.getOptionalElement(AdminConstants.E_PROVIDER);
    if (provider != null)
        name = provider.getAttribute(AdminConstants.A_NAME);
    Element response = zsc.createElement(AdminConstants.GET_FREE_BUSY_QUEUE_INFO_RESPONSE);
    if (name != null) {
        FreeBusyProvider prov = FreeBusyProvider.getProvider(name);
        if (prov == null)
            throw ServiceException.INVALID_REQUEST("provider not found: " + name, null);
        handleProvider(response, prov);
    } else {
        for (FreeBusyProvider prov : FreeBusyProvider.getProviders()) {
            handleProvider(response, prov);
        }
    }
    return response;
}
Also used : ZimbraSoapContext(com.zimbra.soap.ZimbraSoapContext) Element(com.zimbra.common.soap.Element) FreeBusyProvider(com.zimbra.cs.fb.FreeBusyProvider)

Example 3 with FreeBusyProvider

use of com.zimbra.cs.fb.FreeBusyProvider in project zm-mailbox by Zimbra.

the class PurgeFreeBusyQueue method handle.

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);
    String name = null;
    Element provider = request.getOptionalElement(AdminConstants.E_PROVIDER);
    if (provider != null)
        name = provider.getAttribute(AdminConstants.A_NAME);
    Element response = zsc.createElement(AdminConstants.PURGE_FREE_BUSY_QUEUE_RESPONSE);
    if (name != null) {
        FreeBusyProvider prov = FreeBusyProvider.getProvider(name);
        if (prov == null)
            throw ServiceException.INVALID_REQUEST("provider not found: " + name, null);
        handleProvider(prov);
    } else {
        for (FreeBusyProvider prov : FreeBusyProvider.getProviders()) {
            handleProvider(prov);
        }
    }
    return response;
}
Also used : ZimbraSoapContext(com.zimbra.soap.ZimbraSoapContext) Element(com.zimbra.common.soap.Element) FreeBusyProvider(com.zimbra.cs.fb.FreeBusyProvider)

Aggregations

Element (com.zimbra.common.soap.Element)3 FreeBusyProvider (com.zimbra.cs.fb.FreeBusyProvider)3 ZimbraSoapContext (com.zimbra.soap.ZimbraSoapContext)3 ExchangeEWSFreeBusyProvider (com.zimbra.cs.fb.ExchangeEWSFreeBusyProvider)1