package Ġio . ac ari . memory . activity Ċ Ċ import Ġio . ac ari . memory . Activity History Schema Ċ import Ġio . ac ari . memory . Current Activity Schema Ċ import Ġio . ac ari . memory . P om od oro History Schema Ċ import Ġio . ac ari . memory . User Schema Ċ import Ġio . ac ari . util . logger For Ċ import Ġio . ac ari . util . to Single Ċ import Ġio . reactivex . Comp letable Ċ import Ġio . vertx . core . Handler Ċ import Ġio . vertx . core . json . JsonObject Ċ import Ġio . vertx . kotlin . core . json . jsonObject Of Ċ import Ġio . vertx . reactivex . core . Vert x Ċ import Ġio . vertx . reactivex . core . event bus . Message Ċ import Ġio . vertx . reactivex . ext . mongo . Mongo Client Ċ Ċ class ĠCompleted P om od oro Listener ( ĊĠ Ġprivate Ġval Ġmongo Client : ĠMongo Client , ĊĠ Ġprivate Ġval Ġvert x : ĠVert x Ċ ) Ġ: ĠHandler < Message < JsonObject >> Ġ{ ĊĠ Ġval Ġlog Ġ= Ġlogger For ( java Class ) ĊĠ Ġoverride Ġfun Ġhandle ( event : ĠMessage < JsonObject >) Ġ{ ĊĠĠĠ Ġevent . body (). to Single () ĊĠĠĠĠĠ Ġ. map Ġ{ Ġit . get JsonObject ( Current Activity Schema . CURRENT ) Ġ} ĊĠĠĠĠĠ Ġ. filter Ġ{ Ġit . get JsonObject ( Activity History Schema . CONTENT ). getString (" name ") Ġ== Ġ" RE COVERY " Ġ} ĊĠĠĠĠĠ Ġ. filter Ġ{ Ġit . get JsonObject ( Activity History Schema . CONTENT ). getBoolean (" auto Start ", Ġfalse ) Ġ} ĊĠĠĠĠĠ Ġ. flatMap Comp letable Ġ{ Ġwrite P om od oro Completion ( event . body ()) Ġ} ĊĠĠĠĠĠ Ġ. subscribe ({ ĊĠĠĠĠĠ Ġ}) Ġ{ ĊĠĠĠĠĠĠĠ Ġlog . error (" Unable Ġto Ġwrite Ġcompleted Ġpom od oro Ġfor Ġevent Ġ${ event . body () }", Ġit ) ĊĠĠĠĠĠ Ġ} ĊĠ Ġ} ĊĊĠ Ġprivate Ġfun Ġwrite P om od oro Completion ( completion Effect : ĠJsonObject ): ĠComp letable Ġ{ ĊĠĠĠ Ġval Ġguid Ġ= Ġcompletion Effect . getString ( User Schema . GLOBAL _ USER _ IDENTIFIER ) ĊĠĠĠ Ġval Ġcompletion Document Ġ= ĠjsonObject Of ( ĊĠĠĠĠĠ ĠP om od oro History Schema . GLOBAL _ USER _ IDENTIFIER Ġto Ġguid , ĊĠĠĠĠĠ ĠP om od oro History Schema . ACTIVITY _ ID Ġto Ġcompletion Effect . get JsonObject ( Current Activity Schema . PREVIOUS ) ĊĠĠĠĠĠĠĠ Ġ. get JsonObject ( Activity History Schema . CONTENT ). getString (" uuid "), ĊĠĠĠĠĠ ĠP om od oro History Schema . TIME _ OF _ AN TE CED ENCE Ġto Ġcompletion Effect . get JsonObject ( Current Activity Schema . CURRENT ) ĊĠĠĠĠĠĠĠ Ġ. map To ( Activity :: class . java ). ante cedence Time ĊĠĠĠ Ġ) ĊĠĠĠ Ġreturn Ġmongo Client ĊĠĠĠĠĠ Ġ. rx Insert ( P om od oro History Schema . COLLECTION , Ġcompletion Document ) ĊĠĠĠĠĠ Ġ. ignore Element () ĊĠ Ġ} Ċ } Ċ