001/**
002 * Licensed to the Apache Software Foundation (ASF) under one
003 * or more contributor license agreements.  See the NOTICE file
004 * distributed with this work for additional information
005 * regarding copyright ownership.  The ASF licenses this file
006 * to you under the Apache License, Version 2.0 (the
007 * "License"); you may not use this file except in compliance
008 * with the License.  You may obtain a copy of the License at
009 *
010 *      http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing, software
013 * distributed under the License is distributed on an "AS IS" BASIS,
014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015 * See the License for the specific language governing permissions and
016 * limitations under the License.
017 */
018
019package org.apache.oozie;
020
021import java.util.List;
022
023import org.apache.oozie.client.rest.BulkResponseImpl;
024
025/**
026 * Class that stores the entire retrieved info from the bulk request command
027 * along with params for pagination of the results
028 * Query execution in BulkJPAExecutor returns an object of BulkResponseInfo class
029 */
030public class BulkResponseInfo {
031    private int start = 1;
032    private int len = 50;
033    private long total;
034    private List<BulkResponseImpl> responses;
035
036    /**
037     * Create a bulk response info bean.
038     *
039     * @param responses jobs being returned.
040     * @param start bulk entries offset.
041     * @param len number of bulk entries.
042     * @param total total bulk entries.
043     */
044    public BulkResponseInfo(List<BulkResponseImpl> responses, int start, int len, long total) {
045        this.start = start;
046        this.len = len;
047        this.total = total;
048        this.responses = responses;
049    }
050
051    /**
052     * Return the coordinator actions being returned.
053     *
054     * @return the coordinator actions being returned.
055     */
056    public List<BulkResponseImpl> getResponses() {
057        return responses;
058    }
059
060    /**
061     * Return the offset of the bulk entries being returned.
062     * <p>
063     * For pagination purposes.
064     *
065     * @return the offset of the bulk entries being returned.
066     */
067    public int getStart() {
068        return start;
069    }
070
071    /**
072     * Return the number of the bulk entries being returned.
073     * <p>
074     * For pagination purposes.
075     *
076     * @return the number of the bulk entries being returned.
077     */
078    public int getLen() {
079        return len;
080    }
081
082    /**
083     * Return the total number of bulk entries.
084     * <p>
085     * For pagination purposes.
086     *
087     * @return the total number of bulk entries.
088     */
089    public long getTotal() {
090        return total;
091    }
092}