当前位置: 首页>>代码示例>>PHP>>正文


PHP kPluginableEnumsManager::coreToApi方法代码示例

本文整理汇总了PHP中kPluginableEnumsManager::coreToApi方法的典型用法代码示例。如果您正苦于以下问题:PHP kPluginableEnumsManager::coreToApi方法的具体用法?PHP kPluginableEnumsManager::coreToApi怎么用?PHP kPluginableEnumsManager::coreToApi使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在kPluginableEnumsManager的用法示例。


在下文中一共展示了kPluginableEnumsManager::coreToApi方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: cloneAction

 /**
  * Allows you to clone exiting event notification template object and create a new one with similar configuration
  * 
  * @action clone
  * @param int $id source template to clone
  * @param KalturaEventNotificationTemplate $eventNotificationTemplate overwrite configuration object
  * @throws KalturaEventNotificationErrors::EVENT_NOTIFICATION_TEMPLATE_NOT_FOUND
  * @throws KalturaEventNotificationErrors::EVENT_NOTIFICATION_WRONG_TYPE
  * @throws KalturaEventNotificationErrors::EVENT_NOTIFICATION_TEMPLATE_DUPLICATE_SYSTEM_NAME
  * @return KalturaEventNotificationTemplate
  */
 public function cloneAction($id, KalturaEventNotificationTemplate $eventNotificationTemplate = null)
 {
     // get the source object
     $dbEventNotificationTemplate = EventNotificationTemplatePeer::retrieveByPK($id);
     if (!$dbEventNotificationTemplate) {
         throw new KalturaAPIException(KalturaEventNotificationErrors::EVENT_NOTIFICATION_TEMPLATE_NOT_FOUND, $id);
     }
     // copy into new db object
     $newDbEventNotificationTemplate = $dbEventNotificationTemplate->copy();
     // init new Kaltura object
     $newEventNotificationTemplate = KalturaEventNotificationTemplate::getInstanceByType($newDbEventNotificationTemplate->getType());
     $templateClass = get_class($newEventNotificationTemplate);
     if ($eventNotificationTemplate && get_class($eventNotificationTemplate) != $templateClass && !is_subclass_of($eventNotificationTemplate, $templateClass)) {
         throw new KalturaAPIException(KalturaEventNotificationErrors::EVENT_NOTIFICATION_WRONG_TYPE, $id, kPluginableEnumsManager::coreToApi('EventNotificationTemplateType', $dbEventNotificationTemplate->getType()));
     }
     if ($eventNotificationTemplate) {
         // update new db object with the overwrite configuration
         $newDbEventNotificationTemplate = $eventNotificationTemplate->toUpdatableObject($newDbEventNotificationTemplate);
     }
     //Check uniqueness of new object's system name
     $systemNameTemplates = EventNotificationTemplatePeer::retrieveBySystemName($newDbEventNotificationTemplate->getSystemName());
     if (count($systemNameTemplates)) {
         throw new KalturaAPIException(KalturaEventNotificationErrors::EVENT_NOTIFICATION_TEMPLATE_DUPLICATE_SYSTEM_NAME, $newDbEventNotificationTemplate->getSystemName());
     }
     // save the new db object
     $newDbEventNotificationTemplate->setPartnerId($this->getPartnerId());
     $newDbEventNotificationTemplate->save();
     // return the saved object
     $newEventNotificationTemplate = KalturaEventNotificationTemplate::getInstanceByType($newDbEventNotificationTemplate->getType());
     $newEventNotificationTemplate->fromObject($newDbEventNotificationTemplate, $this->getResponseProfile());
     return $newEventNotificationTemplate;
 }
开发者ID:AdiTal,项目名称:server,代码行数:43,代码来源:EventNotificationTemplateService.php

示例2: getData

 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}";
 }
开发者ID:AdiTal,项目名称:server,代码行数:32,代码来源:KalturaHttpNotificationObjectData.php

示例3: getRetryInterval

 public static function getRetryInterval($job_type = null)
 {
     $job_type = kPluginableEnumsManager::coreToApi('BatchJobType', $job_type);
     $job_type = str_replace('.', '_', $job_type);
     // in Zend_Ini . is used to create hierarchy
     $jobCheckAgainTimeouts = kConf::get('job_retry_intervals');
     if (isset($jobCheckAgainTimeouts[$job_type])) {
         return $jobCheckAgainTimeouts[$job_type];
     }
     return kConf::get('default_job_retry_interval');
 }
开发者ID:DBezemer,项目名称:server,代码行数:11,代码来源:BatchJobLockPeer.php

示例4: fromSubType

 /**
  * @param int $subType
  * @return string
  */
 public function fromSubType($subType)
 {
     switch ($subType) {
         case DropFolderType::FTP:
         case DropFolderType::SFTP:
         case DropFolderType::SCP:
         case DropFolderType::S3:
             return $subType;
         default:
             return kPluginableEnumsManager::coreToApi('DropFolderType', $subType);
     }
 }
开发者ID:DBezemer,项目名称:server,代码行数:16,代码来源:KalturaDropFolderContentProcessorJobData.php

示例5: fromSubType

 /**
  * @param int $subType
  * @return string
  */
 public function fromSubType($subType)
 {
     switch ($subType) {
         case StorageProfileProtocol::SFTP:
         case StorageProfileProtocol::FTP:
         case StorageProfileProtocol::SCP:
         case StorageProfileProtocol::S3:
         case StorageProfileProtocol::KALTURA_DC:
             return $subType;
         default:
             return kPluginableEnumsManager::coreToApi('StorageProfileProtocol', $subType);
     }
 }
开发者ID:DBezemer,项目名称:server,代码行数:17,代码来源:KalturaStorageDeleteJobData.php

示例6: addAction

 /**
  * Adds new live stream entry.
  * The entry will be queued for provision.
  * 
  * @action add
  * @param KalturaLiveStreamAdminEntry $liveStreamEntry Live stream entry metadata  
  * @param KalturaSourceType $sourceType  Live stream source type
  * @return KalturaLiveStreamAdminEntry The new live stream entry
  * 
  * @throws KalturaErrors::PROPERTY_VALIDATION_CANNOT_BE_NULL
  */
 function addAction(KalturaLiveStreamAdminEntry $liveStreamEntry, $sourceType = null)
 {
     //TODO: allow sourceType that belongs to LIVE entries only - same for mediaType
     if ($sourceType) {
         $liveStreamEntry->sourceType = $sourceType;
     } else {
         // default sourceType is AKAMAI_LIVE
         $liveStreamEntry->sourceType = kPluginableEnumsManager::coreToApi('EntrySourceType', $this->getPartner()->getDefaultLiveStreamEntrySourceType());
     }
     // if the given password is empty, generate a random 8-character string as the new password
     if ($liveStreamEntry->streamPassword == null || strlen(trim($liveStreamEntry->streamPassword)) <= 0) {
         $tempPassword = sha1(md5(uniqid(rand(), true)));
         $liveStreamEntry->streamPassword = substr($tempPassword, rand(0, strlen($tempPassword) - 8), 8);
     }
     // if no bitrate given, add default
     if (is_null($liveStreamEntry->bitrates) || !$liveStreamEntry->bitrates->count) {
         $liveStreamBitrate = new KalturaLiveStreamBitrate();
         $liveStreamBitrate->bitrate = self::DEFAULT_BITRATE;
         $liveStreamBitrate->width = self::DEFAULT_WIDTH;
         $liveStreamBitrate->height = self::DEFAULT_HEIGHT;
         $liveStreamEntry->bitrates = new KalturaLiveStreamBitrateArray();
         $liveStreamEntry->bitrates[] = $liveStreamBitrate;
     } else {
         $bitrates = new KalturaLiveStreamBitrateArray();
         foreach ($liveStreamEntry->bitrates as $bitrate) {
             if (is_null($bitrate->bitrate)) {
                 $bitrate->bitrate = self::DEFAULT_BITRATE;
             }
             if (is_null($bitrate->width)) {
                 $bitrate->bitrate = self::DEFAULT_WIDTH;
             }
             if (is_null($bitrate->height)) {
                 $bitrate->bitrate = self::DEFAULT_HEIGHT;
             }
             $bitrates[] = $bitrate;
         }
         $liveStreamEntry->bitrates = $bitrates;
     }
     $dbEntry = $this->insertLiveStreamEntry($liveStreamEntry);
     myNotificationMgr::createNotification(kNotificationJobData::NOTIFICATION_TYPE_ENTRY_ADD, $dbEntry, $this->getPartnerId(), null, null, null, $dbEntry->getId());
     $liveStreamEntry->fromObject($dbEntry);
     return $liveStreamEntry;
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:54,代码来源:LiveStreamService.php

示例7: fromObject

 public function fromObject($source_object)
 {
     $reflector = KalturaTypeReflectorCacher::get(get_class($this));
     $properties = $reflector->getProperties();
     if ($reflector->requiresReadPermission() && !kPermissionManager::getReadPermitted(get_class($this), kApiParameterPermissionItem::ALL_VALUES_IDENTIFIER)) {
         return false;
         // current user has no permission for accessing this object class
     }
     foreach ($this->getMapBetweenObjects() as $this_prop => $object_prop) {
         if (is_numeric($this_prop)) {
             $this_prop = $object_prop;
         }
         if (!isset($properties[$this_prop]) || $properties[$this_prop]->isWriteOnly()) {
             continue;
         }
         // ignore property if it requires a read permission which the current user does not have
         if ($properties[$this_prop]->requiresReadPermission() && !kPermissionManager::getReadPermitted($this->getDeclaringClassName($this_prop), $this_prop)) {
             continue;
         }
         $getter_callback = array($source_object, "get{$object_prop}");
         if (is_callable($getter_callback)) {
             $value = call_user_func($getter_callback);
             if ($properties[$this_prop]->isDynamicEnum()) {
                 $propertyType = $properties[$this_prop]->getType();
                 $enumType = call_user_func(array($propertyType, 'getEnumClass'));
                 $value = kPluginableEnumsManager::coreToApi($enumType, $value);
             }
             $this->{$this_prop} = $value;
         } else {
             KalturaLog::alert("getter for property [{$object_prop}] was not found on object class [" . get_class($source_object) . "]");
         }
         if (in_array($this_prop, array("createdAt", "updatedAt"))) {
             $this->{$this_prop} = call_user_func_array($getter_callback, array(null));
             // when passing null to getCreatedAt, timestamp will be returned
         }
     }
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:37,代码来源:KalturaObject.php

示例8: addAction

 /**
  * Adds new live stream entry.
  * The entry will be queued for provision.
  * 
  * @action add
  * @param KalturaLiveStreamEntry $liveStreamEntry Live stream entry metadata  
  * @param KalturaSourceType $sourceType  Live stream source type
  * @return KalturaLiveStreamEntry The new live stream entry
  * 
  * @throws KalturaErrors::PROPERTY_VALIDATION_CANNOT_BE_NULL
  */
 function addAction(KalturaLiveStreamEntry $liveStreamEntry, $sourceType = null)
 {
     if ($sourceType) {
         $liveStreamEntry->sourceType = $sourceType;
     } elseif (is_null($liveStreamEntry->sourceType)) {
         // default sourceType is AKAMAI_LIVE
         $liveStreamEntry->sourceType = kPluginableEnumsManager::coreToApi('EntrySourceType', $this->getPartner()->getDefaultLiveStreamEntrySourceType());
     }
     $dbEntry = $this->prepareEntryForInsert($liveStreamEntry);
     $dbEntry->save();
     $te = new TrackEntry();
     $te->setEntryId($dbEntry->getId());
     $te->setTrackEventTypeId(TrackEntry::TRACK_ENTRY_EVENT_TYPE_ADD_ENTRY);
     $te->setDescription(__METHOD__ . ":" . __LINE__ . "::" . $dbEntry->getSource());
     TrackEntry::addTrackEntry($te);
     //If a jobData can be created for entry sourceType, add provision job. Otherwise, just save the entry.
     $jobData = kProvisionJobData::getInstance($dbEntry->getSource());
     if ($jobData) {
         /* @var $data kProvisionJobData */
         $jobData->populateFromPartner($dbEntry->getPartner());
         $jobData->populateFromEntry($dbEntry);
         kJobsManager::addProvisionProvideJob(null, $dbEntry, $jobData);
     } else {
         $dbEntry->setStatus(entryStatus::READY);
         $dbEntry->save();
         $liveAssets = assetPeer::retrieveByEntryId($dbEntry->getId(), array(assetType::LIVE));
         foreach ($liveAssets as $liveAsset) {
             /* @var $liveAsset liveAsset */
             $liveAsset->setStatus(asset::ASSET_STATUS_READY);
             $liveAsset->save();
         }
     }
     myNotificationMgr::createNotification(kNotificationJobData::NOTIFICATION_TYPE_ENTRY_ADD, $dbEntry, $this->getPartnerId(), null, null, null, $dbEntry->getId());
     $liveStreamEntry->fromObject($dbEntry, $this->getResponseProfile());
     return $liveStreamEntry;
 }
开发者ID:dozernz,项目名称:server,代码行数:47,代码来源:LiveStreamService.php

示例9: setType

 public function setType()
 {
     $this->type = kPluginableEnumsManager::coreToApi("KalturaBulkUploadType", BulkUploadXmlPlugin::getApiValue(BulkUploadXmlType::XML));
 }
开发者ID:DBezemer,项目名称:server,代码行数:4,代码来源:KalturaBulkUploadXmlJobData.php

示例10: fromSubType

 /**
  * @param int $subType
  * @return string
  */
 public function fromSubType($subType)
 {
     return kPluginableEnumsManager::coreToApi('DistributionProviderType', $subType);
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:8,代码来源:KalturaDistributionJobData.php

示例11: toData

 public function toData(BatchJob $dbBatchJob)
 {
     $dbData = null;
     if (is_null($this->jobType)) {
         $this->jobType = kPluginableEnumsManager::coreToApi('BatchJobType', $dbBatchJob->getJobType());
     }
     switch ($dbBatchJob->getJobType()) {
         case KalturaBatchJobType::BULKUPLOAD:
             $dbData = new kBulkUploadJobData();
             if (is_null($this->data)) {
                 $this->data = new KalturaBulkUploadJobData();
             }
             break;
         case KalturaBatchJobType::CONVERT:
             $dbData = new kConvertJobData();
             if (is_null($this->data)) {
                 $this->data = new KalturaConvertJobData();
             }
             break;
         case KalturaBatchJobType::CONVERT_PROFILE:
             $dbData = new kConvertProfileJobData();
             if (is_null($this->data)) {
                 $this->data = new KalturaConvertProfileJobData();
             }
             break;
         case KalturaBatchJobType::EXTRACT_MEDIA:
             $dbData = new kExtractMediaJobData();
             if (is_null($this->data)) {
                 $this->data = new KalturaExtractMediaJobData();
             }
             break;
         case KalturaBatchJobType::IMPORT:
             $dbData = new kImportJobData();
             if (is_null($this->data)) {
                 $this->data = new KalturaImportJobData();
             }
             break;
         case KalturaBatchJobType::POSTCONVERT:
             $dbData = new kPostConvertJobData();
             if (is_null($this->data)) {
                 $this->data = new KalturaPostConvertJobData();
             }
             break;
         case KalturaBatchJobType::MAIL:
             $dbData = new kMailJobData();
             if (is_null($this->data)) {
                 $this->data = new KalturaMailJobData();
             }
             break;
         case KalturaBatchJobType::NOTIFICATION:
             $dbData = new kNotificationJobData();
             if (is_null($this->data)) {
                 $this->data = new KalturaNotificationJobData();
             }
             break;
         case KalturaBatchJobType::BULKDOWNLOAD:
             $dbData = new kBulkDownloadJobData();
             if (is_null($this->data)) {
                 $this->data = new KalturaBulkDownloadJobData();
             }
             break;
         case KalturaBatchJobType::FLATTEN:
             $dbData = new kFlattenJobData();
             if (is_null($this->data)) {
                 $this->data = new KalturaFlattenJobData();
             }
             break;
         case KalturaBatchJobType::PROVISION_PROVIDE:
         case KalturaBatchJobType::PROVISION_DELETE:
             $jobSubType = $dbBatchJob->getJobSubType();
             $dbData = kAkamaiProvisionJobData::getInstance($jobSubType);
             if (is_null($this->data)) {
                 $this->data = KalturaProvisionJobData::getJobDataInstance($jobSubType);
             }
             break;
         case KalturaBatchJobType::CONVERT_COLLECTION:
             $dbData = new kConvertCollectionJobData();
             if (is_null($this->data)) {
                 $this->data = new KalturaConvertCollectionJobData();
             }
             break;
         case KalturaBatchJobType::STORAGE_EXPORT:
             $dbData = new kStorageExportJobData();
             if (is_null($this->data)) {
                 $this->data = new KalturaStorageExportJobData();
             }
             break;
         case KalturaBatchJobType::MOVE_CATEGORY_ENTRIES:
             $dbData = new kMoveCategoryEntriesJobData();
             if (is_null($this->data)) {
                 $this->data = new KalturaMoveCategoryEntriesJobData();
             }
             break;
         case KalturaBatchJobType::STORAGE_DELETE:
             $dbData = new kStorageDeleteJobData();
             if (is_null($this->data)) {
                 $this->data = new KalturaStorageDeleteJobData();
             }
             break;
         case KalturaBatchJobType::CAPTURE_THUMB:
//.........这里部分代码省略.........
开发者ID:DBezemer,项目名称:server,代码行数:101,代码来源:KalturaBatchJob.php

示例12: fromObject

 public function fromObject($entry)
 {
     parent::fromObject($entry);
     $this->mediaDate = $entry->getMediaDate(null);
     $reflect = KalturaTypeReflectorCacher::get('KalturaSourceType');
     $constants = $reflect->getConstantsValues();
     $sourceApi = kPluginableEnumsManager::coreToApi('EntrySourceType', $entry->getSource());
     if (!in_array($sourceApi, $constants) || $sourceApi == EntrySourceType::SEARCH_PROVIDER) {
         $this->sourceType = KalturaSourceType::SEARCH_PROVIDER;
         $this->searchProviderType = $sourceApi;
     } else {
         $this->sourceType = $sourceApi;
         $this->searchProviderType = null;
     }
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:15,代码来源:KalturaMediaEntry.php

示例13: toSourceType

 protected function toSourceType(entry $entry)
 {
     if (!$this->sourceType) {
         $partner = PartnerPeer::retrieveByPK(kCurrentContext::getCurrentPartnerId());
         if ($partner) {
             $this->sourceType = kPluginableEnumsManager::coreToApi('EntrySourceType', $partner->getDefaultLiveStreamEntrySourceType());
         }
     }
     return parent::toSourceType($entry);
 }
开发者ID:DBezemer,项目名称:server,代码行数:10,代码来源:KalturaLiveStreamEntry.php

示例14: setType

 public function setType()
 {
     $this->type = kPluginableEnumsManager::coreToApi("KalturaBulkUploadType", BulkUploadFilterPlugin::getApiValue(BulkUploadFilterType::FILTER));
 }
开发者ID:DBezemer,项目名称:server,代码行数:4,代码来源:KalturaBulkUploadFilterJobData.php

示例15: fromObject

 public function fromObject($object)
 {
     parent::fromObject($object);
     foreach (self::$actions as $action) {
         $actionAttribute = "{$action}Action";
         if (!$this->{$actionAttribute}) {
             $this->{$actionAttribute} = new KalturaGenericDistributionProfileAction();
         }
         $reflector = KalturaTypeReflectorCacher::get(get_class($this->{$actionAttribute}));
         $properties = $reflector->getProperties();
         foreach ($this->{$actionAttribute}->getMapBetweenObjects() as $this_prop => $object_prop) {
             if (is_numeric($this_prop)) {
                 $this_prop = $object_prop;
             }
             if (!isset($properties[$this_prop]) || $properties[$this_prop]->isWriteOnly()) {
                 continue;
             }
             $getter_callback = array($object, "get{$object_prop}");
             if (is_callable($getter_callback)) {
                 $value = call_user_func($getter_callback, $action);
                 if ($properties[$this_prop]->isDynamicEnum()) {
                     $propertyType = $properties[$this_prop]->getType();
                     $enumType = call_user_func(array($propertyType, 'getEnumClass'));
                     $value = kPluginableEnumsManager::coreToApi($enumType, $value);
                 }
                 $this->{$actionAttribute}->{$this_prop} = $value;
             } else {
                 KalturaLog::alert("getter for property [{$object_prop}] was not found on object class [" . get_class($object) . "]");
             }
         }
     }
     $this->updateRequiredEntryFields = implode(',', $object->getUpdateRequiredEntryFields());
     $this->updateRequiredMetadataXPaths = implode(',', $object->getUpdateRequiredMetadataXPaths());
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:34,代码来源:KalturaGenericDistributionProfile.php


注:本文中的kPluginableEnumsManager::coreToApi方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。