/** * @param int $providerId * @param int $action * @param PropelPDO $con the connection to use * @return GenericDistributionProviderAction */ public static function retrieveByProviderAndAction($providerId, $action, PropelPDO $con = null) { $criteria = new Criteria(); $criteria->add(GenericDistributionProviderActionPeer::GENERIC_DISTRIBUTION_PROVIDER_ID, $providerId); $criteria->add(GenericDistributionProviderActionPeer::ACTION, $action); return GenericDistributionProviderActionPeer::doSelectOne($criteria, $con); }
public static function loadObject($baseClass, $enumValue, array $constructorArgs = null) { if ($baseClass == 'ISyncableFile' && isset($constructorArgs['objectId'])) { $objectId = $constructorArgs['objectId']; if ($enumValue == self::getContentDistributionFileSyncObjectTypeCoreValue(ContentDistributionFileSyncObjectType::GENERIC_DISTRIBUTION_ACTION)) { GenericDistributionProviderActionPeer::setUseCriteriaFilter(false); $object = GenericDistributionProviderActionPeer::retrieveByPK($objectId); GenericDistributionProviderActionPeer::setUseCriteriaFilter(true); return $object; } if ($enumValue == self::getContentDistributionFileSyncObjectTypeCoreValue(ContentDistributionFileSyncObjectType::ENTRY_DISTRIBUTION)) { EntryDistributionPeer::setUseCriteriaFilter(false); $object = EntryDistributionPeer::retrieveByPK($objectId); EntryDistributionPeer::setUseCriteriaFilter(true); return $object; } if ($enumValue == self::getContentDistributionFileSyncObjectTypeCoreValue(ContentDistributionFileSyncObjectType::DISTRIBUTION_PROFILE)) { DistributionProfilePeer::setUseCriteriaFilter(false); $object = DistributionProfilePeer::retrieveByPK($objectId); DistributionProfilePeer::setUseCriteriaFilter(true); return $object; } } if ($baseClass == 'kJobData') { if ($enumValue == self::getBatchJobTypeCoreValue(ContentDistributionBatchJobType::DISTRIBUTION_SUBMIT)) { return new kDistributionSubmitJobData(); } if ($enumValue == self::getBatchJobTypeCoreValue(ContentDistributionBatchJobType::DISTRIBUTION_UPDATE)) { return new kDistributionUpdateJobData(); } if ($enumValue == self::getBatchJobTypeCoreValue(ContentDistributionBatchJobType::DISTRIBUTION_DELETE)) { return new kDistributionDeleteJobData(); } if ($enumValue == self::getBatchJobTypeCoreValue(ContentDistributionBatchJobType::DISTRIBUTION_FETCH_REPORT)) { return new kDistributionFetchReportJobData(); } if ($enumValue == self::getBatchJobTypeCoreValue(ContentDistributionBatchJobType::DISTRIBUTION_ENABLE)) { return new kDistributionEnableJobData(); } if ($enumValue == self::getBatchJobTypeCoreValue(ContentDistributionBatchJobType::DISTRIBUTION_DISABLE)) { return new kDistributionDisableJobData(); } } if ($baseClass == 'KalturaJobData') { if ($enumValue == self::getApiValue(ContentDistributionBatchJobType::DISTRIBUTION_SUBMIT) || $enumValue == self::getBatchJobTypeCoreValue(ContentDistributionBatchJobType::DISTRIBUTION_SUBMIT)) { return new KalturaDistributionSubmitJobData(); } if ($enumValue == self::getApiValue(ContentDistributionBatchJobType::DISTRIBUTION_UPDATE) || $enumValue == self::getBatchJobTypeCoreValue(ContentDistributionBatchJobType::DISTRIBUTION_UPDATE)) { return new KalturaDistributionUpdateJobData(); } if ($enumValue == self::getApiValue(ContentDistributionBatchJobType::DISTRIBUTION_DELETE) || $enumValue == self::getBatchJobTypeCoreValue(ContentDistributionBatchJobType::DISTRIBUTION_DELETE)) { return new KalturaDistributionDeleteJobData(); } if ($enumValue == self::getApiValue(ContentDistributionBatchJobType::DISTRIBUTION_FETCH_REPORT) || $enumValue == self::getBatchJobTypeCoreValue(ContentDistributionBatchJobType::DISTRIBUTION_FETCH_REPORT)) { return new KalturaDistributionFetchReportJobData(); } if ($enumValue == self::getApiValue(ContentDistributionBatchJobType::DISTRIBUTION_ENABLE) || $enumValue == self::getBatchJobTypeCoreValue(ContentDistributionBatchJobType::DISTRIBUTION_ENABLE)) { return new KalturaDistributionEnableJobData(); } if ($enumValue == self::getApiValue(ContentDistributionBatchJobType::DISTRIBUTION_DISABLE) || $enumValue == self::getBatchJobTypeCoreValue(ContentDistributionBatchJobType::DISTRIBUTION_DISABLE)) { return new KalturaDistributionDisableJobData(); } } return null; }
/** * Retrieve multiple objects by pkey. * * @param array $pks List of primary keys * @param PropelPDO $con the connection to use * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ public static function retrieveByPKs($pks, PropelPDO $con = null) { $objs = null; if (empty($pks)) { $objs = array(); } else { $criteria = new Criteria(GenericDistributionProviderActionPeer::DATABASE_NAME); $criteria->add(GenericDistributionProviderActionPeer::ID, $pks, Criteria::IN); $objs = GenericDistributionProviderActionPeer::doSelect($criteria, $con); } return $objs; }
public function loadProperties(KalturaDistributionJobData $distributionJobData, KalturaGenericDistributionProfile $distributionProfile, $action) { $actionName = self::$actionAttributes[$action]; $genericProviderAction = GenericDistributionProviderActionPeer::retrieveByProviderAndAction($distributionProfile->genericProviderId, $action); if (!$genericProviderAction) { KalturaLog::err("Generic provider [{$distributionProfile->genericProviderId}] action [{$actionName}] not found"); return; } if (!$distributionJobData->entryDistribution) { KalturaLog::err("Entry Distribution object not provided"); return; } if (!$distributionProfile->{$actionName}->protocol) { $distributionProfile->{$actionName}->protocol = $genericProviderAction->getProtocol(); } if (!$distributionProfile->{$actionName}->serverUrl) { $distributionProfile->{$actionName}->serverUrl = $genericProviderAction->getServerAddress(); } if (!$distributionProfile->{$actionName}->serverPath) { $distributionProfile->{$actionName}->serverPath = $genericProviderAction->getRemotePath(); } if (!$distributionProfile->{$actionName}->username) { $distributionProfile->{$actionName}->username = $genericProviderAction->getRemoteUsername(); } if (!$distributionProfile->{$actionName}->password) { $distributionProfile->{$actionName}->password = $genericProviderAction->getRemotePassword(); } if (!$distributionProfile->{$actionName}->ftpPassiveMode) { $distributionProfile->{$actionName}->ftpPassiveMode = $genericProviderAction->getFtpPassiveMode(); } if (!$distributionProfile->{$actionName}->httpFieldName) { $distributionProfile->{$actionName}->httpFieldName = $genericProviderAction->getHttpFieldName(); } if (!$distributionProfile->{$actionName}->httpFileName) { $distributionProfile->{$actionName}->httpFileName = $genericProviderAction->getHttpFileName(); } $entry = entryPeer::retrieveByPKNoFilter($distributionJobData->entryDistribution->entryId); if (!$entry) { KalturaLog::err("Entry [" . $distributionJobData->entryDistribution->entryId . "] not found"); return; } $mrss = kMrssManager::getEntryMrss($entry); if (!$mrss) { KalturaLog::err("MRSS not returned for entry [" . $entry->getId() . "]"); return; } $xml = new KDOMDocument(); if (!$xml->loadXML($mrss)) { KalturaLog::err("MRSS not is not valid XML:\n{$mrss}\n"); return; } $key = $genericProviderAction->getSyncKey(GenericDistributionProviderAction::FILE_SYNC_DISTRIBUTION_PROVIDER_ACTION_MRSS_TRANSFORMER); if (kFileSyncUtils::fileSync_exists($key)) { $xslPath = kFileSyncUtils::getLocalFilePathForKey($key); if ($xslPath) { $xsl = new KDOMDocument(); $xsl->load($xslPath); // set variables in the xsl $varNodes = $xsl->getElementsByTagName('variable'); foreach ($varNodes as $varNode) { $nameAttr = $varNode->attributes->getNamedItem('name'); if (!$nameAttr) { continue; } $name = $nameAttr->value; if ($name && $distributionJobData->{$name}) { $varNode->textContent = $distributionJobData->{$name}; $varNode->appendChild($xsl->createTextNode($distributionJobData->{$name})); } } $proc = new XSLTProcessor(); $proc->registerPHPFunctions(kXml::getXslEnabledPhpFunctions()); $proc->importStyleSheet($xsl); $xml = $proc->transformToDoc($xml); if (!$xml) { KalturaLog::err("Transform returned false"); return; } } } $key = $genericProviderAction->getSyncKey(GenericDistributionProviderAction::FILE_SYNC_DISTRIBUTION_PROVIDER_ACTION_MRSS_VALIDATOR); if (kFileSyncUtils::fileSync_exists($key)) { $xsdPath = kFileSyncUtils::getLocalFilePathForKey($key); if ($xsdPath && !$xml->schemaValidate($xsdPath)) { KalturaLog::err("Inavlid XML:\n" . $xml->saveXML()); KalturaLog::err("Schema [{$xsdPath}]:\n" . file_get_contents($xsdPath)); return; } } $this->xml = $xml->saveXML(); $key = $genericProviderAction->getSyncKey(GenericDistributionProviderAction::FILE_SYNC_DISTRIBUTION_PROVIDER_ACTION_RESULTS_TRANSFORMER); if (kFileSyncUtils::fileSync_exists($key)) { $this->resultParseData = kFileSyncUtils::file_get_contents($key, true, false); } $this->resultParserType = $genericProviderAction->getResultsParser(); }
/** * List all distribution providers * * @action list * @param KalturaGenericDistributionProviderActionFilter $filter * @param KalturaFilterPager $pager * @return KalturaGenericDistributionProviderActionListResponse */ function listAction(KalturaGenericDistributionProviderActionFilter $filter = null, KalturaFilterPager $pager = null) { if (!$filter) { $filter = new KalturaGenericDistributionProviderActionFilter(); } $c = new Criteria(); $genericDistributionProviderActionFilter = new GenericDistributionProviderActionFilter(); $filter->toObject($genericDistributionProviderActionFilter); $genericDistributionProviderActionFilter->attachToCriteria($c); $count = GenericDistributionProviderActionPeer::doCount($c); if ($pager) { $pager->attachToCriteria($c); } $list = GenericDistributionProviderActionPeer::doSelect($c); $response = new KalturaGenericDistributionProviderActionListResponse(); $response->objects = KalturaGenericDistributionProviderActionArray::fromDbArray($list); $response->totalCount = $count; return $response; }
/** * Builds a Criteria object containing the primary key for this object. * * Unlike buildCriteria() this method includes the primary key values regardless * of whether or not they have been modified. * * @return Criteria The Criteria object containing value(s) for primary key(s). */ public function buildPkeyCriteria() { $criteria = new Criteria(GenericDistributionProviderActionPeer::DATABASE_NAME); $criteria->add(GenericDistributionProviderActionPeer::ID, $this->id); if ($this->alreadyInSave && count($this->modifiedColumns) == 2 && $this->isColumnModified(GenericDistributionProviderActionPeer::UPDATED_AT)) { $theModifiedColumn = null; foreach ($this->modifiedColumns as $modifiedColumn) { if ($modifiedColumn != GenericDistributionProviderActionPeer::UPDATED_AT) { $theModifiedColumn = $modifiedColumn; } } $atomicColumns = GenericDistributionProviderActionPeer::getAtomicColumns(); if (in_array($theModifiedColumn, $atomicColumns)) { $criteria->add($theModifiedColumn, $this->getByName($theModifiedColumn, BasePeer::TYPE_COLNAME), Criteria::NOT_EQUAL); } } return $criteria; }
/** * Populates the object using an array. * * This is particularly useful when populating an object from one of the * request arrays (e.g. $_POST). This method goes through the column * names, checking to see whether a matching key exists in populated * array. If so the setByName() method is called for that column. * * You can specify the key type of the array by additionally passing one * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. * The default key type is the column's phpname (e.g. 'AuthorId') * * @param array $arr An array to populate the object from. * @param string $keyType The type of keys the array uses. * @return void */ public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = GenericDistributionProviderActionPeer::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) { $this->setId($arr[$keys[0]]); } if (array_key_exists($keys[1], $arr)) { $this->setCreatedAt($arr[$keys[1]]); } if (array_key_exists($keys[2], $arr)) { $this->setUpdatedAt($arr[$keys[2]]); } if (array_key_exists($keys[3], $arr)) { $this->setPartnerId($arr[$keys[3]]); } if (array_key_exists($keys[4], $arr)) { $this->setGenericDistributionProviderId($arr[$keys[4]]); } if (array_key_exists($keys[5], $arr)) { $this->setAction($arr[$keys[5]]); } if (array_key_exists($keys[6], $arr)) { $this->setStatus($arr[$keys[6]]); } if (array_key_exists($keys[7], $arr)) { $this->setResultsParser($arr[$keys[7]]); } if (array_key_exists($keys[8], $arr)) { $this->setProtocol($arr[$keys[8]]); } if (array_key_exists($keys[9], $arr)) { $this->setServerAddress($arr[$keys[9]]); } if (array_key_exists($keys[10], $arr)) { $this->setRemotePath($arr[$keys[10]]); } if (array_key_exists($keys[11], $arr)) { $this->setRemoteUsername($arr[$keys[11]]); } if (array_key_exists($keys[12], $arr)) { $this->setRemotePassword($arr[$keys[12]]); } if (array_key_exists($keys[13], $arr)) { $this->setEditableFields($arr[$keys[13]]); } if (array_key_exists($keys[14], $arr)) { $this->setMandatoryFields($arr[$keys[14]]); } if (array_key_exists($keys[15], $arr)) { $this->setCustomData($arr[$keys[15]]); } }
public function getReportEnabled() { $provider = $this->getProvider(); if (!$provider) { return DistributionProfileActionStatus::DISABLED; } $action = GenericDistributionProviderActionPeer::retrieveByProviderAndAction($provider->getId(), DistributionAction::FETCH_REPORT); if (!$action) { return DistributionProfileActionStatus::DISABLED; } return parent::getReportEnabled(); }
public function getFieldNameFromPeer($field_name) { $res = GenericDistributionProviderActionPeer::translateFieldName($field_name, $this->field_name_translation_type, BasePeer::TYPE_COLNAME); return $res; }
public function isReportsEnabled() { $action = GenericDistributionProviderActionPeer::retrieveByProviderAndAction($this->getId(), DistributionAction::FETCH_REPORT); return !is_null($action); }