private CmsGalleryTreeEntry lookForParent(CmsGalleryTreeEntry possibleParent, String targetPath) {

        if (targetPath.startsWith(possibleParent.getPath())) {
            return possibleParent;
        }
        if (possibleParent.getParent() != null) {
            return lookForParent(possibleParent.getParent(), targetPath);
        }
        return null;
    }
private CmsGalleryTreeEntry lookForParent ( CmsGalleryTreeEntry possibleParent , String targetPath ) { if ( targetPath . startsWith ( possibleParent . getPath ( ) ) ) { return possibleParent ; } if ( possibleParent . getParent ( ) != null ) { return lookForParent ( possibleParent . getParent ( ) , targetPath ) ; } return null ; }
Looks for an ancestor tree entry for the given path.<p>

@param possibleParent the possible parent entry
@param targetPath the target path

@return the parent entry or <code>null</code> if there is none