本文整理匯總了PHP中kPluginableEnumsManager::apiToCore方法的典型用法代碼示例。如果您正苦於以下問題:PHP kPluginableEnumsManager::apiToCore方法的具體用法?PHP kPluginableEnumsManager::apiToCore怎麽用?PHP kPluginableEnumsManager::apiToCore使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類kPluginableEnumsManager
的用法示例。
在下文中一共展示了kPluginableEnumsManager::apiToCore方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getExcludeFileSyncMap
function getExcludeFileSyncMap()
{
$result = array();
$dcConfig = kConf::getMap("dc_config");
if (isset($dcConfig['sync_exclude_types'])) {
foreach ($dcConfig['sync_exclude_types'] as $syncExcludeType) {
$configObjectType = $syncExcludeType;
$configObjectSubType = null;
if (strpos($syncExcludeType, ':') > 0) {
list($configObjectType, $configObjectSubType) = explode(':', $syncExcludeType, 2);
}
// translate api dynamic enum, such as contentDistribution.EntryDistribution - {plugin name}.{object name}
if (!is_numeric($configObjectType)) {
$configObjectType = kPluginableEnumsManager::apiToCore('FileSyncObjectType', $configObjectType);
}
// translate api dynamic enum, including the enum type, such as conversionEngineType.mp4box.Mp4box - {enum class name}.{plugin name}.{object name}
if (!is_null($configObjectSubType) && !is_numeric($configObjectSubType)) {
list($enumType, $configObjectSubType) = explode('.', $configObjectSubType);
$configObjectSubType = kPluginableEnumsManager::apiToCore($enumType, $configObjectSubType);
}
if (!isset($result[$configObjectType])) {
$result[$configObjectType] = array();
}
if (!is_null($configObjectSubType)) {
$result[$configObjectType][] = $configObjectSubType;
}
}
}
return $result;
}
示例2: getExclusiveJobs
protected function getExclusiveJobs(KalturaExclusiveLockKey $lockKey, $maxExecutionTime, $numberOfJobs, KalturaBatchJobFilter $filter = null, $jobType, $maxOffset = null)
{
$dbJobType = kPluginableEnumsManager::apiToCore('BatchJobType', $jobType);
if (!is_null($filter)) {
$jobsFilter = $filter->toFilter($dbJobType);
}
return kBatchExclusiveLock::getExclusiveJobs($lockKey->toObject(), $maxExecutionTime, $numberOfJobs, $dbJobType, $jobsFilter, $maxOffset);
}
示例3: dispatchAction
/**
* Dispatch integration task
*
* @action dispatch
* @param KalturaIntegrationJobData $data
* @param KalturaBatchJobObjectType $objectType
* @param string $objectId
* @throws KalturaIntegrationErrors::INTEGRATION_DISPATCH_FAILED
* @return int
*/
public function dispatchAction(KalturaIntegrationJobData $data, $objectType, $objectId)
{
$jobData = $data->toObject();
$coreObjectType = kPluginableEnumsManager::apiToCore('BatchJobObjectType', $objectType);
$job = kIntegrationFlowManager::addintegrationJob($coreObjectType, $objectId, $jobData);
if (!$job) {
throw new KalturaAPIException(KalturaIntegrationErrors::INTEGRATION_DISPATCH_FAILED, $objectType);
}
return $job->getId();
}
示例4: toSubType
/**
* @param string $subType
* @return int
*/
public function toSubType($subType)
{
switch ($subType) {
case KalturaDropFolderType::FTP:
case KalturaDropFolderType::SFTP:
case KalturaDropFolderType::SCP:
case KalturaDropFolderType::S3:
return $subType;
default:
return kPluginableEnumsManager::apiToCore('KalturaDropFolderType', $subType);
}
}
示例5: toSubType
/**
* @param string $subType
* @return int
*/
public function toSubType($subType)
{
switch ($subType) {
case KalturaStorageProfileProtocol::SFTP:
case KalturaStorageProfileProtocol::FTP:
case KalturaStorageProfileProtocol::SCP:
case KalturaStorageProfileProtocol::S3:
case KalturaStorageProfileProtocol::KALTURA_DC:
return $subType;
default:
return kPluginableEnumsManager::apiToCore('KalturaStorageProfileProtocol', $subType);
}
}
示例6: toObject
public function toObject($object = null, $skip = array())
{
if (is_null($object)) {
$object = new GenericDistributionProfile();
}
$object = parent::toObject($object, $skip);
foreach (self::$actions as $action) {
$actionAttribute = "{$action}Action";
if (!$this->{$actionAttribute}) {
continue;
}
$typeReflector = KalturaTypeReflectorCacher::get(get_class($this->{$actionAttribute}));
foreach ($this->{$actionAttribute}->getMapBetweenObjects() as $this_prop => $object_prop) {
if (is_numeric($this_prop)) {
$this_prop = $object_prop;
}
if (in_array($this_prop, $skip)) {
continue;
}
$value = $this->{$actionAttribute}->{$this_prop};
if ($value !== null) {
$propertyInfo = $typeReflector->getProperty($this_prop);
if (!$propertyInfo) {
KalturaLog::alert("property [{$this_prop}] was not found on object class [" . get_class($object) . "]");
} else {
if ($propertyInfo->isDynamicEnum()) {
$propertyType = $propertyInfo->getType();
$enumType = call_user_func(array($propertyType, 'getEnumClass'));
$value = kPluginableEnumsManager::apiToCore($enumType, $value);
}
}
if ($value !== null) {
$setter_callback = array($object, "set{$object_prop}");
if (is_callable($setter_callback)) {
call_user_func_array($setter_callback, array($value, $action));
} else {
KalturaLog::alert("setter for property [{$object_prop}] was not found on object class [" . get_class($object) . "]");
}
}
}
}
}
$object->setUpdateRequiredEntryFields(explode(',', $this->updateRequiredEntryFields));
$object->setUpdateRequiredMetadataXpaths(explode(',', $this->updateRequiredMetadataXPaths));
return $object;
}
示例7: toObject
public function toObject($object_to_fill = null, $props_to_skip = array())
{
$dbFilter = parent::toObject($object_to_fill, $props_to_skip);
$jobTypeAndSubTypeIn = $this->jobTypeAndSubTypeIn;
if (is_null($this->jobTypeAndSubTypeIn)) {
return $dbFilter;
}
$finalTypesAndSubTypes = array();
$arr = explode(BatchJobFilter::JOB_TYPE_AND_SUB_TYPE_MAIN_DELIMITER, $this->jobTypeAndSubTypeIn);
foreach ($arr as $jobTypeIn) {
list($jobType, $jobSubTypes) = explode(BatchJobFilter::JOB_TYPE_AND_SUB_TYPE_TYPE_DELIMITER, $jobTypeIn);
$jobType = kPluginableEnumsManager::apiToCore('BatchJobType', $jobType);
$finalTypesAndSubTypes[] = $jobType . BatchJobFilter::JOB_TYPE_AND_SUB_TYPE_TYPE_DELIMITER . $jobSubTypes;
}
$jobTypeAndSubTypeIn = implode(BatchJobFilter::JOB_TYPE_AND_SUB_TYPE_MAIN_DELIMITER, $finalTypesAndSubTypes);
$dbFilter->set('_in_job_type_and_sub_type', $jobTypeAndSubTypeIn);
return $dbFilter;
}
示例8: purgeAssetFromEdgeCast
private static function purgeAssetFromEdgeCast(asset $asset)
{
// get partner
$partnerId = $asset->getPartnerId();
$partner = PartnerPeer::retrieveByPK($partnerId);
if (!$partner) {
KalturaLog::err('Cannot find partner with id [' . $partnerId . ']');
return false;
}
$mediaType = $asset instanceof thumbAsset ? self::EDGE_SERVICE_HTTP_SMALL_OBJECT_MEDIA_TYPE : self::EDGE_SERVICE_HTTP_LARGE_OBJECT_MEDIA_TYPE;
$mediaTypePathList = array();
try {
$mediaTypePathList[] = array('MediaType' => $mediaType, 'MediaPath' => $asset->getDownloadUrl());
// asset download url
} catch (Exception $e) {
KalturaLog::err('Cannot get asset URL for asset id [' . $asset->getId() . '] - ' . $e->getMessage());
}
if ($asset instanceof flavorAsset) {
// get a list of all URLs leading to the asset for purging
$subPartnerId = $asset->getentry()->getSubpId();
$partnerPath = myPartnerUtils::getUrlForPartner($partnerId, $subPartnerId);
$assetId = $asset->getId();
$serveFlavorUrl = "{$partnerPath}/serveFlavor/entryId/" . $asset->getEntryId() . "/flavorId/{$assetId}" . '*';
// * wildcard should delete all serveFlavor urls
$types = array(kPluginableEnumsManager::apiToCore(EdgeCastDeliveryProfileType::EDGE_CAST_HTTP), kPluginableEnumsManager::apiToCore(EdgeCastDeliveryProfileType::EDGE_CAST_RTMP));
$deliveryProfile = $partner->getDeliveryProfileIds();
$deliveryProfileIds = array();
foreach ($deliveryProfile as $key => $value) {
$deliveryProfileIds = array_merge($deliveryProfileIds, $value);
}
$c = new Criteria();
$c->add(DeliveryProfilePeer::PARTNER_ID, $partnerId);
$c->add(DeliveryProfilePeer::ID, $deliveryProfileIds, Criteria::IN);
$c->addSelectColumn(DeliveryProfilePeer::HOST_NAME);
$stmt = PermissionPeer::doSelectStmt($c);
$hosts = $stmt->fetchAll(PDO::FETCH_COLUMN);
foreach ($hosts as $host) {
if (!empty($host)) {
$mediaTypePathList[] = array('MediaType' => $mediaType, 'MediaPath' => $host . $serveFlavorUrl);
}
}
}
return self::purgeFromEdgeCast($mediaTypePathList, $partner);
}
示例9: addAction
/**
* Add new Distribution Profile
*
* @action add
* @param KalturaDistributionProfile $distributionProfile
* @return KalturaDistributionProfile
* @throws ContentDistributionErrors::DISTRIBUTION_PROVIDER_NOT_FOUND
*/
function addAction(KalturaDistributionProfile $distributionProfile)
{
$distributionProfile->validatePropertyMinLength("name", 1);
$distributionProfile->validatePropertyNotNull("providerType");
if (is_null($distributionProfile->status)) {
$distributionProfile->status = KalturaDistributionProfileStatus::DISABLED;
}
$providerType = kPluginableEnumsManager::apiToCore('DistributionProviderType', $distributionProfile->providerType);
$dbDistributionProfile = DistributionProfilePeer::createDistributionProfile($providerType);
if (!$dbDistributionProfile) {
throw new KalturaAPIException(ContentDistributionErrors::DISTRIBUTION_PROVIDER_NOT_FOUND, $distributionProfile->providerType);
}
$distributionProfile->toInsertableObject($dbDistributionProfile);
$dbDistributionProfile->setPartnerId($this->impersonatedPartnerId);
$dbDistributionProfile->save();
$distributionProfile = KalturaDistributionProfileFactory::createKalturaDistributionProfile($dbDistributionProfile->getProviderType());
$distributionProfile->fromObject($dbDistributionProfile);
return $distributionProfile;
}
開發者ID:EfncoPlugins,項目名稱:Media-Management-based-on-Kaltura,代碼行數:27,代碼來源:DistributionProfileService.php
示例10: shouldConsumeJobStatusEvent
public function shouldConsumeJobStatusEvent(BatchJob $dbBatchJob)
{
$jobTypes = array(ContentDistributionPlugin::getBatchJobTypeCoreValue(ContentDistributionBatchJobType::DISTRIBUTION_SUBMIT), ContentDistributionPlugin::getBatchJobTypeCoreValue(ContentDistributionBatchJobType::DISTRIBUTION_UPDATE));
if (!in_array($dbBatchJob->getJobType(), $jobTypes)) {
// wrong job type
return false;
}
$data = $dbBatchJob->getData();
if (!$data instanceof kDistributionJobData) {
KalturaLog::err('Wrong job data type');
return false;
}
$crossKalturaCoreValueType = kPluginableEnumsManager::apiToCore('DistributionProviderType', CrossKalturaDistributionPlugin::getApiValue(CrossKalturaDistributionProviderType::CROSS_KALTURA));
if ($data->getProviderType() == $crossKalturaCoreValueType) {
return true;
}
// not the right provider
return false;
}
示例11: updatedJob
public function updatedJob(BatchJob $dbBatchJob)
{
$data = $dbBatchJob->getData();
if (!$data instanceof kDistributionJobData) {
return true;
}
$doubleClickCoreValueType = kPluginableEnumsManager::apiToCore('DistributionProviderType', DoubleClickDistributionPlugin::getApiValue(DoubleClickDistributionProviderType::DOUBLECLICK));
if ($data->getProviderType() != $doubleClickCoreValueType) {
return true;
}
if ($dbBatchJob->getStatus() != BatchJob::BATCHJOB_STATUS_PENDING) {
return true;
}
$jobTypesToFinish = array(ContentDistributionPlugin::getBatchJobTypeCoreValue(ContentDistributionBatchJobType::DISTRIBUTION_SUBMIT), ContentDistributionPlugin::getBatchJobTypeCoreValue(ContentDistributionBatchJobType::DISTRIBUTION_UPDATE), ContentDistributionPlugin::getBatchJobTypeCoreValue(ContentDistributionBatchJobType::DISTRIBUTION_DELETE), ContentDistributionPlugin::getBatchJobTypeCoreValue(ContentDistributionBatchJobType::DISTRIBUTION_FETCH_REPORT), ContentDistributionPlugin::getBatchJobTypeCoreValue(ContentDistributionBatchJobType::DISTRIBUTION_ENABLE), ContentDistributionPlugin::getBatchJobTypeCoreValue(ContentDistributionBatchJobType::DISTRIBUTION_DISABLE));
if (in_array($dbBatchJob->getJobType(), $jobTypesToFinish)) {
kJobsManager::updateBatchJob($dbBatchJob, BatchJob::BATCHJOB_STATUS_FINISHED);
}
return true;
}
示例12: updatedJob
public function updatedJob(BatchJob $dbBatchJob, BatchJob $twinJob = null)
{
$data = $dbBatchJob->getData();
if (!$data instanceof kDistributionJobData) {
return true;
}
$attUverseCoreValueType = kPluginableEnumsManager::apiToCore('DistributionProviderType', AttUverseDistributionPlugin::getApiValue(AttUverseDistributionProviderType::ATT_UVERSE));
if ($data->getProviderType() != $attUverseCoreValueType) {
return true;
}
$jobTypesToFinish = array(ContentDistributionPlugin::getBatchJobTypeCoreValue(ContentDistributionBatchJobType::DISTRIBUTION_SUBMIT), ContentDistributionPlugin::getBatchJobTypeCoreValue(ContentDistributionBatchJobType::DISTRIBUTION_UPDATE));
if (in_array($dbBatchJob->getJobType(), $jobTypesToFinish) && $dbBatchJob->getStatus() == BatchJob::BATCHJOB_STATUS_FINISHED) {
return self::onDistributionJobFinished($dbBatchJob, $data, $twinJob);
}
if ($dbBatchJob->getJobType() == ContentDistributionPlugin::getBatchJobTypeCoreValue(ContentDistributionBatchJobType::DISTRIBUTION_DELETE) && $dbBatchJob->getStatus() == BatchJob::BATCHJOB_STATUS_PENDING) {
kJobsManager::updateBatchJob($dbBatchJob, BatchJob::BATCHJOB_STATUS_FINISHED);
}
return true;
}
開發者ID:EfncoPlugins,項目名稱:Media-Management-based-on-Kaltura,代碼行數:19,代碼來源:kAttUverseDistributionEventConsumer.php
示例13: toObject
public function toObject($coreFilter = null, $skip = array())
{
/* @var $coreFilter entryFilter */
if ($this->externalSourceTypeEqual) {
$coreFilter->fields['_like_plugins_data'] = ExternalMediaPlugin::getExternalSourceSearchData($this->externalSourceTypeEqual);
$this->externalSourceTypeEqual = null;
}
if ($this->externalSourceTypeIn) {
$coreExternalSourceTypes = array();
$apiExternalSourceTypes = explode(',', $this->externalSourceTypeIn);
foreach ($apiExternalSourceTypes as $apiExternalSourceType) {
$coreExternalSourceType = kPluginableEnumsManager::apiToCore('ExternalMediaSourceType', $apiExternalSourceType);
$coreExternalSourceTypes[] = ExternalMediaPlugin::getExternalSourceSearchData($coreExternalSourceType);
}
$externalSourceTypeIn = implode(',', $coreExternalSourceTypes);
$coreFilter->fields['_mlikeor_plugins_data'] = $externalSourceTypeIn;
$this->externalSourceTypeIn = null;
}
return parent::toObject($coreFilter, $skip);
}
示例14: loadObject
public static function loadObject($baseClass, $enumValue, array $constructorArgs = null)
{
if (class_exists('Kaltura_Client_Client')) {
return null;
}
if (class_exists('KalturaClient')) {
if ($baseClass == 'KObjectTaskEntryEngineBase' && $enumValue == KalturaObjectTaskType::EXECUTE_METADATA_XSLT) {
return new KObjectTaskExecuteMetadataXsltEngine();
}
} else {
$apiValue = self::getApiValue(ExecuteMetadataXsltObjectTaskType::EXECUTE_METADATA_XSLT);
$executeMetadataXsltObjectTaskCoreValue = kPluginableEnumsManager::apiToCore('ObjectTaskType', $apiValue);
if ($baseClass == 'KalturaObjectTask' && $enumValue == $executeMetadataXsltObjectTaskCoreValue) {
return new KalturaExecuteMetadataXsltObjectTask();
}
if ($baseClass == 'KObjectTaskEntryEngineBase' && $enumValue == $apiValue) {
return new KObjectTaskExecuteMetadataXsltEngine();
}
}
return null;
}
示例15: loadObject
public static function loadObject($baseClass, $enumValue, array $constructorArgs = null)
{
if (class_exists('Kaltura_Client_Client')) {
return null;
}
if (class_exists('KalturaClient')) {
if ($baseClass == 'KObjectTaskEntryEngineBase' && $enumValue == KalturaObjectTaskType::DISTRIBUTE) {
return new KObjectTaskDistributeEngine();
}
} else {
$apiValue = self::getApiValue(DistributeObjectTaskType::DISTRIBUTE);
$distributeObjectTaskCoreValue = kPluginableEnumsManager::apiToCore('ObjectTaskType', $apiValue);
if ($baseClass == 'KalturaObjectTask' && $enumValue == $distributeObjectTaskCoreValue) {
return new KalturaDistributeObjectTask();
}
if ($baseClass == 'KObjectTaskEntryEngineBase' && $enumValue == $apiValue) {
return new KObjectTaskDistributeEngine();
}
}
return null;
}