if ( CollectionUtils.isEmpty(managedRepositoryList) )
{
return GlobalResults.ACCESS_TO_NO_REPOS;
}
SearchResultLimits limits = new SearchResultLimits(currentPage);
limits.setPageSize(rowCount);
List<String> selectedRepos = new ArrayList<String>();
if ( repositoryId == null || StringUtils.isBlank(repositoryId) || "all".equals(
StringUtils.stripToEmpty(repositoryId)) )
{
selectedRepos = getObservableRepos();
}
else
{
selectedRepos.add(repositoryId);
}
if ( CollectionUtils.isEmpty(selectedRepos) )
{
return GlobalResults.ACCESS_TO_NO_REPOS;
}
SearchFields searchFields = new SearchFields(groupId, artifactId, version, null, className, selectedRepos);
if ( StringUtils.isNotBlank(this.bundleExportPackage) )
{
searchFields.setBundleExportPackage(this.bundleExportPackage);
}
if ( StringUtils.isNotBlank(this.bundleExportService) )
{
searchFields.setBundleExportService(this.bundleExportService);
}
if ( StringUtils.isNotBlank(this.bundleImportPackage) )
{
searchFields.setBundleImportPackage(this.bundleImportPackage);
}
if ( StringUtils.isNotBlank(this.bundleSymbolicName) )
{
searchFields.setBundleSymbolicName(this.bundleSymbolicName);
}
if ( StringUtils.isNotBlank(this.bundleName) )
{
searchFields.setBundleName(this.bundleName);
}
if ( StringUtils.isNotBlank(this.bundleVersion) )
{
searchFields.setBundleVersion(this.bundleVersion);
}
log.debug("filteredSearch with searchFields {}", searchFields);
// TODO: add packaging in the list of fields for advanced search (UI)?
try
{
results = getNexusSearch().search(getPrincipal(), searchFields, limits);
}
catch ( RepositorySearchException e )
{
addActionError(e.getMessage());
return ERROR;
}
if ( results.isEmpty() )
{
addActionError("No results found");
return INPUT;
}
totalPages = results.getTotalHits() / limits.getPageSize();
if ( ( results.getTotalHits() % limits.getPageSize() ) != 0 )
{
totalPages = totalPages + 1;
}
for ( SearchResultHit hit : results.getHits() )