code: private void addSubResources(CmsDbContext dbc, CmsPublishList publishList, CmsResource directPublishResource)
      throws CmsDataAccessException {
  
          int flags = CmsDriverManager.READMODE_INCLUDE_TREE | CmsDriverManager.READMODE_EXCLUDE_STATE;
          if (!directPublishResource.getState().isDeleted()) {
              // fix for org.opencms.file.TestPublishIssues#testPublishFolderWithDeletedFileFromOtherProject
              flags = flags | CmsDriverManager.READMODE_INCLUDE_PROJECT;
          }
  
          // add all sub resources of the folder
          List<CmsResource> folderList = getVfsDriver(dbc).readResourceTree(
              dbc,
              dbc.currentProject().getUuid(),
              directPublishResource.getRootPath(),
              CmsDriverManager.READ_IGNORE_TYPE,
              CmsResource.STATE_UNCHANGED,
              CmsDriverManager.READ_IGNORE_TIME,
              CmsDriverManager.READ_IGNORE_TIME,
              CmsDriverManager.READ_IGNORE_TIME,
              CmsDriverManager.READ_IGNORE_TIME,
              CmsDriverManager.READ_IGNORE_TIME,
              CmsDriverManager.READ_IGNORE_TIME,
              flags | CmsDriverManager.READMODE_ONLY_FOLDERS);
  
          publishList.addAll(filterResources(dbc, publishList, folderList), true);
  
          List<CmsResource> fileList = getVfsDriver(dbc).readResourceTree(
              dbc,
              dbc.currentProject().getUuid(),
              directPublishResource.getRootPath(),
              CmsDriverManager.READ_IGNORE_TYPE,
              CmsResource.STATE_UNCHANGED,
              CmsDriverManager.READ_IGNORE_TIME,
              CmsDriverManager.READ_IGNORE_TIME,
              CmsDriverManager.READ_IGNORE_TIME,
              CmsDriverManager.READ_IGNORE_TIME,
              CmsDriverManager.READ_IGNORE_TIME,
              CmsDriverManager.READ_IGNORE_TIME,
              flags | CmsDriverManager.READMODE_ONLY_FILES);
  
          publishList.addAll(filterResources(dbc, publishList, fileList), true);
      }
docs: Adds all sub-resources of the given resource to the publish list.<p>
  
  @param dbc the database context
  @param publishList the publish list
  @param directPublishResource the resource to get the sub-resources for
  
  @throws CmsDataAccessException if something goes wrong accessing the database