View Javadoc
1   /*
2    * Copyright 2012-2025 CodeLibs Project and the Others.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
13   * either express or implied. See the License for the specific language
14   * governing permissions and limitations under the License.
15   */
16  package org.codelibs.fess.app.web.api.admin;
17  
18  import org.codelibs.fess.Constants;
19  import org.codelibs.fess.util.ComponentUtil;
20  
21  /**
22   * Base class for search request body objects in admin API.
23   * Provides common pagination parameters for search operations.
24   */
25  public class BaseSearchBody {
26  
27      /** The page size for search results. */
28      public Integer size = ComponentUtil.getFessConfig().getPagingPageSizeAsInteger();
29  
30      /** The page number for search results. */
31      public Integer page = Constants.DEFAULT_ADMIN_PAGE_NUMBER;
32  
33      /**
34       * Default constructor for BaseSearchBody.
35       */
36      public BaseSearchBody() {
37          // Default constructor
38      }
39  
40      /**
41       * Gets the page size for search results.
42       * @return The page size.
43       */
44      public int getPageSize() {
45          if (size != null) {
46              return size;
47          }
48          return ComponentUtil.getFessConfig().getPagingPageSizeAsInteger();
49      }
50  
51      /**
52       * Gets the current page number for search results.
53       * @return The current page number.
54       */
55      public int getCurrentPageNumber() {
56          if (page != null) {
57              return page;
58          }
59          return Constants.DEFAULT_ADMIN_PAGE_NUMBER;
60      }
61  }