This project has retired. For details please refer to its Attic page.
SearchResultLimits xref
View Javadoc
1   package org.apache.archiva.indexer.search;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *  http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  /**
23   * SearchResultLimits - used to provide the search some limits on how the results are returned.
24   * This can provide paging for the result
25   */
26  public class SearchResultLimits
27  {
28      /**
29       * Constant to use for {@link #setSelectedPage(int)} to indicate a desire to get ALL PAGES.
30       * USE WITH CAUTION!!
31       */
32      public static final int ALL_PAGES = ( -1 );
33  
34      private int pageSize = 30;
35  
36      private int selectedPage = 0;
37  
38      /**
39       * @param selectedPage page selected use -1 for all pages
40       */
41      public SearchResultLimits( int selectedPage )
42      {
43          this.selectedPage = selectedPage;
44      }
45  
46      /**
47       * @param pageSize     number of groupId:artifact per page
48       * @param selectedPage page selected use -1 for all pages
49       * @since 1.4-M4
50       */
51      public SearchResultLimits( int pageSize, int selectedPage )
52      {
53          this.pageSize = pageSize;
54          this.selectedPage = selectedPage;
55      }
56  
57      public int getPageSize()
58      {
59          return pageSize;
60      }
61  
62      /**
63       * Set page size for maximum # of hits to return per page.
64       *
65       * @param pageSize size of page by # of hits.
66       */
67      public void setPageSize( int pageSize )
68      {
69          this.pageSize = pageSize;
70      }
71  
72      public int getSelectedPage()
73      {
74          return selectedPage;
75      }
76  
77      public void setSelectedPage( int selectedPage )
78      {
79          this.selectedPage = selectedPage;
80      }
81  
82      @Override
83      public String toString()
84      {
85          return "SearchResultLimits{" + "pageSize=" + pageSize + ", selectedPage=" + selectedPage + '}';
86      }
87  }