// Determine whether the federated source and original source support queries and searches ...
RepositorySourceCapabilities fedCapabilities = federatedSource != null ? federatedSource.getCapabilities() : null;
final boolean canQuerySource = repositorySourceCapabilities != null
&& repositorySourceCapabilities.supportsSearches()
&& repositorySourceCapabilities.supportsQueries();
final boolean canQueryFederated = fedCapabilities != null && fedCapabilities.supportsSearches()
&& fedCapabilities.supportsQueries();
// We can query the federated source if it supports queries and searches
// AND the original source supports queries and searches ...
if (canQuerySource && canQueryFederated) {