package Ġcom . r js . my shows . services . controller Ċ Ċ import Ġcom . r js . my shows . common . domain .* Ċ import Ġcom . r js . my shows . services . config . AppConfig Ċ import Ġcom . r js . my shows . services . domain . Show Entity Ċ import Ġcom . r js . my shows . services . service . Show Service Ċ import Ġcom . r js . my shows . services . service . Show Type Service Ċ import Ġorg . model mapper . Model Mapper Ċ Ċ abstract Ġclass ĠShow Controller ( ĊĠĠĠ Ġprotected Ġval Ġshow Service : ĠShow Service , ĊĠĠĠ Ġprotected Ġval Ġshow Type Service : ĠShow Type Service , ĊĠĠĠ Ġprotected Ġval Ġmodel Mapper : ĠModelMapper , ĊĠĠĠ Ġprotected Ġval Ġapp Config : ĠApp Config Ċ ) Ġ{ ĊĊĠĠĠ Ġprotected Ġfun Ġinitialize Show Filter () Ġ= ĠShow Filter Dto ( ĊĠĠĠĠĠĠĠ Ġ" Movie ", ĊĠĠĠĠĠĠĠ Ġmedia Formats [ 0 ], ĊĠĠĠĠĠĠĠ Ġstar Ratings [ star Ratings . last Index ] ĊĠĠĠ Ġ) ĊĊĠĠĠ Ġprotected Ġfun Ġbuild Search Model ( ĊĠĠĠĠĠĠĠ Ġshow Filter Dto : ĠShow Filter Dto , ĊĠĠĠĠĠĠĠ Ġuser Show Filters : ĠMutable List < User Show Filter Dto >, ĊĠĠĠĠĠĠĠ Ġsel User Filter : ĠString ? Ġ= Ġnull , ĊĠĠĠĠĠĠĠ Ġsearch Results : ĠMutable List < Show Entity > Ġ= Ġmutable ListOf ()) ĊĠĠĠĠĠĠĠ Ġ: ĠMap < String , ĠAny ?> Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġmodel : ĠMutable Map < String , ĠAny ?> Ġ= Ġhash Map Of () ĊĠĠĠĠĠĠĠ Ġval Ġshow Dto s : ĠList < Show Dto > Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ Ġif Ġ( search Results . isNotEmpty ()) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġsearch Results . map { show Ġ-> ĠconvertTo Show Dto ( show )} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġelse Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠlistOf () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġmodel [" show Types "] Ġ= Ġshow Type Service . getAll () ĊĠĠĠĠĠĠĠ Ġmodel [" star Ratings "] Ġ= Ġstar Ratings ĊĠĠĠĠĠĠĠ Ġmodel [" media Formats "] Ġ= Ġmedia Formats ĊĠĠĠĠĠĠĠ Ġmodel [" user Filters "] Ġ= Ġuser Show Filters ĊĠĠĠĠĠĠĠ Ġmodel [" sel User Filter "] Ġ= Ġsel User Filter ĊĠĠĠĠĠĠĠ Ġmodel [" show Search Filter "] Ġ= Ġshow Filter Dto ĊĠĠĠĠĠĠĠ Ġmodel [" num Results "] Ġ= Ġshow Dto s . size ĊĠĠĠĠĠĠĠ Ġmodel [" shows "] Ġ= Ġshow Dto s ĊĊĠĠĠĠĠĠĠ Ġreturn Ġmodel ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprotected Ġfun ĠconvertTo Show Dto ( show : ĠShow Entity ) Ġ= Ġmodel Mapper . map ( show , ĠShow Dto :: class . java ) !! Ċ }