package Ġpl . so kol ik . bar to sz . transaction manager . transaction . control Ċ Ċ import Ġorg . apache . commons . lang 3 . StringUtils Ċ import Ġorg . springframework . data . domain . Sort Ċ import Ġorg . springframework . data . mongodb . core . Mongo Template Ċ import Ġorg . springframework . data . mongodb . core . query . Criteria Ċ import Ġorg . springframework . data . mongodb . core . query . Query Ċ import Ġorg . springframework . stereotype . Repository Ċ import Ġpl . so kol ik . bar to sz . transaction manager . transaction . boundary . Transaction Repository Ċ import Ġpl . so kol ik . bar to sz . transaction manager . transaction . model . Transaction Document Ċ Ċ @ Repository Ċ class ĠAdapt ed Transaction Repository ( ĊĠĠĠ Ġprivate Ġval Ġtransaction Mongo Repository : ĠTransaction Mongo Repository , ĊĠĠĠ Ġprivate Ġval Ġmongo Template : ĠMongo Template ) Ġ: ĠTransaction Repository Ġ{ ĊĊĠĠĠ Ġcompanion Ġobject Ġ{ ĊĠĠĠĠĠĠĠ Ġconst Ġval ĠALL _ VALUES Ġ= Ġ" ALL " ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun ĠfindAll ( search Query : ĠTransaction Query ): ĠList < Transaction Document > Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġquery Ġ= ĠQuery (). with ( Sort . by ( Sort . Direction . ASC , Ġ" transaction Amount ")) ĊĠĠĠĠĠĠĠ Ġadd Account Type Criteria ( search Query , Ġquery ) ĊĠĠĠĠĠĠĠ Ġadd CustomerId Criteria ( search Query , Ġquery ) ĊĠĠĠĠĠĠĠ Ġreturn Ġmongo Template . find ( query , ĠTransaction Document :: class . java ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġsave All ( transactions : ĠIterable < Transaction Document >): ĠList < Transaction Document > Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġtransaction Mongo Repository . save All ( transactions ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġdelete All () Ġ{ ĊĠĠĠĠĠĠĠ Ġtransaction Mongo Repository . delete All () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġadd Account Type Criteria ( transaction Search Query : ĠTransaction Query , Ġquery : ĠQuery ) Ġ{ ĊĠĠĠĠĠĠĠ Ġtransaction Search Query . account Type ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ? . take If Ġ{ Ġaccount Type Ġ-> Ġis NotBlank Or All ( account Type ) Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ? . split (",") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ? . also Ġ{ Ġaccount Types Ġ-> Ġquery . add Criteria ( Criteria . where (" account Type . type "). ` in `( account Types )) Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġadd CustomerId Criteria ( transaction Search Query : ĠTransaction Query , Ġquery : ĠQuery ) Ġ{ ĊĠĠĠĠĠĠĠ Ġtransaction Search Query . customer Id ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ? . take If Ġ{ Ġcustomer Id Ġ-> Ġis NotBlank Or All ( customer Id ) Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ? . split (",") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ? . also Ġ{ Ġcustomer Ids Ġ-> Ġquery . add Criteria ( Criteria . where (" customer . id "). ` in `( customer Ids )) Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġis NotBlank Or All ( query Value : ĠString ?): ĠBoolean Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn ĠALL _ VALUES Ġ!= Ġquery Value Ġ&& Ġ! StringUtils . isBlank ( query Value ) ĊĠĠĠ Ġ} Ċ Ċ } Ċ