package Ġcom . low es . aud itor . client . library . service Ċ Ċ import Ġcom . low es . aud itor . client . entities . domain . Aud itor Event Config Ċ import Ġcom . low es . aud itor . client . entities . interfaces . use case . Audit Event Element Filter Ċ import Ġcom . low es . aud itor . client . entities . interfaces . use case . Audit Event Filter Ċ import Ġcom . low es . aud itor . core . entities . domain . Audit Event Ċ import Ġreactor . core . publisher . Flux Ċ Ċ /** Ċ Ġ* ĠAudit Ġevent Ġfilter Ġservice Ġthat Ġorche str ates Ġthe Ġ[ Audit Event ] Ġflow Ġthrough Ġvarious Ġ[ Audit Event Filter ] Ġand Ġ[ Audit Event Element Filter ] Ċ Ġ* Ġ@ property Ġevent Filter UseCase Ġtype Ġof Ġ[ Audit Event Filter ] Ġwhich Ġapplies Ġfilter Ġlogic Ġbased Ġon Ġaudit Ġevent Ċ Ġ* Ġ@ property Ġelement Filter UseCase Ġtype Ġof Ġ[ Audit Event Element Filter ] Ġwhich Ġapplies Ġfilter Ġlogic Ġbased Ġon Ġaudit Ġevent 's Ġelements Ċ Ġ* Ġ@ property Ġlogging Filter UseCase Ġtype Ġof Ġ[ Audit Event Element Filter ] Ġwhich Ġapplies Ġlogging Ġfilter Ġbased Ġon Ġaudit Ġevent Ċ Ġ*/ Ċ class ĠAudit Event Filter Service ( ĊĠĠĠ Ġprivate Ġval Ġevent Filter UseCase : ĠAudit Event Filter , ĊĠĠĠ Ġprivate Ġval Ġelement Filter UseCase : ĠAudit Event Element Filter , ĊĠĠĠ Ġprivate Ġval Ġlogging Filter UseCase : ĠAudit Event Filter , Ċ ) Ġ{ ĊĊĠĠĠ Ġ/** ĊĠĠĠĠ Ġ* ĠFilters Ġflux Ġof Ġ[ Audit Event ] Ġbased Ġall Ġexisting Ġfilters Ġand Ġconfigurations Ġpresent Ġin Ġ[ aud itor Event Config ] ĊĠĠĠĠ Ġ* Ġ@ param Ġevents Ġflux Ġof Ġ[ Audit Event ] ĊĠĠĠĠ Ġ* Ġ@ param Ġaud itor Event Config Ġinstance Ġof Ġ[ Aud itor Event Config ] ĊĠĠĠĠ Ġ* Ġ@ return Ġfiltered Ġflux Ġof Ġ[ Audit Event ] ĊĠĠĠĠ Ġ*/ ĊĠĠĠ Ġfun Ġfilter ( events : ĠFlux < Audit Event >, Ġaud itor Event Config : ĠAud itor Event Config ): ĠFlux < Audit Event > Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn ĠFlux . defer Context ual Ġ{ Ġcontext Ġ-> Ġevents . map Ġ{ Ġcontext Ġto Ġit Ġ} Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. filter Ġ{ Ġevent Filter UseCase . filter ( it . first , Ġit . second , Ġaud itor Event Config . filters ) Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. map Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġevent Ġ= Ġit . second ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġit . first Ġto ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġevent . copy ( elements Ġ= Ġelement Filter UseCase . filter ( event . elements . or Empty (), Ġaud itor Event Config . filters ?. element )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. filter Ġ{ Ġ! it . second . log . isNull OrEmpty () Ġ|| Ġ! it . second . elements . isNull OrEmpty () Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. filter Ġ{ Ġlogging Filter UseCase . filter ( it . first , Ġit . second , Ġaud itor Event Config . filters ) Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. map Ġ{ Ġit . second Ġ} ĊĠĠĠ Ġ} Ċ } Ċ