code: protected List<CmsResource> allInFolderPriorityDate(
          CmsObject cms,
          String param,
          boolean tree,
          boolean asc,
          int numResults) throws CmsException {
  
          CmsCollectorData data = new CmsCollectorData(param);
          String foldername = CmsResource.getFolderPath(data.getFileName());
  
          CmsResourceFilter filter = CmsResourceFilter.DEFAULT.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> result = cms.readResources(foldername, filter, tree);
  
          // create priority comparator to use to sort the resources
          CmsPriorityDateResourceComparator comparator = new CmsPriorityDateResourceComparator(cms, asc);
          Collections.sort(result, comparator);
  
          return shrinkToFit(result, data.getCount(), numResults);
      }
docs: Returns a list of all resource in a specified folder sorted by priority, then date ascending or descending.<p>
  
  @param cms the current OpenCms user context
  @param param the folder name to use
  @param tree if true, look in folder and all child folders, if false, look only in given folder
  @param asc if true, the date sort order is ascending, otherwise descending
  @param numResults the number of results
  
  @return all resources in the folder matching the given criteria
  
  @throws CmsException if something goes wrong