package Ġza . co . b sg . rain dro ps . service Ċ Ċ import Ġcom . fasterxml . jackson . databind . ObjectMapper Ċ import Ġcom . fasterxml . jackson . module . kotlin . readValue Ċ import Ġorg . slf 4 j . LoggerFactory Ċ import Ġorg . springframework . beans . factory . annotation . Autowired Ċ import Ġorg . springframework . stereotype . Service Ċ import Ġza . co . b sg . rain dro ps . api . Deployment ApiClient Ċ import Ġza . co . b sg . rain dro ps . model . dto . Deployment DTO Ċ import Ġza . co . b sg . rain dro ps . model . dto . Personal Info DTO Ċ import Ġza . co . b sg . rain dro ps . model . mapper . Deployment Mapper Ċ import Ġza . co . b sg . rain dro ps . repository . Deployment Repository Ċ Ċ @ Service Ċ class ĠDeployment Service Ġ@ Autowired Ġconstructor ( ĊĠĠĠĠĠĠĠ Ġprivate Ġval Ġdeployment Mapper : ĠDeployment Mapper , ĊĠĠĠĠĠĠĠ Ġprivate Ġval Ġdeployment ApiClient : ĠDeployment ApiClient , ĊĠĠĠĠĠĠĠ Ġprivate Ġval Ġdeployment Repository : ĠDeployment Repository ) Ġ{ ĊĊĠĠĠ Ġprivate Ġval Ġlogger Ġ= ĠLoggerFactory . getLogger ( java Class ) ĊĊĠĠĠ Ġ@ Throws ( Exception :: class ) ĊĠĠĠ Ġfun Ġget And Store Deployments () Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġtry Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġlogger . debug (" At tempting Ġto Ġcall Ġand Ġthen Ġstore ĠDeployment Ġobjects ") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġdeployment DTO List : ĠList < Deployment DTO > Ġ= ĠObjectMapper (). readValue ( deployment ApiClient . get Deployments ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġdeployment Repository . save All ( deployment Mapper . to DAO ( deployment DTO List )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġlogger . debug (" Successfully Ġcalled Ġand Ġthen Ġstored ĠDeployment Ġobjects ") ĊĠĠĠĠĠĠĠ Ġ} Ġcatch Ġ( e : ĠException ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġlogger . error ( e . message ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġthrow Ġe ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun ĠgetAll Deployments (): ĠList < Deployment DTO >? Ġ{ ĊĠĠĠĠĠĠĠ Ġlogger . debug (" At tempting Ġto Ġretrieve Ġall ĠDeployment Ġobjects Ġfrom Ġdata Ġstore ") ĊĠĠĠĠĠĠĠ Ġreturn Ġdeployment Mapper . to DTO ( deployment Repository . findAll ()) ĊĠĠĠ Ġ} Ċ }