package Ġorg . od k . collect . android . projects Ċ Ċ import Ġorg . od k . collect . android . background work . Form Update Scheduler Ċ import Ġorg . od k . collect . android . background work . Instance Submit Scheduler Ċ import Ġorg . od k . collect . android . utilities . Change Lock Provider Ċ import Ġorg . od k . collect . forms . instances . Instance Ċ import Ġorg . od k . collect . forms . instances . Instances Repository Ċ import Ġorg . od k . collect . projects . Project Ċ import Ġorg . od k . collect . projects . Projects Repository Ċ import Ġjava . io . File Ċ Ċ class ĠProject De leter ( ĊĠĠĠ Ġprivate Ġval Ġprojects Repository : ĠProjects Repository , ĊĠĠĠ Ġprivate Ġval Ġcurrent Project Provider : ĠCurrent Project Provider , ĊĠĠĠ Ġprivate Ġval Ġform Update Scheduler : ĠForm Update Scheduler , ĊĠĠĠ Ġprivate Ġval Ġinstance Submit Scheduler : ĠInstance Submit Scheduler , ĊĠĠĠ Ġprivate Ġval Ġinstances Repository : ĠInstances Repository , ĊĠĠĠ Ġprivate Ġval Ġproject DirPath : ĠString , ĊĠĠĠ Ġprivate Ġval Ġchange Lock Provider : ĠChange Lock Provider Ċ ) Ġ{ ĊĠĠĠ Ġfun Ġdelete Current Project (): ĠDelete Project Result Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġwhen Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġun sent Instances Detected () Ġ-> ĠDelete Project Result . Un sent Instances ĊĠĠĠĠĠĠĠĠĠĠĠ Ġrunning Background Jobs Detected () Ġ-> ĠDelete Project Result . Running Background Jobs ĊĠĠĠĠĠĠĠĠĠĠĠ Ġelse Ġ-> Ġperform Project Deletion () ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġun sent Instances Detected (): ĠBoolean Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġinstances Repository . getAll By Status ( ĊĠĠĠĠĠĠĠĠĠĠĠ ĠInstance . STATUS _ IN COMPLETE , ĊĠĠĠĠĠĠĠĠĠĠĠ ĠInstance . STATUS _ COMPLETE , ĊĠĠĠĠĠĠĠĠĠĠĠ ĠInstance . STATUS _ SUB MISSION _ FAILED ĊĠĠĠĠĠĠĠ Ġ). isNotEmpty () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġrunning Background Jobs Detected (): ĠBoolean Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġacquired Form Lock Ġ= Ġchange Lock Provider . get Form Lock ( current Project Provider . getCurrent Project (). uuid ). with Lock Ġ{ Ġacquired Lock Ġ-> ĊĠĠĠĠĠĠĠĠĠĠĠ Ġacquired Lock ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġval Ġacquired Instance Lock Ġ= Ġchange Lock Provider . getInstance Lock ( current Project Provider . getCurrent Project (). uuid ). with Lock Ġ{ Ġacquired Lock Ġ-> ĊĠĠĠĠĠĠĠĠĠĠĠ Ġacquired Lock ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġreturn Ġ! acquire d Form Lock Ġ|| Ġ! acquire d Instance Lock ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġperform Project Deletion (): ĠDelete Project Result Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġcurrent Project Ġ= Ġcurrent Project Provider . getCurrent Project () ĊĊĠĠĠĠĠĠĠ Ġform Update Scheduler . cancel Updates ( current Project . uuid ) ĊĠĠĠĠĠĠĠ Ġinstance Submit Scheduler . cancel Submit ( current Project . uuid ) ĊĊĠĠĠĠĠĠĠ Ġprojects Repository . delete ( current Project . uuid ) ĊĊĠĠĠĠĠĠĠ ĠFile ( project DirPath ). delete Re cursively () ĊĊĠĠĠĠĠĠĠ Ġreturn Ġif Ġ( projects Repository . getAll (). isNotEmpty ()) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġnew Project Ġ= Ġprojects Repository . getAll ()[ 0 ] ĊĠĠĠĠĠĠĠĠĠĠĠ Ġcurrent Project Provider . setCurrent Project ( new Project . uuid ) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠDelete Project Result . Deleted Successfully ( new Project ) ĊĠĠĠĠĠĠĠ Ġ} Ġelse Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠDelete Project Result . Deleted Successfully ( null ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} Ċ } Ċ Ċ sealed Ġclass ĠDelete Project Result Ġ{ ĊĠĠĠ Ġobject ĠUn sent Instances Ġ: ĠDelete Project Result () ĊĊĠĠĠ Ġobject ĠRunning Background Jobs Ġ: ĠDelete Project Result () ĊĊĠĠĠ Ġdata Ġclass ĠDeleted Successfully ( val Ġnew Current Project : ĠProject . Saved ?) Ġ: ĠDelete Project Result () Ċ } Ċ