/* Ċ Ġ* Ġspring - message - board - demo Ċ Ġ* ĠRefer Ġto ĠLIC ENCE . txt Ġfor Ġlicence Ġdetails . Ċ Ġ*/ Ċ package Ġcom . github . fj . board . endpoint . v 1 . board Ċ Ċ import Ġcom . github . fj . board . component . auth . Controller Client Auth Info Detector Ċ import Ġcom . github . fj . board . endpoint . Api Paths Ċ import Ġcom . github . fj . board . endpoint . common . Fetch Criteria Request Mixin . Companion . GET _ LIST _ PARAM _ ORDER _ BY Ċ import Ġcom . github . fj . board . endpoint . common . Fetch Criteria Request Mixin . Companion . GET _ LIST _ PARAM _ SORT _ BY Ċ import Ġcom . github . fj . board . endpoint . v 1 . Optional Client Auth Info Mixin Ċ import Ġcom . github . fj . board . endpoint . v 1 . board . response . Board InfoList Response Ċ import Ġcom . github . fj . board . endpoint . v 1 . board . response . Board Info Response Ċ import Ġcom . github . fj . board . service . board . Get Board Service Ċ import Ġcom . github . fj . board . vo . Sort Direction Ċ import Ġcom . github . fj . board . vo . board . Board s Sort By Ċ import Ġcom . github . fj . lib . text . REGEX _ UUID Ċ import Ġorg . slf 4 j . LoggerFactory Ċ import Ġorg . springframework . http . MediaType Ċ import Ġorg . springframework . util . Multi Value Map Ċ import Ġorg . springframework . validation . annotation . Validated Ċ import Ġorg . springframework . web . bind . annotation . PathVariable Ċ import Ġorg . springframework . web . bind . annotation . RequestMapping Ċ import Ġorg . springframework . web . bind . annotation . Request Method Ċ import Ġorg . springframework . web . bind . annotation . RequestParam Ċ import Ġorg . springframework . web . bind . annotation . RestController Ċ import Ġjava . util .* Ċ import Ġjavax . servlet . http . HttpServletRequest Ċ import Ġjavax . validation . constraints . Pattern Ċ Ċ /** Ċ Ġ* Ġ@ author ĠFr ances co ĠJo ( nim bus ob @ gmail . com ) Ċ Ġ* Ġ@ since Ġ 2 2 Ġ- ĠJul Ġ- Ġ 2 0 2 0 Ċ Ġ*/ Ċ @ RequestMapping ( ĊĠĠĠ Ġproduces Ġ= Ġ[ MediaType . APPLICATION _ JSON _ VALUE ], ĊĠĠĠ Ġconsume s Ġ= Ġ[ MediaType . APPLICATION _ JSON _ VALUE ] Ċ ) Ċ @ Validated Ċ interface ĠGet Board Controller Ġ{ ĊĠĠĠ Ġ@ RequestMapping ( ĊĠĠĠĠĠĠĠ Ġpath Ġ= Ġ[ Api Paths . BOARD _ ID ], ĊĠĠĠĠĠĠĠ Ġmethod Ġ= Ġ[ Request Method . GET ] ĊĠĠĠ Ġ) ĊĠĠĠ Ġfun Ġget One ( ĊĠĠĠĠĠĠĠ Ġ@ Pattern ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġregexp Ġ= ĠREG EX _ UUID , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġmessage Ġ= Ġ"` board Id ` Ġmust Ġbe Ġin Ġa ĠUUID Ġformat ." ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġ@ PathVariable ĊĠĠĠĠĠĠĠ Ġboard Id : ĠString , ĊĠĠĠĠĠĠĠ Ġhttp Req : ĠHttpServletRequest ĊĠĠĠ Ġ): ĠBoard Info Response ĊĊĠĠĠ Ġ@ RequestMapping ( ĊĠĠĠĠĠĠĠ Ġpath Ġ= Ġ[ Api Paths . BO AR DS ], ĊĠĠĠĠĠĠĠ Ġmethod Ġ= Ġ[ Request Method . GET ] ĊĠĠĠ Ġ) ĊĠĠĠ Ġfun ĠgetList ( ĊĠĠĠĠĠĠĠ Ġ@ RequestParam Ġparams : ĠMulti Value Map < String , ĠString >, ĊĠĠĠĠĠĠĠ Ġhttp Req : ĠHttpServletRequest ĊĠĠĠ Ġ): ĠBoard InfoList Response Ċ } Ċ Ċ /** Ċ Ġ* Ġ@ author ĠFr ances co ĠJo ( nim bus ob @ gmail . com ) Ċ Ġ* Ġ@ since Ġ 2 2 Ġ- ĠJul Ġ- Ġ 2 0 2 0 Ċ Ġ*/ Ċ @ RestController Ċ internal Ġclass ĠGet Board Controller Impl ( ĊĠĠĠ Ġoverride Ġval Ġauth Detector : ĠController Client Auth Info Detector , ĊĠĠĠ Ġprivate Ġval Ġsvc : ĠGet Board Service Ċ ) Ġ: ĠGet Board Controller , ĠOptional Client Auth Info Mixin Ġ{ ĊĠĠĠ Ġoverride Ġfun Ġget One ( board Id : ĠString , Ġhttp Req : ĠHttpServletRequest ): ĠBoard Info Response Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġclient Info Ġ= Ġhttp Req . maybe Client Auth Info ( LOG ) ĊĊĠĠĠĠĠĠĠ Ġval Ġresult Ġ= Ġsvc . getOne ( UUID . fromString ( board Id ), Ġclient Info ) ĊĊĠĠĠĠĠĠĠ Ġreturn ĠBoard Info Response . from ( result ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun ĠgetList ( ĊĠĠĠĠĠĠĠ Ġparams : ĠMulti Value Map < String , ĠString >, ĊĠĠĠĠĠĠĠ Ġhttp Req : ĠHttpServletRequest ĊĠĠĠ Ġ): ĠBoard InfoList Response Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġclient Info Ġ= Ġhttp Req . maybe Client Auth Info ( LOG ) ĊĊĠĠĠĠĠĠĠ Ġval ĠsortBy Ġ= Ġparams . getFirst ( GET _ LIST _ PARAM _ SORT _ BY )?. let Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠBo ards Sort By . fromString ( it ) ĊĠĠĠĠĠĠĠ Ġ} Ġ?: ĠBo ards Sort By . KEY ĊĠĠĠĠĠĠĠ Ġval Ġsort Direction Ġ= Ġ( params . getFirst ( GET _ LIST _ PARAM _ ORDER _ BY )?. let Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠSort Direction . fromString ( it ) ĊĠĠĠĠĠĠĠ Ġ} Ġ?: ĠSort Direction . ASC ENDING ). direction ĊĊĠĠĠĠĠĠĠ Ġval Ġresult Ġ= Ġsvc . getList ( sortBy , Ġsort Direction , Ġclient Info ) ĊĊĠĠĠĠĠĠĠ Ġreturn ĠBoard InfoList Response . from ( result ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġcompanion Ġobject Ġ{ ĊĠĠĠĠĠĠĠ Ġprivate Ġval ĠLOG Ġ= ĠLoggerFactory . getLogger ( Get Board Controller :: class . java ) ĊĠĠĠ Ġ} Ċ } Ċ