public function UnlockWorkflow(CBPActivity $rootActivity)
 {
     global $DB;
     if ($rootActivity == null) {
         throw new Exception("rootActivity");
     }
     $DB->Query("UPDATE b_bp_instance_state SET " . "\tOWNER_ID = NULL, " . "\tOWNED_UNTIL = NULL " . "WHERE ID = '" . $DB->ForSql($rootActivity->GetWorkflowInstanceId()) . "' " . "\tAND ( " . "\t\t(OWNER_ID = '" . $DB->ForSql($this->serviceInstanceId) . "' " . "\t\t\tAND OWNED_UNTIL >= " . $DB->CurrentTimeFunction() . ") " . "\t\tOR " . "\t\t(OWNER_ID IS NULL) " . "\t\tOR " . "\t\t(OWNER_ID IS NOT NULL " . "\t\t\tAND OWNED_UNTIL < " . $DB->CurrentTimeFunction() . ") " . "\t)");
 }