/** * Creates ChildListFlattener. * * @param parentList a paged list of parents * @param childListLoader {@link ChildListLoader} for fetching child paged list associated any parent */ ChildListFlattener(PagedList<ParentT> parentList, ChildListLoader<ParentT, ChildT> childListLoader) { this.parentItr = parentList.iterator(); this.childListLoader = childListLoader; }
/** * Creates ChildListFlattener. * * @param parentList a paged list of parents * @param childListLoader {@link ChildListLoader} for fetching child paged list associated any parent */ ChildListFlattener(PagedList<ParentT> parentList, ChildListLoader<ParentT, ChildT> childListLoader) { this.parentItr = parentList.iterator(); this.childListLoader = childListLoader; }
/** * Creates an instance from a list of resource groups. * * @param resourceGroupList the list of resource groups */ public GroupPagedList(PagedList<ResourceGroup> resourceGroupList) { this.resourceGroupItr = resourceGroupList.iterator(); setCurrentPage(nextPage("dummy")); }
/** * Creates an instance from a list of resource groups. * * @param resourceGroupList the list of resource groups */ public GroupPagedList(PagedList<ResourceGroup> resourceGroupList) { this.resourceGroupItr = resourceGroupList.iterator(); setCurrentPage(nextPage("dummy")); }
/** * Returns the next child paged list containing at least one item. * <p> * This method iterate the parent list from where it stopped last time and return * a non-empty child paged list of a parent. If there is no parent with non-empty child list * or if the parent list iteration is finished then this method returns null. * * @return a child paged list {@link PagedList} * @throws CloudException exceptions thrown from the cloud * @throws IOException exceptions thrown from serialization/deserialization */ private PagedList<ChildT> nextChildList() { while (parentItr.hasNext()) { PagedList<ChildT> nextChildList = childListLoader.loadList(parentItr.next()); if (nextChildList.iterator().hasNext()) { return nextChildList; } } return emptyPagedList(); }
/** * Returns the next child paged list containing at least one item. * <p> * This method iterate the parent list from where it stopped last time and return * a non-empty child paged list of a parent. If there is no parent with non-empty child list * or if the parent list iteration is finished then this method returns null. * * @return a child paged list {@link PagedList} * @throws CloudException exceptions thrown from the cloud * @throws IOException exceptions thrown from serialization/deserialization */ private PagedList<ChildT> nextChildList() { while (parentItr.hasNext()) { PagedList<ChildT> nextChildList = childListLoader.loadList(parentItr.next()); if (nextChildList.iterator().hasNext()) { return nextChildList; } } return emptyPagedList(); }