Class PageTreeUtils

java.lang.Object
fr.paris.lutece.plugins.menus.service.PageTreeUtils

public final class PageTreeUtils extends Object
Walks up the parent chain of a page
  • Method Details

    • getRootParentTree

      public static int getRootParentTree(int nPageId, int nRootPageId, IntFunction<fr.paris.lutece.portal.business.page.Page> pageLoader)
      Find the ancestor of a page that heads its tree under the root page. The walk stops when the parent chain is broken (missing page, parent 0) or loops, so that a page whose chain does not reach the root never blocks the request.
      Parameters:
      nPageId - The page identifier
      nRootPageId - The root page identifier
      pageLoader - Loads a page from its identifier (an empty page or null when the page does not exist)
      Returns:
      The parent page identifier or root tree, or the last ancestor found when the chain does not reach the root