[MRM-1720] make pageSize and selectedPage configurable tru the REST request.

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1423550 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-12-18 17:51:54 +00:00
parent 481baa6ffb
commit d15b737723
2 changed files with 33 additions and 1 deletions

View File

@ -117,6 +117,15 @@ public class SearchRequest
*/
private boolean includePomArtifacts = false;
/**
* @since 1.4-M4
*/
private int pageSize = 30;
/**
* @since 1.4-M4
*/
private int selectedPage = 0;
public SearchRequest()
@ -286,6 +295,26 @@ public class SearchRequest
this.bundleRequireBundle = bundleRequireBundle;
}
public int getPageSize()
{
return pageSize;
}
public void setPageSize( int pageSize )
{
this.pageSize = pageSize;
}
public int getSelectedPage()
{
return selectedPage;
}
public void setSelectedPage( int selectedPage )
{
this.selectedPage = selectedPage;
}
@Override
public String toString()
{
@ -306,6 +335,8 @@ public class SearchRequest
sb.append( ", bundleRequireBundle='" ).append( bundleRequireBundle ).append( '\'' );
sb.append( ", classifier='" ).append( classifier ).append( '\'' );
sb.append( ", includePomArtifacts=" ).append( includePomArtifacts );
sb.append( ", pageSize=" ).append( pageSize );
sb.append( ", selectedPage=" ).append( selectedPage );
sb.append( '}' );
return sb.toString();
}

View File

@ -91,7 +91,8 @@ public class DefaultSearchService
{
repositories = getObservableRepos();
}
SearchResultLimits limits = new SearchResultLimits( 0 );
SearchResultLimits limits =
new SearchResultLimits( searchRequest.getPageSize(), searchRequest.getSelectedPage() );
try
{
SearchResults searchResults = repositorySearch.search( getPrincipal(), repositories, queryString, limits,