package Ġcom . netflix . spin n aker . ke el . rest Ċ Ċ import Ġcom . netflix . spin n aker . ke el . persistence . Delivery Config Repository Ċ import Ġcom . netflix . spin n aker . ke el . persistence . NoSuch Application Ċ import Ġcom . netflix . spin n aker . ke el . persistence . NoSuch Resource Exception Ċ import Ġcom . netflix . spin n aker . ke el . persistence . Resource Repository Ċ import Ġorg . slf 4 j . LoggerFactory . getLogger Ċ import Ġorg . springframework . http . HttpStatus Ċ import Ġorg . springframework . http . HttpStatus . NO _ CONTENT Ċ import Ġorg . springframework . web . bind . annotation . Delete Mapping Ċ import Ġorg . springframework . web . bind . annotation . PathVariable Ċ import Ġorg . springframework . web . bind . annotation . RequestMapping Ċ import Ġorg . springframework . web . bind . annotation . RestController Ċ import Ġorg . springframework . web . bind . annotation . ResponseStatus Ċ import Ġorg . springframework . web . bind . annotation . ExceptionHandler Ċ Ċ @ RestController Ċ @ RequestMapping ( path Ġ= Ġ["/ admin "]) Ċ class ĠAdmin Controller ( ĊĠ Ġprivate Ġval Ġdelivery Config Repository : ĠDelivery Config Repository , ĊĠ Ġprivate Ġval Ġresource Repository : ĠResource Repository Ċ ) Ġ{ ĊĠ Ġprivate Ġval Ġlog Ġby Ġlazy Ġ{ Ġget Logger ( java Class ) Ġ} ĊĊĠ Ġ@ Delete Mapping ( ĊĠĠĠĠĠ Ġpath Ġ= Ġ["/ applications /{ application } "] ĊĠ Ġ) ĊĠ Ġ@ ResponseStatus ( NO _ CONTENT ) ĊĠ Ġfun Ġdelete Application Data ( ĊĠĠĠ Ġ@ PathVariable (" application ") Ġapplication : ĠString ĊĠ Ġ) Ġ{ ĊĠĠĠ Ġlog . debug (" Deleting Ġall Ġdata Ġfor Ġapplication : Ġ$ application ") ĊĠĠĠ Ġdelete Application ( application ) ĊĠ Ġ} ĊĊĠ Ġ@ ExceptionHandler ( NoSuch Resource Exception :: class ) ĊĠ Ġ@ ResponseStatus ( HttpStatus . NOT _ FOUND ) ĊĠ Ġfun Ġon NotFound ( e : ĠNoSuch Resource Exception ) Ġ{ ĊĠĠĠ Ġlog . error ( e . message ) ĊĠ Ġ} ĊĊĠ Ġfun Ġdelete Application ( application : ĠString ) Ġ{ ĊĠĠĠ Ġval Ġresources Ġ= Ġresource Repository . delete By Application ( application ) ĊĠĠĠ Ġval Ġdelivery Configs Ġ= Ġdelivery Config Repository . delete By Application ( application ) ĊĠĠĠ Ġif Ġ( resources Ġ== Ġ 0 Ġ&& Ġdelivery Configs Ġ== Ġ 0 ) ĊĠĠĠĠĠ Ġthrow ĠNoSuch Application ( application ) ĊĠ Ġ} Ċ } Ċ