package Ġcom . cyber log ite c . fre ight 9 . lib . data Ċ Ċ import Ġcom . cyber log ite c . fre ight 9 . lib . db . Inventory Dao Ċ import Ġcom . cyber log ite c . fre ight 9 . lib . model . Inventory Ċ import Ġio . reactivex . Single Ċ import Ġio . reactivex . android . schedul ers . Android Schedulers Ċ import Ġio . reactivex . schedul ers . Schedulers Ċ Ċ class ĠInventory Repository ( val Ġinventory Dao : ĠInventory Dao ): ĠInventory Repository Type Ġ{ ĊĊĠĠĠ Ġoverride Ġfun Ġupsert Inventory ( inventory : ĠInventory ) Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ Ġinventory Dao . upsert Inventory ( inventory ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. subscribe On ( Schedulers . io ()) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. observe On ( Android Schedulers . main Thread ()) ĊĊĠĠĠ Ġoverride Ġfun Ġupsert Invent ories ( sof Invent ories : ĠList < Inventory >) Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ Ġinventory Dao . upsert Invent ories ( sof Invent ories ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. subscribe On ( Schedulers . io ()) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. observe On ( Android Schedulers . main Thread ()) ĊĊĠĠĠ Ġoverride Ġfun Ġget Invent ories (): ĠSingle < List < Inventory >> Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ Ġinventory Dao . getIn vent ories () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. subscribe On ( Schedulers . io ()) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. observe On ( Android Schedulers . main Thread ()) ĊĊĠĠĠ Ġoverride Ġfun Ġget Inventory ( inventory Number : ĠString ): ĠSingle < Inventory > Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ Ġinventory Dao . get Inventory ( inventory Number ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. subscribe On ( Schedulers . io ()) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. observe On ( Android Schedulers . main Thread ()) ĊĊĠĠĠ Ġoverride Ġfun Ġget Inventory With ( master Contract Number : ĠString ): ĠSingle < Inventory > Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ Ġinventory Dao . get Inventory With ( master Contract Number ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. subscribe On ( Schedulers . io ()) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. observe On ( Android Schedulers . main Thread ()) ĊĊĠĠĠ Ġoverride Ġfun Ġdelete ( inventory : ĠInventory ) Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ Ġinventory Dao . delete ( inventory ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. subscribe On ( Schedulers . io ()) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. observe On ( Android Schedulers . main Thread ()) ĊĊĠĠĠ Ġoverride Ġfun Ġdelete All () Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ Ġinventory Dao . delete All () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. subscribe On ( Schedulers . io ()) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. observe On ( Android Schedulers . main Thread ()) Ċ Ċ }