View Javadoc
1   /*
2    * Copyright 2012-2021 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.pager;
17  
18  import java.io.Serializable;
19  import java.util.List;
20  
21  import org.codelibs.fess.util.ComponentUtil;
22  
23  public class SchedulerPager implements Serializable {
24  
25      private static final long serialVersionUID = 1L;
26  
27      public static final int DEFAULT_PAGE_SIZE = 20;
28  
29      public static final int DEFAULT_CURRENT_PAGE_NUMBER = 1;
30  
31      private int allRecordCount;
32  
33      private int allPageCount;
34  
35      private boolean existPrePage;
36  
37      private boolean existNextPage;
38  
39      private List<Integer> pageNumberList;
40  
41      private int pageSize;
42  
43      private int currentPageNumber;
44  
45      public String id;
46  
47      public String name;
48  
49      public String target;
50  
51      public String cronExpression;
52  
53      public String scriptType;
54  
55      public String crawler;
56  
57      public String jobLogging;
58  
59      public String available;
60  
61      public String sortOrder;
62  
63      public String createdBy;
64  
65      public String createdTime;
66  
67      public String versionNo;
68  
69      public void clear() {
70          allRecordCount = 0;
71          allPageCount = 0;
72          existPrePage = false;
73          existNextPage = false;
74          pageSize = getDefaultPageSize();
75          currentPageNumber = getDefaultCurrentPageNumber();
76  
77          id = null;
78          name = null;
79          target = null;
80          cronExpression = null;
81          scriptType = null;
82          crawler = null;
83          jobLogging = null;
84          available = null;
85          sortOrder = null;
86          createdBy = null;
87          createdTime = null;
88          versionNo = null;
89  
90      }
91  
92      protected int getDefaultCurrentPageNumber() {
93          return DEFAULT_CURRENT_PAGE_NUMBER;
94      }
95  
96      public int getAllRecordCount() {
97          return allRecordCount;
98      }
99  
100     public void setAllRecordCount(final int allRecordCount) {
101         this.allRecordCount = allRecordCount;
102     }
103 
104     public int getAllPageCount() {
105         return allPageCount;
106     }
107 
108     public void setAllPageCount(final int allPageCount) {
109         this.allPageCount = allPageCount;
110     }
111 
112     public boolean isExistPrePage() {
113         return existPrePage;
114     }
115 
116     public void setExistPrePage(final boolean existPrePage) {
117         this.existPrePage = existPrePage;
118     }
119 
120     public boolean isExistNextPage() {
121         return existNextPage;
122     }
123 
124     public void setExistNextPage(final boolean existNextPage) {
125         this.existNextPage = existNextPage;
126     }
127 
128     public int getPageSize() {
129         if (pageSize <= 0) {
130             pageSize = getDefaultPageSize();
131         }
132         return pageSize;
133     }
134 
135     public void setPageSize(final int pageSize) {
136         this.pageSize = pageSize;
137     }
138 
139     public int getCurrentPageNumber() {
140         if (currentPageNumber <= 0) {
141             currentPageNumber = getDefaultCurrentPageNumber();
142         }
143         return currentPageNumber;
144     }
145 
146     public void setCurrentPageNumber(final int currentPageNumber) {
147         this.currentPageNumber = currentPageNumber;
148     }
149 
150     public List<Integer> getPageNumberList() {
151         return pageNumberList;
152     }
153 
154     public void setPageNumberList(final List<Integer> pageNumberList) {
155         this.pageNumberList = pageNumberList;
156     }
157 
158     protected int getDefaultPageSize() {
159         return ComponentUtil.getFessConfig().getPagingPageSizeAsInteger();
160     }
161 
162 }