package Ġse . score board . api Ċ Ċ import Ġio . swagger . annotations . Api Ċ import Ġorg . springframework . beans . factory . annotation . Autowired Ċ import Ġorg . springframework . http . Response Entity Ċ import Ġorg . springframework . security . access . pre post . Pre Authorize Ċ import Ġorg . springframework . web . bind . annotation .* Ċ import Ġse . score board . dto . Comp Class Dto Ċ import Ġse . score board . dto . Cont ender Dto Ċ import Ġse . score board . mapper . Comp Class Mapper Ċ import Ġse . score board . mapper . Cont ender Mapper Ċ import Ġse . score board . service . Comp Class Service Ċ import Ġjavax . transaction . Transactional Ċ Ċ @ RestController Ċ @ Cross Origin Ċ @ RequestMapping ("/ api ") Ċ @ Api ( tags Ġ= Ġ[" Comp ĠClasses "]) Ċ class ĠComp Class Controller Ġ@ Autowired Ġconstructor ( ĊĠĠĠĠĠĠĠ Ġval Ġcomp Class Service : ĠComp Class Service , ĊĠĠĠĠĠĠĠ Ġprivate Ġval Ġcont ender Mapper : ĠCont ender Mapper , ĊĠĠĠĠĠĠĠ Ġprivate Ġval Ġcomp Class Mapper : ĠComp Class Mapper ) Ġ{ ĊĊĠĠĠ Ġ@ GetMapping ("/ comp Classes /{ id }") ĊĠĠĠ Ġ@ Pre Authorize (" has Permission (# id , Ġ' Comp Class ', Ġ' read ') ") ĊĠĠĠ Ġ@ Transactional ĊĠĠĠ Ġfun Ġget Comp Class (@ PathVariable (" id ") Ġid : ĠInt ) Ġ= Ġcomp Class Service . findById ( id ) ĊĊĠĠĠ Ġ@ GetMapping ("/ comp Classes /{ id }/ cont enders ") ĊĠĠĠ Ġ@ Pre Authorize (" has Permission (# id , Ġ' Comp Class ', Ġ' read ') ") ĊĠĠĠ Ġ@ Transactional ĊĠĠĠ Ġfun Ġget Comp Class Cont enders (@ PathVariable (" id ") Ġid : ĠInt ) Ġ: ĠList < Cont ender Dto > Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ Ġcomp Class Service . fetch Entity ( id ). cont enders . map Ġ{ Ġcont ender Ġ-> Ġcont ender Mapper . convertTo Dto ( cont ender ) Ġ} ĊĊĠĠĠ Ġ@ Put Mapping ("/ comp Classes /{ id }") ĊĠĠĠ Ġ@ Pre Authorize (" has Permission (# id , Ġ' Comp Class ', Ġ' write ') ") ĊĠĠĠ Ġ@ Transactional ĊĠĠĠ Ġfun Ġupdate Comp Class ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ@ PathVariable (" id ") Ġid : ĠInt , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ@ RequestBody Ġcomp Class Ġ: ĠComp Class Dto ): ĠResponseEntity < Comp Class Dto > Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġold Ġ= Ġcomp Class Service . fetch Entity ( id ) ĊĊĠĠĠĠĠĠĠ Ġval Ġentity Ġ= Ġcomp Class Mapper . convertTo Entity ( comp Class ) ĊĠĠĠĠĠĠĠ Ġentity . contest Ġ= Ġold . contest ĊĠĠĠĠĠĠĠ Ġentity . organ izer Ġ= Ġold . organ izer ĊĊĠĠĠĠĠĠĠ Ġreturn Ġcomp Class Service . update ( id , Ġentity ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Delete Mapping ("/ comp Classes /{ id }") ĊĠĠĠ Ġ@ Pre Authorize (" has Permission (# id , Ġ' Comp Class ', Ġ' delete ') ") ĊĠĠĠ Ġ@ Transactional ĊĠĠĠ Ġfun Ġdelete Comp Class (@ PathVariable (" id ") Ġid : ĠInt ) Ġ= Ġcomp Class Service . delete ( id ) Ċ } Ċ