package Ġcom . example . alex me ln ik ov . coin space . model . repositories Ċ Ċ import Ġandroid . util . Log Ċ import Ġcom . example . alex me ln ik ov . coin space . model . entities . De fer Operation Ċ import Ġcom . example . alex me ln ik ov . coin space . model . pers istance . dao . De fer Operations Dao Ċ import Ġio . reactivex . Comp letable Ċ import Ġio . reactivex . Single Ċ import Ġio . reactivex . android . schedul ers . Android Schedulers Ċ import Ġio . reactivex . schedul ers . Schedulers Ċ Ċ class ĠI De fer Operations Repository Repository ( private Ġval Ġdefer Operations Dao : ĠDe fer Operations Dao ) Ġ: ĊĠĠĠ ĠI De fer Operations Repository Ġ{ ĊĠĠĠ Ġval ĠTAG Ġ= Ġ" De fer Operations Rep " ĊĊĊĠĠĠ Ġoverride Ġfun Ġget Operations By Day ( day : ĠInt , Ġmonth : ĠInt , Ġyear : ĠInt ): ĠSingle < List < De fer Operation >> Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn ĠSingle . create < List < De fer Operation >> Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġit . on Success ( defer Operations Dao . getBy Date ( day , Ġmonth , Ġyear )) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġremove Operations By AccountId ( accountId : ĠLong ) Ġ{ ĊĠĠĠĠĠĠĠ ĠComp letable . from Action Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġdefer Operations Dao . delete By AccountId ( accountId ) ĊĠĠĠĠĠĠĠ Ġ}. subscribe On ( Schedulers . io ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. observe On ( Android Schedulers . main Thread ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. subscribe ({ ĠLog . d ( TAG , Ġ" ad remove Operation By AccountId Ġsuccess ") Ġ}, ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ{ ĠLog . d ( TAG , Ġ" remove Operations By AccountId Ġerror !") Ġ}) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġadd New Operation ( defer Operation : ĠDe fer Operation ) Ġ{ ĊĠĠĠĠĠĠĠ ĠComp letable . from Action Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġdefer Operations Dao . insert ( defer Operation ) ĊĠĠĠĠĠĠĠ Ġ}. subscribe On ( Schedulers . io ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. observe On ( Android Schedulers . main Thread ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. subscribe ({ ĠLog . d ( TAG , Ġ" add New Operation Ġsuccess ") Ġ}, ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ{ ĠLog . d ( TAG , Ġ" add New Operation Ġerror !") Ġ}) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġremove Operation ( defer Operation : ĠDe fer Operation ) Ġ{ ĊĠĠĠĠĠĠĠ ĠComp letable . from Action Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġdefer Operations Dao . delete ById ( defer Operation . id !! ) ĊĠĠĠĠĠĠĠ Ġ}. subscribe On ( Schedulers . io ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. observe On ( Android Schedulers . main Thread ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. subscribe ({ ĠLog . d ( TAG , Ġ" remove Operation Ġsuccess ") Ġ}, ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ{ ĠLog . d ( TAG , Ġ" remove Operation Ġerror !") Ġ}) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġremove All Operation () Ġ{ ĊĠĠĠĠĠĠĠ ĠComp letable . from Action Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġdefer Operations Dao . delete All () ĊĠĠĠĠĠĠĠ Ġ}. subscribe On ( Schedulers . io ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. observe On ( Android Schedulers . main Thread ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. subscribe ({ ĠLog . d ( TAG , Ġ" removeAll Operation Ġsuccess ") Ġ}, ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ{ ĠLog . d ( TAG , Ġ" removeAll Operation Ġerror !") Ġ}) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun ĠgetAll Operations (): ĠSingle < List < De fer Operation >> Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn ĠSingle . create < List < De fer Operation >> Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġit . on Success ( defer Operations Dao . getAll ()) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġget Operation ById ( id : ĠLong ): ĠSingle < De fer Operation > Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn ĠSingle . create < De fer Operation > Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġit . on Success ( defer Operations Dao . getById ( id )) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} Ċ Ċ }