package Ġde . r ki . cor on aw arn app . dat ad on ation . analytics . modules . ex posure windows Ċ Ċ import Ġandroid . content . Context Ċ import Ġandroidx . room . Dao Ċ import Ġandroidx . room . Database Ċ import Ġandroidx . room . Delete Ċ import Ġandroidx . room . Embedded Ċ import Ġandroidx . room . Entity Ċ import Ġandroidx . room . ForeignKey Ċ import Ġandroidx . room . Insert Ċ import Ġandroidx . room . On Conflict Strategy Ċ import Ġandroidx . room . PrimaryKey Ċ import Ġandroidx . room . Query Ċ import Ġandroidx . room . Relation Ċ import Ġandroidx . room . Room Ċ import Ġandroidx . room . Room Database Ċ import Ġandroidx . room . Transaction Ċ import Ġde . r ki . cor on aw arn app . util . di . AppContext Ċ import Ġjavax . inject . Inject Ċ Ċ @ Database ( ĊĠĠĠ Ġentities Ġ= Ġ[ ĊĠĠĠĠĠĠĠ ĠAnalytics Exposure Window Entity :: class , ĊĠĠĠĠĠĠĠ ĠAnalytics Scan Instance Entity :: class , ĊĠĠĠĠĠĠĠ ĠAnalytics Reported Exposure Window Entity :: class ĊĠĠĠ Ġ], ĊĠĠĠ Ġversion Ġ= Ġ 1 Ċ ) Ċ abstract Ġclass ĠAnalytics Exposure Window Database Ġ: ĠRoom Database () Ġ{ ĊĠĠĠ Ġabstract Ġfun Ġanalytics Exposure Window Dao (): ĠAnalytics Exposure Window Dao ĊĊĠĠĠ Ġclass ĠFactory Ġ@ Inject Ġconstructor (@ AppContext Ġprivate Ġval Ġcontext : ĠContext ) Ġ{ ĊĠĠĠĠĠĠĠ Ġfun Ġcreate (): ĠAnalytics Exposure Window Database Ġ= ĠRoom ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. database Builder ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġcontext , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠAnalytics Exposure Window Database :: class . java , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" Analytics Exposure Window - db " ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. fallback To Dest ruct ive Migration () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. build () ĊĠĠĠ Ġ} Ċ } Ċ Ċ @ Dao Ċ interface ĠAnalytics Exposure Window Dao Ġ{ ĊĠĠĠ Ġ@ Transaction ĊĠĠĠ Ġ@ Query (" SELECT Ġ* ĠFROM ĠAnalytics Exposure Window Entity ") ĊĠĠĠ Ġsuspend Ġfun ĠgetAll New (): ĠList < Analytics Exposure Window Entity Wrapper > ĊĊĠĠĠ Ġ@ Query (" SELECT Ġ* ĠFROM ĠAnalytics Exposure Window Entity ĠWHERE Ġsha 2 5 6 Hash ĠLIKE Ġ: sha 2 5 6 Hash ") ĊĠĠĠ Ġsuspend Ġfun Ġget New ( sha 2 5 6 Hash : ĠString ): ĠAnalytics Exposure Window Entity ? ĊĊĠĠĠ Ġ@ Query (" SELECT Ġ* ĠFROM ĠAnalytics Reported Exposure Window Entity ĠWHERE Ġsha 2 5 6 Hash ĠLIKE Ġ: sha 2 5 6 Hash ") ĊĠĠĠ Ġsuspend Ġfun Ġget Reported ( sha 2 5 6 Hash : ĠString ): ĠAnalytics Reported Exposure Window Entity ? ĊĊĠĠĠ Ġ@ Query (" SELECT Ġ* ĠFROM ĠAnalytics Reported Exposure Window Entity ") ĊĠĠĠ Ġsuspend Ġfun ĠgetAll Reported (): ĠList < Analytics Reported Exposure Window Entity > ĊĊĠĠĠ Ġ@ Delete ĊĠĠĠ Ġsuspend Ġfun Ġdelete Exposure Windows ( entities : ĠList < Analytics Exposure Window Entity >) ĊĊĠĠĠ Ġ@ Delete ĊĠĠĠ Ġsuspend Ġfun Ġdelete Scan Instances ( entities : ĠList < Analytics Scan Instance Entity >) ĊĊĠĠĠ Ġ@ Delete ĊĠĠĠ Ġsuspend Ġfun Ġdelete Reported ( entities : ĠList < Analytics Reported Exposure Window Entity >) ĊĊĠĠĠ Ġ@ Insert ( on Conflict Ġ= ĠOn Conflict Strategy . IGNORE ) ĊĠĠĠ Ġsuspend Ġfun Ġinsert Exposure Windows ( entities : ĠList < Analytics Exposure Window Entity >): ĠList < Long > ĊĊĠĠĠ Ġ@ Insert ( on Conflict Ġ= ĠOn Conflict Strategy . IGNORE ) ĊĠĠĠ Ġsuspend Ġfun Ġinsert Scan Instances ( entity : ĠList < Analytics Scan Instance Entity >): ĠList < Long > ĊĊĠĠĠ Ġ@ Insert ( on Conflict Ġ= ĠOn Conflict Strategy . IGNORE ) ĊĠĠĠ Ġsuspend Ġfun Ġinsert Reported ( entities : ĠList < Analytics Reported Exposure Window Entity >): ĠList < Long > ĊĊĠĠĠ Ġ@ Transaction ĊĠĠĠ Ġsuspend Ġfun Ġinsert ( wrappers : ĠList < Analytics Exposure Window Entity Wrapper >) Ġ{ ĊĠĠĠĠĠĠĠ Ġinsert Exposure Windows ( wrappers . map Ġ{ Ġit . ex posure Window Entity Ġ}) ĊĠĠĠĠĠĠĠ Ġinsert Scan Instances ( wrappers . flatMap Ġ{ Ġit . scan Instance Entities Ġ}) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Transaction ĊĠĠĠ Ġsuspend Ġfun Ġmove To Reported ( ĊĠĠĠĠĠĠĠ Ġentities : ĠList < Analytics Exposure Window Entity Wrapper >, ĊĠĠĠĠĠĠĠ Ġtimestamp : ĠLong ĊĠĠĠ Ġ): ĠList < Analytics Reported Exposure Window Entity > Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġreported Ġ= Ġentities . map Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠAnalytics Reported Exposure Window Entity ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġit . ex posure Window Entity . sha 2 5 6 Hash , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġtimestamp ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġdelete Exposure Windows ( entities . map Ġ{ Ġit . ex posure Window Entity Ġ}) ĊĠĠĠĠĠĠĠ Ġdelete Scan Instances ( entities . flatMap Ġ{ Ġit . scan Instance Entities Ġ}) ĊĠĠĠĠĠĠĠ Ġinsert Reported ( reported ) ĊĠĠĠĠĠĠĠ Ġreturn Ġreported ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Transaction ĊĠĠĠ Ġsuspend Ġfun Ġrollback ( ĊĠĠĠĠĠĠĠ Ġwrappers : ĠList < Analytics Exposure Window Entity Wrapper >, ĊĠĠĠĠĠĠĠ Ġreported : ĠList < Analytics Reported Exposure Window Entity > ĊĠĠĠ Ġ) Ġ{ ĊĠĠĠĠĠĠĠ Ġdelete Reported ( reported ) ĊĠĠĠĠĠĠĠ Ġinsert Exposure Windows ( wrappers . map Ġ{ Ġit . ex posure Window Entity Ġ}) ĊĠĠĠĠĠĠĠ Ġinsert Scan Instances ( wrappers . flatMap Ġ{ Ġit . scan Instance Entities Ġ}) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Query (" DELETE ĠFROM ĠAnalytics Reported Exposure Window Entity ĠWHERE Ġtimestamp Ġ< Ġ: timestamp ") ĊĠĠĠ Ġsuspend Ġfun Ġdelete Reported Ol der Than ( timestamp : ĠLong ) Ċ } Ċ Ċ class ĠAnalytics Exposure Window Entity Wrapper ( ĊĠĠĠ Ġ@ Embedded Ġval Ġexposure Window Entity : ĠAnalytics Exposure Window Entity , ĊĠĠĠ Ġ@ Relation ( parent Column Ġ= ĠP ARENT _ COLUMN , Ġentity Column Ġ= ĠCH ILD _ COLUMN ) ĊĠĠĠ Ġval Ġscan Instance Entities : ĠList < Analytics Scan Instance Entity > Ċ ) Ċ Ċ @ Entity Ċ data Ġclass ĠAnalytics Exposure Window Entity ( ĊĠĠĠ Ġ@ PrimaryKey ( auto Generate Ġ= Ġfalse ) Ġval Ġsha 2 5 6 Hash : ĠString , ĊĠĠĠ Ġval Ġcalibration Confidence : ĠInt , ĊĠĠĠ Ġval Ġdate Millis : ĠLong , ĊĠĠĠ Ġval Ġinf ect ious ness : ĠInt , ĊĠĠĠ Ġval Ġreport Type : ĠInt , ĊĠĠĠ Ġval Ġnormalized Time : ĠDouble , ĊĠĠĠ Ġval Ġtransmission Risk Level : ĠInt Ċ ) Ċ Ċ @ Entity Ċ data Ġclass ĠAnalytics Scan Instance Entity ( ĊĠĠĠ Ġ@ PrimaryKey ( auto Generate Ġ= Ġtrue ) Ġval Ġid : ĠLong ? Ġ= Ġnull , ĊĠĠĠ Ġ@ ForeignKey ( ĊĠĠĠĠĠĠĠ Ġentity Ġ= ĠAnalytics Exposure Window Entity :: class , ĊĠĠĠĠĠĠĠ Ġparent Columns Ġ= Ġ[ PARENT _ COLUMN ], ĊĠĠĠĠĠĠĠ Ġchild Columns Ġ= Ġ[ CHILD _ COLUMN ], ĊĠĠĠĠĠĠĠ ĠonDelete Ġ= ĠForeign Key . CASCADE , ĊĠĠĠĠĠĠĠ Ġdeferred Ġ= Ġtrue ĊĠĠĠ Ġ) ĊĠĠĠ Ġval Ġfk Sha 2 5 6 Hash : ĠString , ĊĠĠĠ Ġval Ġmin Att enuation : ĠInt , ĊĠĠĠ Ġval Ġtypical Att enuation : ĠInt , ĊĠĠĠ Ġval Ġseconds Since Last Scan : ĠInt Ċ ) Ċ Ċ @ Entity Ċ data Ġclass ĠAnalytics Reported Exposure Window Entity ( ĊĠĠĠ Ġ@ PrimaryKey ( auto Generate Ġ= Ġfalse ) Ġval Ġsha 2 5 6 Hash : ĠString , ĊĠĠĠ Ġval Ġtimestamp : ĠLong Ċ ) Ċ Ċ private Ġconst Ġval ĠP ARENT _ COLUMN Ġ= Ġ" sha 2 5 6 Hash " Ċ private Ġconst Ġval ĠCH ILD _ COLUMN Ġ= Ġ" fk Sha 2 5 6 Hash " Ċ