001/*
002 * Copyright (c) 2006-2012 Nuxeo SA (http://nuxeo.com/) and others.
003 *
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the Eclipse Public License v1.0
006 * which accompanies this distribution, and is available at
007 * http://www.eclipse.org/legal/epl-v10.html
008 *
009 * Contributors:
010 *     Nuxeo
011 */
012
013package org.nuxeo.ecm.automation.client.model;
014
015import java.io.Serializable;
016import java.util.ArrayList;
017import java.util.Map;
018
019/**
020 * RecordSet object returned by QueryAndFetch
021 *
022 * @author <a href="mailto:tdelprat@nuxeo.com">Tiry</a>
023 * @since 5.7
024 */
025public class RecordSet extends ArrayList<Map<String, Serializable>> {
026
027    private static final long serialVersionUID = 1L;
028
029    protected int pageSize = -1;
030
031    protected int currentPageIndex = -1;
032
033    protected int numberOfPages = -1;
034
035    public RecordSet() {
036        super();
037    }
038
039    public RecordSet(int currentPageIndex, int pageSize, int numberOfPages) {
040        super();
041        this.currentPageIndex = currentPageIndex;
042        this.pageSize = pageSize;
043        this.numberOfPages = numberOfPages;
044    }
045
046    public boolean isPaginable() {
047        return currentPageIndex >= 0;
048    }
049
050    public int getPageSize() {
051        return pageSize;
052    }
053
054    public void setPageSize(int pageSize) {
055        this.pageSize = pageSize;
056    }
057
058    public int getCurrentPageIndex() {
059        return currentPageIndex;
060    }
061
062    public void setCurrentPageIndex(int currentPageIndex) {
063        this.currentPageIndex = currentPageIndex;
064    }
065
066    public int getNumberOfPages() {
067        return numberOfPages;
068    }
069
070    public void setNumberOfPages(int numberOfPages) {
071        this.numberOfPages = numberOfPages;
072    }
073}