package Ġcom . so yle . stories . use case . location . createNew Location Ċ Ċ import Ġcom . so yle . stories . domain . location . Hosted Scene Ċ import Ġcom . so yle . stories . domain . location . Location Ċ import Ġcom . so yle . stories . domain . project . Project Ċ import Ġcom . so yle . stories . domain . scene . Scene Ċ import Ġcom . so yle . stories . domain . validation . Single Non Blank Line Ċ import Ġcom . so yle . stories . domain . validation . entity Set Of Ċ import Ġcom . so yle . stories . use case . location . Location Repository Ċ import Ġjava . util .* Ċ Ċ class ĠCreate New Location UseCase ( ĊĠ ĠprojectId : ĠUUID , ĊĠ Ġprivate Ġval Ġlocation Repository : ĠLocation Repository Ċ ) Ġ: ĠCreate New Location Ġ{ ĊĊ ĉ private Ġval ĠprojectId : ĠProject . Id Ġ= ĠProject . Id ( projectId ) ĊĊ ĉ override Ġsuspend Ġfun Ġinvoke ( name : ĠSingle Non Blank Line , Ġdescription : ĠString ?, Ġoutput : ĠCreate New Location . Output Port ) Ġ{ Ċĉ ĉ val Ġresponse Ġ= Ġtry Ġ{ Ċĉĉ ĉ createNew Location ( name , Ġdescription ) Ċĉ ĉ } Ġcatch Ġ( l : ĠException ) Ġ{ Ċĉĉ ĉ return Ġoutput . receive Create New Location Failure ( l ) Ċĉ ĉ } Ċĉ ĉ output . receive Create New Location Response ( response ) Ċ ĉ } ĊĊ ĉ private Ġsuspend Ġfun Ġcreate New Location ( name : ĠSingle Non Blank Line , Ġdescription : ĠString ?): ĠCreate New Location . Response Model Ġ{ Ċĉ ĉ val Ġlocation Ġ= Ġcreate Location ( name , Ġdescription ) Ċĉ ĉ add New Location ( location ) Ċĉ ĉ return ĠCreate New Location . Response Model ( location . id . uuid , Ġname . value ) Ċ ĉ } ĊĊ ĉ private Ġfun Ġcreate Location ( name : ĠSingle Non Blank Line , Ġdescription : ĠString ?): ĠLocation Ġ{ Ċĉ ĉ val Ġid Ġ= ĠLocation . Id () Ċĉ ĉ return ĠLocation ( id , ĠprojectId , Ġname , Ġdescription Ġ?: Ġ"", Ġentity Set Of ()) Ċ ĉ } ĊĊ ĉ private Ġsuspend Ġfun Ġadd New Location ( location : ĠLocation ) Ġ{ Ċĉ ĉ location Repository . add New Location ( location ) Ċ ĉ } Ċ }