All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.innovenso.townplanner.io.concepts.BusinessActorExcelIO.scala Maven / Gradle / Ivy

package com.innovenso.townplanner.io.concepts

import com.innovenso.townplanner.model.EnterpriseArchitecture
import com.innovenso.townplanner.model.concepts.{
  Actor,
  BusinessActor,
  Organisation,
  Person,
  Team
}
import com.innovenso.townplanner.io.concepts.ExcelFields._

object BusinessActorExcelIO extends ConceptExcelIO[BusinessActor] {
  override def conceptClass: Class[BusinessActor] = classOf[BusinessActor]

  override def sheetName: String = "Business Actors"

  override def headerLabels: List[String] = List(TITLE, DESCRIPTION, TYPE)

  override def cellValues(concept: BusinessActor): List[String] = List(
    concept.title,
    concept.descriptions.map(_.value).mkString("\n\n"),
    concept.modelComponentType.value
  )

  override def concept(
      props: ConceptProperties,
      enterpriseArchitecture: EnterpriseArchitecture
  ): Unit = {
    val actor = props(TYPE) match {
      case "Person" =>
        enterpriseArchitecture describes Person(
          key = props.key,
          sortKey = props.sortKey,
          title = props.title
        ) as { it =>
          props.descriptions.foreach(d => it has d)
        }
      case "Organisation" | "Organization" =>
        enterpriseArchitecture describes Organisation(
          key = props.key,
          sortKey = props.sortKey,
          title = props.title
        ) as { it =>
          props.descriptions.foreach(d => it has d)
        }
      case "Team" =>
        enterpriseArchitecture describes Team(
          key = props.key,
          sortKey = props.sortKey,
          title = props.title
        ) as { it =>
          props.descriptions.foreach(d => it has d)
        }
      case _ =>
        enterpriseArchitecture describes Actor(
          key = props.key,
          sortKey = props.sortKey,
          title = props.title
        ) as { it =>
          props.descriptions.foreach(d => it has d)
        }
    }
    println(s"imported $actor")
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy