public function getScope()
 {
     $scope = parent::getScope();
     $scope->setPartnerId($this->dbBatchJob->getPartnerId());
     $scope->setParentRaisedJob($this->dbBatchJob);
     return $scope;
 }
 public function getScope()
 {
     $scope = parent::getScope();
     if (method_exists($this->object, 'getPartnerId')) {
         $scope->setPartnerId($this->object->getPartnerId());
     }
     return $scope;
 }
 public function getScope()
 {
     $scope = parent::getScope();
     if ($this->raisedJob) {
         $scope->setPartnerId($this->raisedJob->getPartnerId());
         $scope->setParentRaisedJob($this->raisedJob);
     } elseif (method_exists($this->object, 'getPartnerId')) {
         $scope->setPartnerId($this->object->getPartnerId());
     }
     return $scope;
 }
 public function shouldConsumeEvent(KalturaEvent $event)
 {
     $this->notificationTemplates = array();
     $scope = $event->getScope();
     if ($scope->getPartnerId() <= 0 || !EventNotificationPlugin::isAllowedPartner($scope->getPartnerId())) {
         return false;
     }
     $eventType = self::getEventType($event);
     $eventObjectClassName = self::getEventObjectType($event);
     $notificationTemplates = self::getNotificationTemplates($eventType, $eventObjectClassName, $scope->getPartnerId());
     if (!count($notificationTemplates)) {
         return false;
     }
     foreach ($notificationTemplates as $notificationTemplate) {
         /* @var $notificationTemplate EventNotificationTemplate */
         $scope->resetDynamicValues();
         $notificationParameters = $notificationTemplate->getContentParameters();
         foreach ($notificationParameters as $notificationParameter) {
             /* @var $notificationParameter kEventNotificationParameter */
             if (!is_null($notificationParameter->getValue())) {
                 $scope->addDynamicValue($notificationParameter->getKey(), $notificationParameter->getValue());
             }
         }
         $notificationParameters = $notificationTemplate->getUserParameters();
         foreach ($notificationParameters as $notificationParameter) {
             /* @var $notificationParameter kEventNotificationParameter */
             if (!is_null($notificationParameter->getValue())) {
                 $scope->addDynamicValue($notificationParameter->getKey(), $notificationParameter->getValue());
             }
         }
         if ($notificationTemplate->fulfilled($scope)) {
             $this->notificationTemplates[] = $notificationTemplate;
         }
     }
     return count($this->notificationTemplates);
 }
 public function shouldConsumeEvent(KalturaEvent $event)
 {
     $this->notificationTemplates = array();
     $scope = $event->getScope();
     if ($scope->getPartnerId() <= 0) {
         return;
     }
     if (!EventNotificationPlugin::isAllowedPartner($scope->getPartnerId())) {
         return;
     }
     $eventType = self::getEventType($event);
     $eventObjectType = self::getEventObjectType($event);
     $notificationTemplates = self::getNotificationTemplates($eventType, $eventObjectType, $scope->getPartnerId());
     if (!count($notificationTemplates)) {
         return false;
     }
     foreach ($notificationTemplates as $notificationTemplate) {
         /* @var $notificationTemplate EventNotificationTemplate */
         if ($this->notificationTemplatesConditionsFulfilled($notificationTemplate, $scope)) {
             $this->notificationTemplates[] = $notificationTemplate;
         }
     }
     return count($this->notificationTemplates);
 }