docs: protected List<CmsResource> allInFolderNavPos(CmsObject cms, String param, boolean readSubTree, int numResults)
      throws CmsException {
  
          CmsCollectorData data = new CmsCollectorData(param);
          String foldername = CmsResource.getFolderPath(data.getFileName());
  
          CmsResourceFilter filter = CmsResourceFilter.DEFAULT_FILES.addRequireType(data.getType()).addExcludeFlags(
              CmsResource.FLAG_TEMPFILE);
          if (data.isExcludeTimerange() && !cms.getRequestContext().getCurrentProject().isOnlineProject()) {
              // include all not yet released and expired resources in an offline project
              filter = filter.addExcludeTimerange();
          }
          List<CmsResource> foundResources = cms.readResources(foldername, filter, readSubTree);
  
          // the Cms resources are saved in a map keyed by their nav elements
          // to save time sorting the resources by the value of their NavPos property
          CmsJspNavBuilder navBuilder = new CmsJspNavBuilder(cms);
          Map<CmsJspNavElement, CmsResource> navElementMap = new HashMap<CmsJspNavElement, CmsResource>();
          for (int i = 0, n = foundResources.size(); i < n; i++) {
  
              CmsResource resource = foundResources.get(i);
              CmsJspNavElement navElement = navBuilder.getNavigationForResource(cms.getSitePath(resource));
  
              // check if the resource has the NavPos property set or not
              if ((navElement != null) && (navElement.getNavPosition() != Float.MAX_VALUE)) {
                  navElementMap.put(navElement, resource);
              } else if (LOG.isInfoEnabled()) {
                  // printing a log messages makes it a little easier to identify
                  // resources having not the NavPos property set
                  LOG.info(
                      Messages.get().getBundle().key(Messages.LOG_RESOURCE_WITHOUT_NAVPROP_1, cms.getSitePath(resource)));
              }
          }
  
          // all found resources have the NavPos property set
          // sort the nav. elements, and pull the found Cms resources
          // from the map in the correct order into a list
          // only resources with the NavPos property set are used here
          List<CmsJspNavElement> navElementList = new ArrayList<CmsJspNavElement>(navElementMap.keySet());
          List<CmsResource> result = new ArrayList<CmsResource>();
  
          Collections.sort(navElementList);
          for (int i = 0, n = navElementList.size(); i < n; i++) {
  
              CmsJspNavElement navElement = navElementList.get(i);
              result.add(navElementMap.get(navElement));
          }
  
          return shrinkToFit(result, data.getCount(), numResults);
      }