protected function WriteToTrackingService($message = "", $modifiedBy = 0, $trackingType = -1) { $trackingService = $this->workflow->GetService("TrackingService"); if ($trackingType < 0) { $trackingType = CBPTrackingType::Custom; } $trackingService->Write($this->GetWorkflowInstanceId(), $trackingType, $this->name, $this->executionStatus, $this->executionResult, $this->IsPropertyExists("Title") ? $this->Title : "", $message, $modifiedBy); }
/** * Returns existing workflow instance by its ID * * @param string $workflowId ID of the workflow instance. * @param bool $silent * @return CBPWorkflow * @throws Exception */ public function GetWorkflow($workflowId, $silent = false) { if (strlen($workflowId) <= 0) { throw new Exception("workflowId"); } if (!$this->isStarted) { $this->StartRuntime(); } if (array_key_exists($workflowId, $this->arWorkflows)) { return $this->arWorkflows[$workflowId]; } $workflow = new CBPWorkflow($workflowId, $this); $persister = CBPWorkflowPersister::GetPersister(); $rootActivity = $persister->LoadWorkflow($workflowId, $silent); if ($rootActivity == null) { throw new Exception("Empty root activity"); } $workflow->Reload($rootActivity); $this->arWorkflows[$workflowId] = $workflow; return $workflow; }