001/*
002 * (C) Copyright 2006-2011 Nuxeo SA (http://nuxeo.com/) and others.
003 *
004 * Licensed under the Apache 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.apache.org/licenses/LICENSE-2.0
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 *
016 * Contributors:
017 *     matic
018 */
019package org.nuxeo.ecm.automation.client.model;
020
021import java.util.List;
022
023/**
024 * @author matic
025 */
026public class PaginableDocuments extends Documents {
027
028    private static final long serialVersionUID = 1L;
029
030    /**
031     * @deprecated since 5.7.3. Use {@link #resultsCount}.
032     */
033    @Deprecated
034    protected int totalSize;
035
036    /**
037     * @deprecated since 5.7.3. Use {@link #numberOfPages}.
038     */
039    @Deprecated
040    protected int pageCount;
041
042    /**
043     * @deprecated since 5.7.3. Use {@link #currentPageIndex}.
044     */
045    @Deprecated
046    protected int pageIndex;
047
048    protected int pageSize;
049
050    protected int currentPageIndex;
051
052    protected int numberOfPages;
053
054    protected int resultsCount;
055
056    public PaginableDocuments() {
057    }
058
059    /**
060     * @param size
061     */
062    public PaginableDocuments(List<Document> docs, int resultsCount, int pageSize, int numberOfPages,
063            int currentPageIndex) {
064        super(docs);
065        this.resultsCount = resultsCount;
066        this.pageSize = pageSize;
067        this.numberOfPages = numberOfPages;
068        this.currentPageIndex = currentPageIndex;
069    }
070
071    /**
072     * @deprecated since 5.7.3. Use {@link #getResultsCount()}.
073     */
074    @Deprecated
075    public int getTotalSize() {
076        return getResultsCount();
077    }
078
079    /**
080     * @deprecated since 5.7.3. Use {@link #getNumberOfPages()}.
081     */
082    @Deprecated
083    public int getPageCount() {
084        return getNumberOfPages();
085    }
086
087    /**
088     * @deprecated since 5.7.3. Use {@link #getCurrentPageIndex()}.
089     */
090    @Deprecated
091    public int getPageIndex() {
092        return getCurrentPageIndex();
093    }
094
095    /**
096     * @deprecated since 5.7.3. Use {@link #setResultsCount(int)}.
097     */
098    @Deprecated
099    public void setTotalSize(int totalSize) {
100        setResultsCount(totalSize);
101    }
102
103    /**
104     * @deprecated since 5.7.3. Use {@link #setNumberOfPages(int)}.
105     */
106    @Deprecated
107    public void setPageCount(int pageCount) {
108        setNumberOfPages(pageCount);
109    }
110
111    /**
112     * @deprecated since 5.7.3. Use {@link #setCurrentPageIndex(int)}.
113     */
114    @Deprecated
115    public void setPageIndex(int pageIndex) {
116        setCurrentPageIndex(pageIndex);
117    }
118
119    public int getPageSize() {
120        return pageSize;
121    }
122
123    public void setPageSize(int pageSize) {
124        this.pageSize = pageSize;
125    }
126
127    public int getCurrentPageIndex() {
128        return currentPageIndex;
129    }
130
131    public void setCurrentPageIndex(int currentPageIndex) {
132        this.currentPageIndex = currentPageIndex;
133    }
134
135    public int getNumberOfPages() {
136        return numberOfPages;
137    }
138
139    public void setNumberOfPages(int numberOfPages) {
140        this.numberOfPages = numberOfPages;
141    }
142
143    public int getResultsCount() {
144        return resultsCount;
145    }
146
147    public void setResultsCount(int resultsCount) {
148        this.resultsCount = resultsCount;
149    }
150}