public function getData(kHttpNotificationDispatchJobData $jobData = null) { $coreObject = unserialize($this->coreObject); $apiObject = new $this->apiObjectType(); /* @var $apiObject KalturaObject */ $apiObject->fromObject($coreObject); $httpNotificationTemplate = EventNotificationTemplatePeer::retrieveByPK($jobData->getTemplateId()); $notification = new KalturaHttpNotification(); $notification->object = $apiObject; $notification->eventObjectType = kPluginableEnumsManager::coreToApi('EventNotificationEventObjectType', $httpNotificationTemplate->getObjectType()); $notification->eventNotificationJobId = $jobData->getJobId(); $notification->templateId = $httpNotificationTemplate->getId(); $notification->templateName = $httpNotificationTemplate->getName(); $notification->templateSystemName = $httpNotificationTemplate->getSystemName(); $notification->eventType = $httpNotificationTemplate->getEventType(); $data = ''; switch ($this->format) { case KalturaResponseType::RESPONSE_TYPE_XML: $serializer = new KalturaXmlSerializer($this->ignoreNull); $data = '<notification>' . $serializer->serialize($notification) . '</notification>'; break; case KalturaResponseType::RESPONSE_TYPE_PHP: $serializer = new KalturaPhpSerializer($this->ignoreNull); $data = $serializer->serialize($notification); break; case KalturaResponseType::RESPONSE_TYPE_JSON: $serializer = new KalturaJsonSerializer($this->ignoreNull); $data = $serializer->serialize($notification); break; } return "data={$data}"; }
protected function getJobData(kScope $scope = null) { $contentParametersValues = array(); $userParameters = $this->getUserParameters(); foreach ($userParameters as $userParameter) { /* @var $userParameter kEventNotificationParameter */ $value = $userParameter->getValue(); if ($scope && $value instanceof kStringField) { $value->setScope($scope); } $key = $userParameter->getKey(); $contentParametersValues[$key] = $value->getValue(); $scope->addDynamicValue($key, $value); } $contentParameters = $this->getContentParameters(); foreach ($contentParameters as $contentParameter) { /* @var $contentParameter kEventNotificationParameter */ $value = $contentParameter->getValue(); if ($scope && $value instanceof kStringField) { $value->setScope($scope); } $key = $contentParameter->getKey(); $contentParametersValues[$key] = $value->getValue(); $scope->addDynamicValue($key, $value); } $data = $this->getData(); if ($data) { $data->setScope($scope); } $jobData = new kHttpNotificationDispatchJobData(); $jobData->setTemplateId($this->getId()); $jobData->setUrl($this->getUrl()); $jobData->setDataObject($data); $jobData->setMethod($this->getMethod()); $jobData->setTimeout($this->getTimeout()); $jobData->setConnectTimeout($this->getConnectTimeout()); $jobData->setUsername($this->getUsername()); $jobData->setPassword($this->getPassword()); $jobData->setAuthenticationMethod($this->getAuthenticationMethod()); $jobData->setSslVersion($this->getSslVersion()); $jobData->setSslCertificate($this->getSslCertificate()); $jobData->setSslCertificateType($this->getsslCertificateType()); $jobData->setSslCertificatePassword($this->getsslCertificatePassword()); $jobData->setSslEngine($this->getsslEngine()); $jobData->setSslEngineDefault($this->getsslEngineDefault()); $jobData->setSslKeyType($this->getsslKeyType()); $jobData->setSslKey($this->getsslKey()); $jobData->setSslKeyPassword($this->getsslKeyPassword()); $jobData->setCustomHeaders($this->getCustomHeaders()); $jobData->setContentParameters($contentParametersValues); $partner = PartnerPeer::retrieveByPK($this->getPartnerId()); $jobData->setSignSecret($partner->getAdminSecret()); return $jobData; }