2 * Copyright (C) 2017 CMCC, Inc. and others. All rights reserved.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package org.onap.usecaseui.server.util;
18 import java.util.List;
20 public class Page<E> {
24 private int totalRecords;
33 public List<E> getList() {
37 public void setList(List<E> list) {
41 public int getTotalRecords() {
45 public void setTotalRecords(int totalRecords) {
46 this.totalRecords = totalRecords;
49 public int getPageSize() {
53 public void setPageSize(int pageSize) {
54 this.pageSize = pageSize;
57 public int getPageNo() {
61 public void setPageNo(int pageNo) {
66 public int getTotalPages() {
67 return (totalRecords+pageSize-1)/pageSize;
71 public int countOffset(int currentPage,int pageSize) {
72 int offset =pageSize*(currentPage-1);
76 public int getTopageNo() {
80 public int getPreviousPageNo() {
87 public int getNextPageNo() {
88 if(pageNo>=getBottomPageNo()) {
89 return getBottomPageNo();
94 public int getBottomPageNo() {
95 return getTotalPages();