1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one 3 * or more contributor license agreements. See the NOTICE file 4 * distributed with this work for additional information 5 * regarding copyright ownership. The ASF licenses this file 6 * to you under the Apache License, Version 2.0 (the 7 * "License"); you may not use this file except in compliance 8 * with the License. You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, 13 * software distributed under the License is distributed on an 14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 * KIND, either express or implied. See the License for the 16 * specific language governing permissions and limitations 17 * under the License. 18 */ 19 package org.apache.chemistry.opencmis.client.api; 20 21 import java.util.Iterator; 22 23 /** 24 * Iterable for CMIS collections that allows ability to skip to specific 25 * position or return a subcollection. 26 * 27 * @param <T> the type of the items 28 */ 29 public interface ItemIterable<T> extends Iterable<T> { 30 31 /** 32 * Skip to position within CMIS collection 33 * 34 * @param position 35 * @return iterable whose starting point is the specified skip to position. 36 * This iterable <em>may</em> be the same as {@code this} 37 */ 38 ItemIterable<T> skipTo(long position); 39 40 /** 41 * Gets an iterable for the current sub collection within the CMIS collection using 42 * default maximum number of items 43 * 44 * @return iterable for current page 45 */ 46 ItemIterable<T> getPage(); 47 48 /** 49 * Gets an iterable for the current sub collection within the CMIS collection 50 * 51 * @param maxNumItems 52 * maximum number of items the sub collection will contain 53 * 54 * @return iterable for current page 55 */ 56 ItemIterable<T> getPage(int maxNumItems); 57 58 /* 59 * (non-Javadoc) 60 * 61 * @see java.lang.Iterable#iterator() 62 */ 63 Iterator<T> iterator(); 64 65 /** 66 * Returns the number of items fetched for the current page. 67 * 68 * @return number of items for currently fetched collection 69 */ 70 long getPageNumItems(); 71 72 /** 73 * Returns whether the repository contains additional items beyond the page of 74 * items already fetched. 75 * 76 * @return true => further page requests will be made to the repository 77 */ 78 boolean getHasMoreItems(); 79 80 /** 81 * Returns the total number of items. If the repository knows the total 82 * number of items in a result set, the repository SHOULD include the number 83 * here. If the repository does not know the number of items in a result 84 * set, this parameter SHOULD not be set. The value in the parameter MAY NOT 85 * be accurate the next time the client retrieves the result set or the next 86 * page in the result set. 87 * 88 * @return total number of items or (-1) 89 */ 90 long getTotalNumItems(); 91 92 }