package Ġcom . jetbrains . edu . learning . serialization . converter . json . local Ċ Ċ import Ġcom . fasterxml . jackson . databind . JsonNode Ċ import Ġcom . fasterxml . jackson . databind . ObjectMapper Ċ import Ġcom . fasterxml . jackson . databind . node . Object Node Ċ import Ġcom . jetbrains . edu . learning . E du Names Ċ import Ġcom . jetbrains . edu . learning . serialization . Serialization Utils . Json .* Ċ import Ġcom . jetbrains . edu . learning . step ik . Step ik Names Ċ Ċ class ĠTo 1 0 Version Local Course Converter Ġ: ĠJson Local Course Converter Base () Ġ{ ĊĊĠ Ġoverride Ġfun Ġconvert ( local Course : ĠObject Node ): ĠObject Node Ġ{ ĊĠĠĠ Ġconvert Additional Files ( local Course ) ĊĠĠĠ Ġreturn Ġsuper . convert ( local Course ) ĊĠ Ġ} ĊĊĠ Ġprivate Ġfun Ġconvert Additional Files ( local Course : ĠObject Node ) Ġ{ ĊĠĠĠ Ġval Ġadditional Files Ġ= ĠObjectMapper (). create Array Node () ĊĠĠĠ Ġval Ġcourse Items Ġ= Ġlocal Course . get JsonObject List ( ITEMS ) ĊĠĠĠ Ġval Ġadditional Materials Lesson Ġ= Ġcourse Items . single OrNull Ġ{ ĊĠĠĠĠĠ Ġis Additional ( it . get ( TITLE ). as Text ()) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġval Ġtask Ġ= Ġadditional Materials Lesson ?. get JsonObject List ( TASK _ LIST )?. single OrNull Ġ{ ĊĠĠĠĠĠ Ġis Additional ( it . get ( NAME ). as Text ()) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġtask ?. get ( FILES )?. fields ()?. forEach Ġ{ Ġ(_, Ġfile Object ) Ġ-> Ġadditional Files . add ( file Object ) Ġ} ĊĠĠĠ Ġlocal Course . set < JsonNode ? >( AD DITION AL _ FILES , Ġadditional Files ) ĊĠĠĠ Ġif Ġ( additional Materials Lesson Ġ!= Ġnull ) Ġ{ ĊĠĠĠĠĠ Ġlocal Course . get ( ITEMS ). removeAll Ġ{ Ġis Additional ( it . get ( TITLE ). as Text ()) Ġ} ĊĠĠĠ Ġ} ĊĠ Ġ} ĊĊĠ Ġprivate Ġfun Ġis Additional ( name : ĠString ) Ġ= Ġ( name Ġ== ĠE du Names . AD DITION AL _ MAT ERIAL S Ġ|| Ġname Ġ== ĠSte pi k Names . PY CHAR M _ AD DITION AL ) ĊĊĠ Ġoverride Ġfun Ġconvert Task Object ( task Object : ĠObject Node , Ġlanguage : ĠString ) Ġ{ ĊĠĠĠ Ġconvert Task Object ( task Object ) ĊĠ Ġ} ĊĊĠ Ġcompanion Ġobject Ġ{ ĊĠĠĠ Ġ@ Jvm Static ĊĠĠĠ Ġfun Ġconvert Task Object ( task Object : ĠObject Node ) Ġ{ ĊĠĠĠĠĠ Ġval Ġdescription Format Ġ= Ġtask Object . get ( DESCRIPTION _ FORMAT )?. as Text () ĊĠĠĠĠĠ Ġif Ġ( description Format Ġ!= Ġnull ) Ġ{ ĊĠĠĠĠĠĠĠ Ġtask Object . put ( DESCRIPTION _ FORMAT , Ġdescription Format . uppercase ()) ĊĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĠ Ġ} Ċ } Ċ