def addPath()

in legacy-content-import/src/main/scala/legacycontentimport/importer/ImportStructure.scala [20:42]


  def addPath(
      loadArticle: String => ArticleAndTopics
  )(importStructure: ImportStructure, path: String): ImportStructure = {

    val article = loadArticle(path)
    val pathToBody = s"body/${article.resourceName}.html"

    /*
     * See examples in
     * https://help.salesforce.com/articleView?id=sf.knowledge_article_importer_02csv.htm
     */
    val csvRow = Seq(
      article.resourceName,
      article.title,
      pathToBody,
      article.topics.mkString("+")
    ).mkString("\"", "\",\"", "\"")

    ImportStructure(
      csv = s"${importStructure.csv}\n$csvRow",
      articleBodies = importStructure.articleBodies :+ new ByteSource(pathToBody, article.body.getBytes(UTF_8))
    )
  }