private Page findPage ( final SecurityContext securityContext , List < Page > pages , final String path , final EditMode edit ) throws FrameworkException { if ( pages == null ) { pages = StructrApp . getInstance ( securityContext ) . nodeQuery ( Page . class ) . getAsList ( ) ; Collections . sort ( pages , new GraphObjectComparator ( StructrApp . key ( Page . class , "position" ) , GraphObjectComparator . ASCENDING ) ) ; } for ( final Page page : pages ) { final String pagePath = page . getPath ( ) ; if ( pagePath != null && pagePath . equals ( path ) && ( EditMode . CONTENT . equals ( edit ) || isVisibleForSite ( securityContext . getRequest ( ) , page ) ) ) { return page ; } } final String name = PathHelper . getName ( path ) ; for ( final Page page : pages ) { final String pageName = page . getName ( ) ; if ( pageName != null && pageName . equals ( name ) && ( EditMode . CONTENT . equals ( edit ) || isVisibleForSite ( securityContext . getRequest ( ) , page ) ) ) { return page ; } } for ( final Page page : pages ) { final String pageUuid = page . getUuid ( ) ; if ( pageUuid != null && pageUuid . equals ( name ) && ( EditMode . CONTENT . equals ( edit ) || isVisibleForSite ( securityContext . getRequest ( ) , page ) ) ) { return page ; } } return null ; }
Find a page with matching path .