001/*
002 * (C) Copyright 2006-2012 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 *     Nuxeo
018 */
019
020package org.nuxeo.ecm.automation.client.model;
021
022import java.io.Serializable;
023import java.util.ArrayList;
024import java.util.Map;
025
026/**
027 * RecordSet object returned by QueryAndFetch
028 *
029 * @author <a href="mailto:tdelprat@nuxeo.com">Tiry</a>
030 * @since 5.7
031 */
032public class RecordSet extends ArrayList<Map<String, Serializable>> {
033
034    private static final long serialVersionUID = 1L;
035
036    protected int pageSize = -1;
037
038    protected int currentPageIndex = -1;
039
040    protected int numberOfPages = -1;
041
042    public RecordSet() {
043        super();
044    }
045
046    public RecordSet(int currentPageIndex, int pageSize, int numberOfPages) {
047        super();
048        this.currentPageIndex = currentPageIndex;
049        this.pageSize = pageSize;
050        this.numberOfPages = numberOfPages;
051    }
052
053    public boolean isPaginable() {
054        return currentPageIndex >= 0;
055    }
056
057    public int getPageSize() {
058        return pageSize;
059    }
060
061    public void setPageSize(int pageSize) {
062        this.pageSize = pageSize;
063    }
064
065    public int getCurrentPageIndex() {
066        return currentPageIndex;
067    }
068
069    public void setCurrentPageIndex(int currentPageIndex) {
070        this.currentPageIndex = currentPageIndex;
071    }
072
073    public int getNumberOfPages() {
074        return numberOfPages;
075    }
076
077    public void setNumberOfPages(int numberOfPages) {
078        this.numberOfPages = numberOfPages;
079    }
080}