resources = d.searchCalendarResources( filter, attrs, sortBy, sortAscending);
resources = prov.searchCalendarResources(d, filter, attrs, sortBy, sortAscending);
    public Element handle(Element request, Map<String, Object> context)    throws ServiceException {        ZimbraSoapContext lc = getZimbraSoapContext(context);        Provisioning prov = Provisioning.getInstance();        int limit = (int) request.getAttributeLong(AdminService.A_LIMIT,                                                   Integer.MAX_VALUE);        if (limit == 0) limit = Integer.MAX_VALUE;        int offset = (int) request.getAttributeLong(AdminService.A_OFFSET, 0);                String domain = request.getAttribute(AdminService.A_DOMAIN, null);        boolean applyCos =            request.getAttributeBool(AdminService.A_APPLY_COS, true);        String sortBy = request.getAttribute(AdminService.A_SORT_BY, null);                boolean sortAscending =            request.getAttributeBool(AdminService.A_SORT_ASCENDING, true);                String attrsStr = request.getAttribute(AdminService.A_ATTRS, null);        String[] attrs = attrsStr == null ? null : attrsStr.split(",");        EntrySearchFilter filter =            com.zimbra.cs.service.account.SearchCalendarResources.            parseSearchFilter(request);        // if we are a domain admin only, restrict to domain        if (isDomainAdminOnly(lc)) {            if (domain == null) {                domain = getAuthTokenAccountDomain(lc).getName();            } else {                if (!canAccessDomain(lc, domain))                     throw ServiceException.PERM_DENIED("cannot access domain");            }        }        Domain d = null;        if (domain != null) {            d = prov.get(DomainBy.NAME, domain);            if (d == null)                throw AccountServiceException.NO_SUCH_DOMAIN(domain);        }        List resources;        AdminSession session =            (AdminSession) lc.getSession(SessionCache.SESSION_ADMIN);        if (session != null) {            resources = session.searchCalendarResources(                    d, filter, attrs, sortBy, sortAscending, offset);        } else {            if (d != null) {                resources = d.searchCalendarResources(                        filter, attrs, sortBy, sortAscending);            } else {                resources = prov.searchCalendarResources(                        filter, attrs, sortBy, sortAscending);            }        }        Element response = lc.createElement(                AdminService.SEARCH_CALENDAR_RESOURCES_RESPONSE);        int i, limitMax = offset+limit;        for (i=offset; i < limitMax && i < resources.size(); i++) {            NamedEntry entry = (NamedEntry) resources.get(i);            ToXML.encodeCalendarResource(response,                                         (CalendarResource) entry,                                         applyCos);        }        response.addAttribute(AdminService.A_MORE, i < resources.size());        response.addAttribute(AdminService.A_SEARCH_TOTAL, resources.size());        return response;    }