/* Ċ Ġ* Ċ Ġ* Ġ ĠCopyright Ġ 2 0 2 0 ĠZ UP ĠIT ĠSER V IC OS ĠEM ĠT EC NO LOG IA ĠE ĠIN OV AC AO ĠSA Ċ Ġ* Ċ Ġ* Ġ ĠLicensed Ġunder Ġthe ĠApache ĠLicense , ĠVersion Ġ 2 . 0 Ġ( the Ġ" License "); Ċ Ġ* Ġ Ġyou Ġmay Ġnot Ġuse Ġthis Ġfile Ġexcept Ġin Ġcompliance Ġwith Ġthe ĠLicense . Ċ Ġ* Ġ ĠYou Ġmay Ġobtain Ġa Ġcopy Ġof Ġthe ĠLicense Ġat Ċ Ġ* Ċ Ġ* ĠĠĠĠĠ Ġhttp :// www . apache . org / licenses / LICENSE - 2 . 0 Ċ Ġ* Ċ Ġ* Ġ ĠUnless Ġrequired Ġby Ġapplicable Ġlaw Ġor Ġagreed Ġto Ġin Ġwriting , Ġsoftware Ċ Ġ* Ġ Ġdistributed Ġunder Ġthe ĠLicense Ġis Ġdistributed Ġon Ġan Ġ" AS ĠIS " ĠBASIS , Ċ Ġ* Ġ ĠWITHOUT ĠWARRANTIES ĠOR ĠCONDITIONS ĠOF ĠANY ĠKIND , Ġeither Ġexpress Ġor Ġimplied . Ċ Ġ* Ġ ĠSee Ġthe ĠLicense Ġfor Ġthe Ġspecific Ġlanguage Ġgoverning Ġpermissions Ġand Ċ Ġ* Ġ Ġlimitations Ġunder Ġthe ĠLicense . Ċ Ġ* Ċ Ġ*/ Ċ Ċ package Ġio . char le sc d . m oo ve . application . deployment . impl Ċ Ċ import Ġio . char le sc d . m oo ve . application . Resource Page Response Ċ import Ġio . char le sc d . m oo ve . application . deployment . Find Deployments History For Circle Interactor Ċ import Ġio . char le sc d . m oo ve . application . deployment . response . Deployment History Response Ċ import Ġio . char le sc d . m oo ve . domain . Component History Ċ import Ġio . char le sc d . m oo ve . domain . Deployment History Filter Ċ import Ġio . char le sc d . m oo ve . domain . Deployment Status Enum Ċ import Ġio . char le sc d . m oo ve . domain . Page Request Ċ import Ġio . char le sc d . m oo ve . domain . repository . Component Repository Ċ import Ġio . char le sc d . m oo ve . domain . repository . Deployment Repository Ċ import Ġjavax . inject . Named Ċ Ċ @ Named Ċ class ĠFind Deployments History For Circle Interactor Impl ( ĊĠĠĠ Ġprivate Ġval Ġdeployment Repository : ĠDeployment Repository , ĊĠĠĠ Ġprivate Ġval Ġcomponent Repository : ĠComponent Repository Ċ ) Ġ: ĠFind Deployments History For Circle Interactor Ġ{ ĊĊĠĠĠ Ġoverride Ġfun Ġexecute ( workspace Id : ĠString , Ġcircle : ĠString , Ġpage Request : ĠPage Request ): ĠResource Page Response < Deployment History Response > Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġpage d Deployments History Ġ= Ġthis . deployment Repository . find Deployments History ( workspace Id , Ġmount History Filter ( circle ), Ġpage Request ) ĊĊĠĠĠĠĠĠĠ Ġval Ġcomponents Map Ġ= Ġget Components At Deployments ( page d Deployments History . content . map Ġ{ Ġit . id Ġ}, Ġworkspace Id ) ĊĊĠĠĠĠĠĠĠ Ġreturn ĠResource Page Response . from ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġpage d Deployments History . content . map Ġ{ ĠDeployment History Response . from ( it , Ġcomponents Map . getValue ( it . id )) Ġ}. sorted By Descending Ġ{ Ġit . createdAt Ġ}, ĊĠĠĠĠĠĠĠĠĠĠĠ Ġpage d Deployments History . pageNumber , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġpage d Deployments History . pageSize , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġpage d Deployments History . is Last (), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġpage d Deployments History . total Pages () ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġget Components At Deployments ( deployments Ids : ĠList < String >, Ġworkspace Id : ĠString ): ĠMap < String , ĠList < Component History >> Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġwhen Ġ( deployments Ids . isEmpty ()) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġtrue Ġ-> Ġempty Map () ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġfalse Ġ-> Ġthis . component Repository . find Components At Deployments ( workspace Id , Ġdeployments Ids ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. groupBy Ġ{ Ġit . deployment Id Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġmount History Filter ( circle Id : ĠString ) Ġ= ĠDeployment History Filter ( ĊĠĠĠĠĠĠĠ Ġcircles Ids Ġ= ĠlistOf ( circle Id ), ĊĠĠĠĠĠĠĠ Ġdeployment Status Ġ= ĠlistOf ( Deployment Status Enum . DEPLOY ED , ĠDeployment Status Enum . NOT _ DEPLOY ED , ĠDeployment Status Enum . DEPLOY _ FAILED ) ĊĠĠĠ Ġ) Ċ } Ċ