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    package org.apache.oozie;
019    
020    import java.util.List;
021    
022    import org.apache.oozie.client.rest.BulkResponseImpl;
023    
024    /**
025     * Class that stores the entire retrieved info from the bulk request command
026     * along with params for pagination of the results
027     * Query execution in BulkJPAExecutor returns an object of BulkResponseInfo class
028     */
029    public class BulkResponseInfo {
030        private int start = 1;
031        private int len = 50;
032        private long total;
033        private List<BulkResponseImpl> responses;
034    
035        /**
036         * Create a bulk response info bean.
037         *
038         * @param bundle job being returned.
039         * @param start bulk entries offset.
040         * @param len number of bulk entries.
041         * @param total total bulk entries.
042         */
043        public BulkResponseInfo(List<BulkResponseImpl> responses, int start, int len, long total) {
044            this.start = start;
045            this.len = len;
046            this.total = total;
047            this.responses = responses;
048        }
049    
050        /**
051         * Return the coordinator actions being returned.
052         *
053         * @return the coordinator actions being returned.
054         */
055        public List<BulkResponseImpl> getResponses() {
056            return responses;
057        }
058    
059        /**
060         * Return the offset of the bulk entries being returned.
061         * <p/>
062         * For pagination purposes.
063         *
064         * @return the offset of the bulk entries being returned.
065         */
066        public int getStart() {
067            return start;
068        }
069    
070        /**
071         * Return the number of the bulk entries being returned.
072         * <p/>
073         * For pagination purposes.
074         *
075         * @return the number of the bulk entries being returned.
076         */
077        public int getLen() {
078            return len;
079        }
080    
081        /**
082         * Return the total number of bulk entries.
083         * <p/>
084         * For pagination purposes.
085         *
086         * @return the total number of bulk entries.
087         */
088        public long getTotal() {
089            return total;
090        }
091    }