Ejemplo n.º 1
0
  /** @return Returns a list of pages or returns null if has not any page. */
  public List<PageModel> next() {
    ExoContainer container = PortalContainer.getInstance();
    PageService pageService = (PageService) container.getComponentInstance(PageService.class);
    QueryResult<PageContext> result =
        pageService.findPages(
            currentIndex,
            pageSize + 1,
            SiteType.valueOf(ownerType.toUpperCase()),
            ownerId,
            name,
            title);

    int size = result.getSize();
    hasNext = size > pageSize;

    //
    if (size > 0) {
      int hsize = hasNext ? pageSize : size;
      List<PageModel> holder = new ArrayList<PageModel>(hsize);

      Iterator<PageContext> iterator = result.iterator();
      while (holder.size() < hsize) {
        holder.add(new PageModel(iterator.next()));
      }

      currentIndex += holder.size();
      return holder;
    } else {
      return null;
    }
  }
Ejemplo n.º 2
0
  public boolean hasNext() {
    if (hasNext && currentIndex == 0) {
      ExoContainer container = PortalContainer.getInstance();
      PageService pageService = (PageService) container.getComponentInstance(PageService.class);
      QueryResult<PageContext> result =
          pageService.findPages(
              0, 1, SiteType.valueOf(ownerType.toUpperCase()), ownerId, name, title);

      hasNext = result.getSize() > 0;
    }

    //
    return hasNext;
  }