docs: public static String createResourceForCollector(
          CmsObject cms,
          String newLink,
          Locale locale,
          String referenceResource,
          String modelFile,
          String mode,
          String postCreateHandler)
      throws CmsException {
  
          // get the collector used to create the new content
          int pos = newLink.indexOf('|');
          String collectorName = newLink.substring(0, pos);
          String collectorParams = newLink.substring(pos + 1);
  
          String param;
          String templateFileName;
  
          pos = collectorParams.indexOf(A_CmsResourceCollector.SEPARATOR_TEMPLATEFILE);
          if (pos != -1) {
              // found an explicit template file name to use for the new resource, use it
              param = collectorParams.substring(0, pos);
              templateFileName = collectorParams.substring(pos + A_CmsResourceCollector.SEPARATOR_TEMPLATEFILE.length());
          } else {
              // no template file name was specified, use given resource name as template file
              param = collectorParams;
              templateFileName = referenceResource;
          }
  
          // get the collector used for calculating the next file name
          I_CmsResourceCollector collector = OpenCms.getResourceManager().getContentCollector(collectorName);
          String newFileName = "";
          // one resource serves as a "template" for the new resource
          CmsResource templateResource = cms.readResource(templateFileName, CmsResourceFilter.IGNORE_EXPIRATION);
          CmsXmlContent newContent = null;
          int typeId;
          CmsObject cloneCms = OpenCms.initCmsObject(cms);
          cloneCms.getRequestContext().setRequestTime(CmsResource.DATE_RELEASED_EXPIRED_IGNORE);
          // the reference resource may be a folder in case of creating for an empty collector list
          if (!templateResource.isFolder()) {
              typeId = templateResource.getTypeId();
              CmsFile templateFile = cms.readFile(templateResource);
              CmsXmlContent template = CmsXmlContentFactory.unmarshal(cloneCms, templateFile);
              // now create a new XML content based on the templates content definition
              newContent = CmsXmlContentFactory.createDocument(
                  cms,
                  locale,
                  template.getEncoding(),
                  template.getContentDefinition());
          } else {
              typeId = collector.getCreateTypeId(cloneCms, collectorName, collectorParams);
          }
          // IMPORTANT: calculation of the name MUST be done here so the file name is ensured to be valid
          newFileName = collector.getCreateLink(cms, collectorName, param);
  
          boolean isCopy = StringUtils.equalsIgnoreCase(mode, CmsEditorConstants.MODE_COPY);
          if (isCopy) {
              modelFile = referenceResource;
          }
          boolean useModelFile = false;
          if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(modelFile)) {
              cms.getRequestContext().setAttribute(CmsRequestContext.ATTRIBUTE_MODEL, modelFile);
              useModelFile = true;
          }
          // now create the resource, fill it with the marshalled XML and write it back to the VFS
          cms.createResource(newFileName, typeId);
          // re-read the created resource
          CmsFile newFile = cms.readFile(newFileName, CmsResourceFilter.ALL);
          if (!useModelFile && (newContent != null)) {
              newFile.setContents(newContent.marshal());
              // write the file with the updated content
              cloneCms.writeFile(newFile);
          }
          CmsPair<String, String> handlerParameter = I_CmsCollectorPostCreateHandler.splitClassAndConfig(
              postCreateHandler);
          I_CmsCollectorPostCreateHandler handler = getPostCreateHandler(handlerParameter.getFirst());
          handler.onCreate(cms, newFile, isCopy, handlerParameter.getSecond());
          return newFileName;
  
      }