package Ġcom . t cc . booking hotel . domain . use case Ċ Ċ import Ġcom . t cc . booking hotel . domain . entity . Company Ċ import Ġcom . t cc . booking hotel . domain . exception . Company Registry Exception Ċ import Ġcom . t cc . booking hotel . domain . exception . Type Exception Ċ import Ġcom . t cc . booking hotel . domain . repository . Company Repository Ċ import Ġorg . springframework . stereotype . Component Ċ Ċ private Ġconst Ġval ĠCOMP ANY _ REGISTR T ATION _ MESSAGE Ġ= Ġ" Company Ġalready Ġregist red " Ċ Ċ @ Component Ċ class ĠRegister New Company ( ĊĠĠĠ Ġprivate Ġval Ġcompany Repository : ĠCompany Repository Ċ ) Ġ{ ĊĊĠĠĠ Ġsuspend Ġfun Ġexecute ( company : ĠCompany ): ĠCompany Ġ{ ĊĠĠĠĠĠĠĠ Ġif Ġ( company Repository . exists By Email ( company . email )) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġthrow ĠCompany Registry Exception ( Type Exception . COMP ANY _ REGISTR ATION , ĠCOMP ANY _ REGISTR T ATION _ MESSAGE ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġreturn Ġcompany Repository . create ( company ) ĊĠĠĠ Ġ} Ċ }