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 JobLogPager 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 jobName;
48  
49      public String jobStatus;
50  
51      public String target;
52  
53      public String scriptType;
54  
55      public String startTime;
56  
57      public void clear() {
58          allRecordCount = 0;
59          allPageCount = 0;
60          existPrePage = false;
61          existNextPage = false;
62          pageSize = getDefaultPageSize();
63          currentPageNumber = getDefaultCurrentPageNumber();
64  
65          id = null;
66          jobName = null;
67          jobStatus = null;
68          target = null;
69          scriptType = null;
70          startTime = null;
71  
72      }
73  
74      protected int getDefaultCurrentPageNumber() {
75          return DEFAULT_CURRENT_PAGE_NUMBER;
76      }
77  
78      public int getAllRecordCount() {
79          return allRecordCount;
80      }
81  
82      public void setAllRecordCount(final int allRecordCount) {
83          this.allRecordCount = allRecordCount;
84      }
85  
86      public int getAllPageCount() {
87          return allPageCount;
88      }
89  
90      public void setAllPageCount(final int allPageCount) {
91          this.allPageCount = allPageCount;
92      }
93  
94      public boolean isExistPrePage() {
95          return existPrePage;
96      }
97  
98      public void setExistPrePage(final boolean existPrePage) {
99          this.existPrePage = existPrePage;
100     }
101 
102     public boolean isExistNextPage() {
103         return existNextPage;
104     }
105 
106     public void setExistNextPage(final boolean existNextPage) {
107         this.existNextPage = existNextPage;
108     }
109 
110     public int getPageSize() {
111         if (pageSize <= 0) {
112             pageSize = getDefaultPageSize();
113         }
114         return pageSize;
115     }
116 
117     public void setPageSize(final int pageSize) {
118         this.pageSize = pageSize;
119     }
120 
121     public int getCurrentPageNumber() {
122         if (currentPageNumber <= 0) {
123             currentPageNumber = getDefaultCurrentPageNumber();
124         }
125         return currentPageNumber;
126     }
127 
128     public void setCurrentPageNumber(final int currentPageNumber) {
129         this.currentPageNumber = currentPageNumber;
130     }
131 
132     public List<Integer> getPageNumberList() {
133         return pageNumberList;
134     }
135 
136     public void setPageNumberList(final List<Integer> pageNumberList) {
137         this.pageNumberList = pageNumberList;
138     }
139 
140     protected int getDefaultPageSize() {
141         return ComponentUtil.getFessConfig().getPagingPageSizeAsInteger();
142     }
143 
144 }