use of com.zimbra.soap.admin.type.CalendarResourceInfo in project zm-mailbox by Zimbra.
the class SoapProvisioning method searchDirectory.
@Override
public List<NamedEntry> searchDirectory(SearchDirectoryOptions options) throws ServiceException {
List<NamedEntry> result = new ArrayList<NamedEntry>();
SearchDirectoryRequest req = new SearchDirectoryRequest();
req.setQuery(options.getFilterString());
if (options.getMaxResults() != 0) {
req.setMaxResults(options.getMaxResults());
}
if (options.getDomain() != null) {
req.setDomain(options.getDomain().getName());
}
if (options.getSortAttr() != null) {
req.setSortBy(options.getSortAttr());
}
Set<SearchDirectoryOptions.ObjectType> types = options.getTypes();
if (types != null) {
req.setTypes(SearchDirectoryOptions.ObjectType.toCSVString(types));
}
req.setSortAscending(options.getSortOpt() != SortOpt.SORT_DESCENDING);
if (options.getReturnAttrs() != null) {
req.addAttrs(options.getReturnAttrs());
}
// TODO: handle ApplyCos, limit, offset?
SearchDirectoryResponse resp = invokeJaxb(req);
List<AdminObjectInterface> entries = resp.getEntries();
for (AdminObjectInterface entry : entries) {
if (entry instanceof AccountInfo) {
result.add(new SoapAccount((AccountInfo) entry, this));
} else if (entry instanceof CalendarResourceInfo) {
result.add(new SoapCalendarResource((CalendarResourceInfo) entry, this));
} else if (entry instanceof AliasInfo) {
result.add(new SoapAlias((AliasInfo) entry, this));
} else if (entry instanceof DistributionListInfo) {
result.add(new SoapDistributionList((DistributionListInfo) entry, this));
} else if (entry instanceof DomainInfo) {
result.add(new SoapDomain((DomainInfo) entry, this));
}
}
return result;
}
Aggregations