001/**
002 * Copyright 2005-2016 The Kuali Foundation
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package org.kuali.rice.kew.actionlist;
017
018import org.displaytag.pagination.PaginatedList;
019import org.displaytag.properties.SortOrderEnum;
020import org.kuali.rice.kew.actionitem.ActionItemBase;
021
022import java.util.List;
023
024/**
025 * Implements the display tags paginated list to provide effecient paging for the action list.
026 * This allows us not to have to fetch an entire action list each time a user pages their list.
027 *
028 * @author Kuali Rice Team (rice.collab@kuali.org)
029 */
030public class PaginatedActionList implements PaginatedList {
031
032        private final List<? extends ActionItemBase> list;
033        private final int fullListSize;
034        private final int pageNumber;
035        private final int objectsPerPage;
036        private final String searchId;
037        private final String sortCriterion;
038        private final SortOrderEnum sortDirection;
039
040        public PaginatedActionList(List<? extends ActionItemBase> list, int fullListSize, int pageNumber, int objectsPerPage, String searchId, String sortCriterion, SortOrderEnum sortDirection) {
041                this.list = list;
042                this.fullListSize = fullListSize;
043                this.pageNumber = pageNumber;
044                this.objectsPerPage = objectsPerPage;
045                this.searchId = searchId;
046                this.sortCriterion = sortCriterion;
047                this.sortDirection = sortDirection;
048        }
049
050        @Override
051    public int getFullListSize() {
052                return fullListSize;
053        }
054
055        @Override
056    public List getList() {
057                return list;
058        }
059
060        @Override
061    public int getObjectsPerPage() {
062                return objectsPerPage;
063        }
064
065        @Override
066    public int getPageNumber() {
067                return pageNumber;
068        }
069
070        @Override
071    public String getSearchId() {
072                return searchId;
073        }
074
075        @Override
076    public String getSortCriterion() {
077                return sortCriterion;
078        }
079
080        @Override
081    public SortOrderEnum getSortDirection() {
082                return sortDirection;
083        }
084
085}