12345678910111213141516171819202122232425262728293031323334353637383940 |
- package fr.natan.akkastreamfileprocessingapi.models
- import ModelsAndJsonMap.{Episode, Person, TvSerie}
- object ModelsBuilder {
-
- def buildPersonModel(personMap: Map[String, String]): Person = {
- Person(
- personMap("nconst"),
- personMap("primaryName"),
- Option( personMap("birthYear")),
- Option(personMap("deathYear")),
- personMap("primaryProfession").split(",").toList,
- personMap("knownForTitles").split(",").toList
- )
- }
-
- def buildTvSerieModel(tvSerieMap: Map[String, String]): TvSerie = {
- val tvSerie: TvSerie = TvSerie(
- tvSerieMap("tconst"),
- tvSerieMap("titleType"),
- tvSerieMap("primaryTitle"),
- tvSerieMap("originalTitle"),
- tvSerieMap("startYear"),
- Option(tvSerieMap("endYear")),
- tvSerieMap("runtimeMinutes"),
- tvSerieMap("genres").split(",").toList
- )
- tvSerie
- }
-
- def buildEpisodeModel(episodeMap: Map[String, String]): Episode = {
- val episode: Episode = Episode(
- episodeMap("tconst"),
- episodeMap("parentTconst"),
- Option(episodeMap("seasonNumber")),
- Option(episodeMap("episodeNumber")),
- )
-
- episode
- }
- }
|