This project has retired. For details please refer to its Attic page.
Source code
001package org.apache.archiva.indexer.search;
002
003/*
004 * Licensed to the Apache Software Foundation (ASF) under one
005 * or more contributor license agreements.  See the NOTICE file
006 * distributed with this work for additional information
007 * regarding copyright ownership.  The ASF licenses this file
008 * to you under the Apache License, Version 2.0 (the
009 * "License"); you may not use this file except in compliance
010 * with the License.  You may obtain a copy of the License at
011 *
012 *  http://www.apache.org/licenses/LICENSE-2.0
013 *
014 * Unless required by applicable law or agreed to in writing,
015 * software distributed under the License is distributed on an
016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
017 * KIND, either express or implied.  See the License for the
018 * specific language governing permissions and limitations
019 * under the License.
020 */
021
022/**
023 * SearchResultLimits - used to provide the search some limits on how the results are returned.
024 * This can provide paging for the result
025 */
026public class SearchResultLimits
027{
028    /**
029     * Constant to use for {@link #setSelectedPage(int)} to indicate a desire to get ALL PAGES.
030     * USE WITH CAUTION!!
031     */
032    public static final int ALL_PAGES = ( -1 );
033
034    private int pageSize = 30;
035
036    private int selectedPage = 0;
037
038    /**
039     * @param selectedPage page selected use -1 for all pages
040     */
041    public SearchResultLimits( int selectedPage )
042    {
043        this.selectedPage = selectedPage;
044    }
045
046    /**
047     * @param pageSize     number of groupId:artifact per page
048     * @param selectedPage page selected use -1 for all pages
049     * @since 1.4-M4
050     */
051    public SearchResultLimits( int pageSize, int selectedPage )
052    {
053        this.pageSize = pageSize;
054        this.selectedPage = selectedPage;
055    }
056
057    public int getPageSize()
058    {
059        return pageSize;
060    }
061
062    /**
063     * Set page size for maximum # of hits to return per page.
064     *
065     * @param pageSize size of page by # of hits.
066     */
067    public void setPageSize( int pageSize )
068    {
069        this.pageSize = pageSize;
070    }
071
072    public int getSelectedPage()
073    {
074        return selectedPage;
075    }
076
077    public void setSelectedPage( int selectedPage )
078    {
079        this.selectedPage = selectedPage;
080    }
081
082    @Override
083    public String toString()
084    {
085        return "SearchResultLimits{" + "pageSize=" + pageSize + ", selectedPage=" + selectedPage + '}';
086    }
087}