package Ġcom . network ed assets . git 4 c . core Ċ Ċ import Ġcom . atlassian . con fluence . core . service . Not Authorized Exception Ċ import Ġcom . github . kit tin un f . result . Result Ċ import Ġcom . network ed assets . git 4 c . application . Bus s ines Plugin Components Ċ import Ġcom . network ed assets . git 4 c . boundary . Get Document ations Default Branch By Document ations Macro Id Query Ċ import Ġcom . network ed assets . git 4 c . boundary . outbound . Branches Ċ import Ġcom . network ed assets . git 4 c . boundary . outbound . Verification Status Ċ import Ġcom . network ed assets . git 4 c . boundary . outbound . exceptions . NotFoundException Ċ import Ġcom . network ed assets . git 4 c . core . bus s iness . Source Plugin Ċ import Ġcom . network ed assets . git 4 c . core . datastore . repositories .* Ċ import Ġcom . network ed assets . git 4 c . core . process . IC heck User Permission Process Ċ import Ġcom . network ed assets . git 4 c . delivery . executor . execution . UseCase ĊĊ Ċ class ĠGet Document ations Default Branch By Document ations Macro Id UseCase ( ĊĠĠĠĠĠĠĠ Ġcomponents : ĠB uss ines Plugin Components , ĊĠĠĠĠĠĠĠ Ġval Ġimporter : ĠSource Plugin Ġ= Ġcomponents . macro . importer , ĊĠĠĠĠĠĠĠ Ġval Ġrepository Database : ĠRepository Database Ġ= Ġcomponents . providers . repository Provider , ĊĠĠĠĠĠĠĠ Ġval Ġmacro Settings Database : ĠMacro Settings Database Ġ= Ġcomponents . providers . macro Settings Provider , ĊĠĠĠĠĠĠĠ Ġval Ġcheck User Permission Process : ĠI Check User Permission Process Ġ= Ġcomponents . processing . check User Permission Process , ĊĠĠĠĠĠĠĠ Ġval Ġmacro Location Database : ĠMacro Location Database Ġ= Ġcomponents . database . macro Location Database , ĊĠĠĠĠĠĠĠ Ġval Ġtemporary Edit Branches Database : ĠTemporary Edit Branches Database Ġ= Ġcomponents . database . temporary Edit Branches Database Ċ ) Ġ: ĠUse Case < Get Document ations Default Branch By Document ations Macro Id Query , ĠBr anches > Ċ ( components ) Ġ{ ĊĠĠĠ Ġoverride Ġfun Ġexecute ( request : ĠGet Document ations Default Branch By Document ations Macro Id Query ): ĠResult < Branches , ĠException > Ġ{ ĊĊĠĠĠĠĠĠĠ Ġval Ġmacro Id Ġ= Ġrequest . macro Id ĊĠĠĠĠĠĠĠ Ġval Ġuser Ġ= Ġrequest . user ĊĊĠĠĠĠĠĠĠ Ġif Ġ( check User Permission Process . user Has Permission To Macro ( macro Id , Ġuser ) Ġ== Ġfalse ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġreturn ĠResult . error ( Not Authorized Exception (" User Ġdoesn 't Ġhave Ġpermission Ġto Ġthis Ġspace ")) ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġval Ġmacro Ġ= Ġmacro Settings Database . get ( macro Id ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ?: Ġreturn @ execute ĠResult . error ( NotFoundException ( request . transaction Info , ĠVerification Status . RE MOVED )) ĊĊĠĠĠĠĠĠĠ Ġval Ġmacro Location Ġ= Ġmacro Location Database . get ( macro Id ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ?: Ġreturn @ execute ĠResult . error ( NotFoundException ( request . transaction Info , ĠVerification Status . RE MOVED )) ĊĠĠĠĠĠĠĠ Ġval Ġrepository Id Ġ= Ġmacro . repository Uuid ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ?: Ġreturn @ execute ĠResult . error ( NotFoundException ( request . transaction Info , ĠVerification Status . RE MOVED )) ĊĠĠĠĠĠĠĠ Ġval Ġpage Id Ġ= Ġmacro Location . page Id ĊĊĠĠĠĠĠĠĠ Ġval Ġdefault Branch Ġ= Ġtemporary Edit Branches Database . get ( repository Id , Ġpage Id )?. name ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ?: Ġmacro Settings Database . get ( macro Id )?. branch ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ?: Ġreturn @ execute ĠResult . error ( NotFoundException ( request . transaction Info , ĠVerification Status . RE MOVED )) ĊĊĠĠĠĠĠĠĠ Ġreturn ĠResult . of Ġ{ ĠBr anches ( default Branch , ĠlistOf ()) Ġ} ĊĊĠĠĠ Ġ} Ċ } Ċ