code: public void onCreate(CmsObject cms, CmsResource createdResource, boolean copyMode, String config) {
  
          if ((null != config) && !copyMode) {
              List<String> cats = Arrays.asList(config.split(","));
              CmsCategoryService catService = CmsCategoryService.getInstance();
              try {
                  try (AutoCloseable c = CmsLockUtil.withLockedResources(cms, createdResource)) {
                      String sitePath = cms.getRequestContext().getSitePath(createdResource);
                      for (String catPath : cats) {
                          if (!catPath.isEmpty()) {
                              try {
                                  CmsCategory cat;
                                  if (catPath.startsWith("/")) { // assume we have a site or rootpath
                                      cat = catService.getCategory(cms, catPath);
                                  } else { // assume we have the category path
                                      cat = catService.readCategory(cms, catPath, sitePath);
                                  }
                                  if (null != cat) {
                                      catService.addResourceToCategory(cms, sitePath, cat);
                                  }
                              } catch (CmsException e) {
                                  // TODO Auto-generated catch block
                                  e.printStackTrace();
                              }
                          }
                      }
                  }
              } catch (Exception e1) {
                  // TODO Auto-generated catch block
                  e1.printStackTrace();
              }
          }
      }
docs: Adds the categories specified via <code>config</code> to the newly created resource iff not in copy mode.
  
  @param cms the current user's CMS context
  @param createdResource the resource which has been created
  @param copyMode <code>true</code> if the user chose one of the elements in the collector list as a model
  @param config a comma separted list of category, site or root paths that specify the categories to be added to the created resource
  if <code>copyMode</code> is <code>false</code>.
  
  @see org.opencms.file.collectors.I_CmsCollectorPostCreateHandler#onCreate(org.opencms.file.CmsObject, org.opencms.file.CmsResource, boolean, java.lang.String)