public function shouldConsumeDeletedEvent(BaseObject $object) { $cases = BusinessProcessNotificationTemplate::getCaseTemplatesIds($object); if ($cases) { return true; } return false; }
protected function getMainObject(BaseObject $object) { return $this->aborting ? $object : parent::getMainObject($object); }
public function __construct() { $this->setType(BusinessProcessNotificationPlugin::getBusinessProcessNotificationTemplateTypeCoreValue(BusinessProcessNotificationTemplateType::BPM_ABORT)); parent::__construct(); }
/** * list business-process cases * * @action list * @param KalturaEventNotificationEventObjectType $objectType * @param string $objectId * @return KalturaBusinessProcessCaseArray * * @throws KalturaBusinessProcessNotificationErrors::BUSINESS_PROCESS_CASE_NOT_FOUND * @throws KalturaBusinessProcessNotificationErrors::BUSINESS_PROCESS_SERVER_NOT_FOUND */ public function listAction($objectType, $objectId) { $dbObject = kEventNotificationFlowManager::getObject($objectType, $objectId); if (!$dbObject) { throw new KalturaAPIException(KalturaErrors::OBJECT_NOT_FOUND); } $templatesIds = BusinessProcessNotificationTemplate::getCaseTemplatesIds($dbObject); if (!count($templatesIds)) { throw new KalturaAPIException(KalturaBusinessProcessNotificationErrors::BUSINESS_PROCESS_CASE_NOT_FOUND); } $array = new KalturaBusinessProcessCaseArray(); foreach ($templatesIds as $templateId) { $dbTemplate = EventNotificationTemplatePeer::retrieveByPK($templateId); if (!$dbTemplate || !$dbTemplate instanceof BusinessProcessStartNotificationTemplate) { KalturaLog::info("Template [{$templateId}] not found"); continue; } $caseIds = $dbTemplate->getCaseIds($dbObject, false); if (!count($caseIds)) { KalturaLog::info("No cases found"); continue; } $dbBusinessProcessServer = BusinessProcessServerPeer::retrieveByPK($dbTemplate->getServerId()); if (!$dbBusinessProcessServer) { KalturaLog::info("Business-Process server [" . $dbTemplate->getServerId() . "] not found"); continue; } $businessProcessServer = KalturaBusinessProcessServer::getInstanceByType($dbBusinessProcessServer->getType()); $businessProcessServer->fromObject($dbBusinessProcessServer); $provider = kBusinessProcessProvider::get($businessProcessServer); if (!$provider) { KalturaLog::info("Provider [" . $businessProcessServer->type . "] not found"); continue; } foreach ($caseIds as $caseId) { try { $case = $provider->getCase($caseId); $businessProcessCase = new KalturaBusinessProcessCase(); $businessProcessCase->businessProcessStartNotificationTemplateId = $templateId; $businessProcessCase->fromObject($case); $array[] = $businessProcessCase; } catch (ActivitiClientException $e) { KalturaLog::err("Case [{$caseId}] not found: " . $e->getMessage()); } } } return $array; }