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 );
// 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())