Пример #1
0
 public function initService($serviceId, $serviceName, $actionName)
 {
     parent::initService($serviceId, $serviceName, $actionName);
     myPartnerUtils::addPartnerToCriteria(new UserRolePeer(), $this->getPartnerId(), $this->private_partner_data, $this->partnerGroup());
     myPartnerUtils::addPartnerToCriteria(new PermissionPeer(), $this->getPartnerId(), $this->private_partner_data, $this->partnerGroup());
     myPartnerUtils::addPartnerToCriteria(new PermissionItemPeer(), $this->getPartnerId(), $this->private_partner_data, $this->partnerGroup());
 }
 public function initService($serviceId, $serviceName, $actionName)
 {
     parent::initService($serviceId, $serviceName, $actionName);
     myPartnerUtils::addPartnerToCriteria(new GenericDistributionProviderActionPeer(), $this->getPartnerId(), $this->private_partner_data, $this->partnerGroup());
     if (!ContentDistributionPlugin::isAllowedPartner(kCurrentContext::$master_partner_id)) {
         throw new KalturaAPIException(KalturaErrors::SERVICE_FORBIDDEN, $this->serviceName . '->' . $this->actionName);
     }
 }
 public function initService($serviceId, $serviceName, $actionName)
 {
     parent::initService($serviceId, $serviceName, $actionName);
     if ($actionName != 'goto') {
         myPartnerUtils::addPartnerToCriteria(new ShortLinkPeer(), $this->getPartnerId(), $this->private_partner_data, $this->partnerGroup());
         myPartnerUtils::addPartnerToCriteria(new kuserPeer(), $this->getPartnerId(), $this->private_partner_data, $this->partnerGroup());
     }
 }
 public function initService($serviceId, $serviceName, $actionName)
 {
     parent::initService($serviceId, $serviceName, $actionName);
     if (!DropFolderPlugin::isAllowedPartner($this->getPartnerId())) {
         throw new KalturaAPIException(KalturaErrors::SERVICE_FORBIDDEN, $this->serviceName . '->' . $this->actionName);
     }
     myPartnerUtils::addPartnerToCriteria(new DropFolderPeer(), $this->getPartnerId(), $this->private_partner_data, $this->partnerGroup());
     myPartnerUtils::addPartnerToCriteria(new DropFolderFilePeer(), $this->getPartnerId(), $this->private_partner_data, $this->partnerGroup());
 }
 public function initService($serviceId, $serviceName, $actionName)
 {
     parent::initService($serviceId, $serviceName, $actionName);
     if ($this->getPartnerId() != Partner::ADMIN_CONSOLE_PARTNER_ID) {
         myPartnerUtils::addPartnerToCriteria(new GenericDistributionProviderPeer(), $this->getPartnerId(), $this->private_partner_data, $this->partnerGroup());
     }
     if (!ContentDistributionPlugin::isAllowedPartner($this->getPartnerId())) {
         throw new KalturaAPIException(KalturaErrors::SERVICE_FORBIDDEN, $this->serviceName . '->' . $this->actionName);
     }
 }
 public function validateForUsage($sourceObject, $propertiesToSkip = array())
 {
     parent::validateForUsage($sourceObject, $propertiesToSkip);
     $this->validatePropertyNotNull('eventNotificationTemplateId');
     myPartnerUtils::addPartnerToCriteria('EventNotificationTemplate', kCurrentContext::getCurrentPartnerId(), true);
     $eventNotificationTemplate = EventNotificationTemplatePeer::retrieveByPK($this->eventNotificationTemplateId);
     if (is_null($eventNotificationTemplate)) {
         throw new KalturaAPIException(KalturaEventNotificationErrors::EVENT_NOTIFICATION_TEMPLATE_NOT_FOUND, $this->eventNotificationTemplateId);
     }
 }
 public function initService($serviceId, $serviceName, $actionName)
 {
     parent::initService($serviceId, $serviceName, $actionName);
     $partnerId = $this->getPartnerId();
     if (!EventNotificationPlugin::isAllowedPartner($partnerId)) {
         throw new KalturaAPIException(KalturaErrors::SERVICE_FORBIDDEN, "{$this->serviceName}->{$this->actionName}");
     }
     if ($partnerId != Partner::ADMIN_CONSOLE_PARTNER_ID && $partnerId != Partner::BATCH_PARTNER_ID) {
         myPartnerUtils::addPartnerToCriteria(new EventNotificationTemplatePeer(), $partnerId, $this->private_partner_data, $this->partnerGroup());
     }
 }
 public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser, $create_cachekey = false)
 {
     myDbHelper::$use_alternative_con = myDbHelper::DB_HELPER_CONN_PROPEL3;
     // TODO -  verify permissions for viewing lists
     $detailed = $this->getP("detailed", false);
     $limit = $this->getP("page_size", 10);
     $limit = $this->maxPageSize($limit);
     $page = $this->getP("page", 1);
     $user_filter_prefix = $this->getP("fp", "filter");
     $offset = ($page - 1) * $limit;
     // TODO - should limit search to partner ??
     //		kuserPeer::setUseCriteriaFilter( false );
     //		entryPeer::setUseCriteriaFilter( false );
     $playlist_id = $this->getPM("playlist_id");
     $input_params = $this->getInputParams();
     $extra_filters = array();
     for ($i = 1; $i < self::MAX_FILTER_COUNT; $i++) {
         // filter
         $extra_filter = new entryFilter();
         $fields_set = $extra_filter->fillObjectFromRequest($input_params, "{$user_filter_prefix}{$i}_", null);
         if ($fields_set) {
             $extra_filters[$i] = $extra_filter;
         }
     }
     // this service is executed twice! (first time for the cache key, second time for the execution)
     if (is_null($this->playlist)) {
         $playlist = entryPeer::retrieveByPK($playlist_id);
         if (!$playlist) {
             throw new APIException(APIErrors::INVALID_ENTRY_ID, "Playlist", $playlist_id);
         }
         myPartnerUtils::addPartnerToCriteria(new accessControlPeer(), $playlist->getPartnerId(), $this->getPrivatePartnerData(), $this->partnerGroup2(), null);
         $this->playlist = $playlist;
     }
     if ($create_cachekey) {
         if ($this->isAdmin()) {
             return null;
         }
         $cache_key_arr = array("playlist_id" => $playlist_id, "filters" => $extra_filters);
         $cahce_key = new executionCacheKey();
         $cahce_key->expiry = 600;
         $cahce_key->key = md5(print_r($cache_key_arr, true));
         return $cahce_key;
     }
     if ($this->isAdmin()) {
         myPlaylistUtils::setIsAdminKs(true);
     }
     $entry_list = myPlaylistUtils::executePlaylistById($partner_id, $playlist_id, $extra_filters, $detailed);
     myEntryUtils::updatePuserIdsForEntries($entry_list);
     $level = $detailed ? objectWrapperBase::DETAIL_LEVEL_DETAILED : objectWrapperBase::DETAIL_LEVEL_REGULAR;
     $wrapper = objectWrapperBase::getWrapperClass($entry_list, $level);
     $this->addMsg("count", count($entry_list));
     $this->addMsg($this->getObjectPrefix(), $wrapper);
 }
Пример #9
0
 public function initService($serviceId, $serviceName, $actionName)
 {
     parent::initService($serviceId, $serviceName, $actionName);
     myPartnerUtils::addPartnerToCriteria(new AnnotationPeer(), $this->getPartnerId(), $this->private_partner_data, $this->partnerGroup(), $this->kalturaNetworkAllowed($action));
     // when session is not admin, allow access to user entries only
     if (!$this->getKs() || !$this->getKs()->isAdmin()) {
         AnnotationPeer::setDefaultCriteriaFilterByKuser();
     }
     if (!AnnotationPlugin::isAllowedPartner(kCurrentContext::$master_partner_id)) {
         throw new KalturaAPIException(KalturaErrors::SERVICE_FORBIDDEN, $this->serviceName . '->' . $this->actionName);
     }
 }
 public function validateForUsage($sourceObject, $propertiesToSkip = array())
 {
     parent::validateForUsage($sourceObject, $propertiesToSkip);
     $this->validatePropertyNotNull('metadataProfileId');
     $this->validatePropertyNotNull('metadataObjectType');
     $this->validatePropertyNotNull('xslt');
     myPartnerUtils::addPartnerToCriteria('MetadataProfile', kCurrentContext::getCurrentPartnerId(), true);
     $metadataProfile = MetadataProfilePeer::retrieveByPK($this->metadataProfileId);
     if (is_null($metadataProfile)) {
         throw new KalturaAPIException(MetadataErrors::METADATA_PROFILE_NOT_FOUND, $this->metadataProfileId);
     }
 }
 public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser, $create_cachekey = false)
 {
     myDbHelper::$use_alternative_con = myDbHelper::DB_HELPER_CONN_PROPEL3;
     // TODO -  verify permissions for viewing lists
     $detailed = $this->getP("detailed", false);
     if (!$detailed) {
         $detailed = false;
     }
     $playlist_id = $this->getPM("playlist_id");
     if ($create_cachekey) {
         if ($this->isAdmin()) {
             return null;
         }
         $ks_partner_id = null;
         $privileges = null;
         $ks = ks::fromSecureString(kCurrentContext::$ks);
         if ($ks) {
             $ks_partner_id = $ks->getPartnerId();
             $privileges = $ks->getPrivileges();
         }
         $cache_key_arr = array("playlist_id" => $playlist_id, "partner_id" => $partner_id, "ks_partner_id" => $ks_partner_id, "detailed" => $detailed, "user" => kCurrentContext::$ks_uid, "privileges" => $privileges, "is_admin" => $this->isAdmin(), "protocol" => infraRequestUtils::getProtocol());
         $cahce_key = new executionCacheKey();
         $cahce_key->expiry = 600;
         $cahce_key->key = md5(print_r($cache_key_arr, true));
         return $cahce_key;
     }
     // this service is executed twice! (first time for the cache key, second time for the execution)
     if (is_null($this->playlist)) {
         $playlist = entryPeer::retrieveByPK($playlist_id);
         if (!$playlist) {
             throw new APIException(APIErrors::INVALID_ENTRY_ID, "Playlist", $playlist_id);
         }
         myPartnerUtils::addPartnerToCriteria('accessControl', $playlist->getPartnerId(), $this->getPrivatePartnerData(), $this->partnerGroup2(), null);
         $this->playlist = $playlist;
     }
     if ($this->isAdmin()) {
         myPlaylistUtils::setIsAdminKs(true);
     }
     $entry_list = myPlaylistUtils::executePlaylistById($partner_id, $playlist_id, null, $detailed);
     myEntryUtils::updatePuserIdsForEntries($entry_list);
     $level = $detailed ? objectWrapperBase::DETAIL_LEVEL_DETAILED : objectWrapperBase::DETAIL_LEVEL_REGULAR;
     $wrapper = objectWrapperBase::getWrapperClass($entry_list, $level);
     $this->addMsg("count", count($entry_list));
     $this->addMsg($this->getObjectPrefix(), $wrapper);
 }
 public function initService($serviceId, $serviceName, $actionName)
 {
     parent::initService($serviceId, $serviceName, $actionName);
     myPartnerUtils::addPartnerToCriteria(new DwhHourlyPartnerPeer(), $this->getPartnerId(), $this->private_partner_data, $this->partnerGroup());
 }
 public function __construct($feedId, $feedProcessingKey = null, $ks = null)
 {
     $this->feedProcessingKey = $feedProcessingKey;
     myDbHelper::$use_alternative_con = myDbHelper::DB_HELPER_CONN_PROPEL3;
     $microTimeStart = microtime(true);
     KalturaLog::info("syndicationFeedRenderer- initialize ");
     $this->syndicationFeedDb = $syndicationFeedDB = syndicationFeedPeer::retrieveByPK($feedId);
     if (!$syndicationFeedDB) {
         throw new Exception("Feed Id not found");
     }
     kCurrentContext::initKsPartnerUser($ks, $syndicationFeedDB->getPartnerId(), '');
     kPermissionManager::init();
     kEntitlementUtils::initEntitlementEnforcement($syndicationFeedDB->getPartnerId(), $syndicationFeedDB->getEnforceEntitlement());
     if (!is_null($syndicationFeedDB->getPrivacyContext()) && $syndicationFeedDB->getPrivacyContext() != '') {
         kEntitlementUtils::setPrivacyContextSearch($syndicationFeedDB->getPrivacyContext());
     }
     $tmpSyndicationFeed = KalturaSyndicationFeedFactory::getInstanceByType($syndicationFeedDB->getType());
     $tmpSyndicationFeed->fromObject($syndicationFeedDB);
     $this->syndicationFeed = $tmpSyndicationFeed;
     // add partner to default criteria
     myPartnerUtils::addPartnerToCriteria('category', $this->syndicationFeed->partnerId, true);
     myPartnerUtils::addPartnerToCriteria('asset', $this->syndicationFeed->partnerId, true);
     myPartnerUtils::resetPartnerFilter('entry');
     $this->baseCriteria = clone entryPeer::getDefaultCriteriaFilter();
     $startDateCriterion = $this->baseCriteria->getNewCriterion(entryPeer::START_DATE, time(), Criteria::LESS_EQUAL);
     $startDateCriterion->addOr($this->baseCriteria->getNewCriterion(entryPeer::START_DATE, null));
     $this->baseCriteria->addAnd($startDateCriterion);
     $endDateCriterion = $this->baseCriteria->getNewCriterion(entryPeer::END_DATE, time(), Criteria::GREATER_EQUAL);
     $endDateCriterion->addOr($this->baseCriteria->getNewCriterion(entryPeer::END_DATE, null));
     $this->baseCriteria->addAnd($endDateCriterion);
     $this->baseCriteria->addAnd(entryPeer::PARTNER_ID, $this->syndicationFeed->partnerId);
     $this->baseCriteria->addAnd(entryPeer::STATUS, entryStatus::READY);
     $this->baseCriteria->addAnd(entryPeer::TYPE, array(entryType::MEDIA_CLIP, entryType::MIX), Criteria::IN);
     $this->baseCriteria->addAnd(entryPeer::MODERATION_STATUS, array(entry::ENTRY_MODERATION_STATUS_REJECTED, entry::ENTRY_MODERATION_STATUS_PENDING_MODERATION), Criteria::NOT_IN);
     if ($this->syndicationFeed->playlistId) {
         $this->entryFilters = myPlaylistUtils::getPlaylistFiltersById($this->syndicationFeed->playlistId);
         foreach ($this->entryFilters as $entryFilter) {
             $entryFilter->setPartnerSearchScope(baseObjectFilter::MATCH_KALTURA_NETWORK_AND_PRIVATE);
             // partner scope already attached
         }
         $playlist = entryPeer::retrieveByPK($this->syndicationFeed->playlistId);
         if ($playlist) {
             if ($playlist->getMediaType() != entry::ENTRY_MEDIA_TYPE_XML) {
                 $this->staticPlaylist = true;
                 $this->staticPlaylistEntriesIdsOrder = explode(',', $playlist->getDataContent());
             }
         }
     } else {
         $this->entryFilters = array();
     }
     $microTimeEnd = microtime(true);
     KalturaLog::info("syndicationFeedRenderer- initialization done [" . ($microTimeEnd - $microTimeStart) . "]");
 }
 /**
  * List metadata objects by filter and pager
  * 
  * @action list
  * @param KalturaMetadataFilter $filter
  * @param KalturaFilterPager $pager
  * @return KalturaMetadataListResponse
  */
 function listAction(KalturaMetadataFilter $filter = null, KalturaFilterPager $pager = null)
 {
     if (!$filter) {
         $filter = new KalturaMetadataFilter();
     }
     if (kEntitlementUtils::getEntitlementEnforcement() && (is_null($filter->objectIdIn) && is_null($filter->objectIdEqual))) {
         throw new KalturaAPIException(MetadataErrors::MUST_FILTER_ON_OBJECT_ID);
     }
     $entryIds = null;
     if ($filter->metadataObjectTypeEqual == MetadataObjectType::ENTRY) {
         if ($filter->objectIdEqual) {
             $entryIds = array($filter->objectIdEqual);
         } else {
             if ($filter->objectIdIn) {
                 $entryIds = explode(',', $filter->objectIdIn);
             }
         }
     }
     if (is_null($entryIds)) {
         myPartnerUtils::addPartnerToCriteria(new MetadataPeer(), $this->getPartnerId(), $this->private_partner_data, $this->partnerGroup());
     } else {
         $entryIds = entryPeer::filterEntriesByPartnerOrKalturaNetwork($entryIds, $this->getPartnerId());
         $filter->objectIdEqual = null;
         $filter->objectIdIn = implode(',', $entryIds);
     }
     $metadataFilter = new MetadataFilter();
     $filter->toObject($metadataFilter);
     $c = new Criteria();
     $metadataFilter->attachToCriteria($c);
     if ($entryIds === array()) {
         $c->addAnd(MetadataPeer::OBJECT_ID, array(), Criteria::IN);
     }
     $count = MetadataPeer::doCount($c);
     if (!$pager) {
         $pager = new KalturaFilterPager();
     }
     $pager->attachToCriteria($c);
     $list = MetadataPeer::doSelect($c);
     $response = new KalturaMetadataListResponse();
     $response->objects = KalturaMetadataArray::fromDbArray($list);
     $response->totalCount = $count;
     return $response;
 }
Пример #15
0
 protected function applyPartnerFilterForClassNoKalturaNetwork($peer)
 {
     if ($this->getPartner()) {
         $partner_id = $this->getPartner()->getId();
     } else {
         $partner_id = -1;
     }
     myPartnerUtils::addPartnerToCriteria($peer, $partner_id, $this->private_partner_data, $this->partnerGroup(), null);
 }
 protected function applyPartnerFilterForClass($peer, $partner_id)
 {
     myPartnerUtils::addPartnerToCriteria($peer, $partner_id, $this->private_partner_data, $this->partnerGroup2(), $this->kalturaNetwork2());
 }
Пример #17
0
 /**
  * @return string path value
  * @param entry $entry
  * @param string $xslStr
  */
 protected function getPathValue(entry $entry, $xslStr)
 {
     // set the default criteria to use the current entry distribution partner id (it is restored later)
     // this is needed for related entries under kMetadataMrssManager which is using retrieveByPK without the correct partner id filter
     $oldEntryCriteria = entryPeer::getCriteriaFilter()->getFilter();
     myPartnerUtils::resetPartnerFilter('entry');
     myPartnerUtils::addPartnerToCriteria('entry', $entry->getPartnerId(), true);
     $mrss = null;
     $mrssParams = new kMrssParameters();
     $mrssParams->setStatuses(array(flavorAsset::ASSET_STATUS_READY, flavorAsset::ASSET_STATUS_EXPORTING));
     $mrss = kMrssManager::getEntryMrssXml($entry, $mrss, $mrssParams);
     $mrssStr = $mrss->asXML();
     // restore the original criteria
     entryPeer::getCriteriaFilter()->setFilter($oldEntryCriteria);
     if (!$mrssStr) {
         KalturaLog::err('No MRSS returned for entry [' . $entry->getId() . ']');
         return null;
     }
     $mrssObj = new DOMDocument();
     if (!$mrssObj->loadXML($mrssStr)) {
         KalturaLog::err('Error loading MRSS XML object for entry [' . $entry->getId() . ']');
         return null;
     }
     $xslObj = new DOMDocument();
     $xslStr = trim($xslStr);
     if (!$xslObj->loadXML($xslStr)) {
         KalturaLog::err('Error loading XSL');
         return null;
     }
     $proc = new XSLTProcessor();
     $proc->registerPHPFunctions(kXml::getXslEnabledPhpFunctions());
     $proc->importStyleSheet($xslObj);
     $resultXmlObj = $proc->transformToDoc($mrssObj);
     if (!$resultXmlObj) {
         KalturaLog::err('Error transforming XML for entry id [' . $entry->getId() . ']');
         return null;
     }
     /* DEBUG logs
     		KalturaLog::log('entry mrss = '.$mrssStr);
     		KalturaLog::log('profile xslt = '.$xslStr);
     		*/
     KalturaLog::debug('Result XML: ' . $resultXmlObj->saveXML());
     $xpath = new DOMXPath($resultXmlObj);
     $fieldElement = $xpath->query("//path_value")->item(0);
     if (!$fieldElement) {
         KalturaLog::err('Cannot find element <path_value> in XML');
         return null;
     }
     $fieldValue = $fieldElement->nodeValue;
     return $fieldValue;
 }
Пример #18
0
 /**
  * @return KalturaDetachedResponseProfile
  */
 public function getResponseProfile($paramName = 'responseProfile')
 {
     if (!isset($this->paramsGrouped[$paramName])) {
         return null;
     }
     $partnerId = kCurrentContext::getCurrentPartnerId();
     myPartnerUtils::addPartnerToCriteria('ResponseProfile', $partnerId, true, "{$partnerId},0");
     $responseProfile = null;
     if (isset($this->paramsGrouped[$paramName]['id'])) {
         $responseProfile = ResponseProfilePeer::retrieveByPK($this->paramsGrouped[$paramName]['id']);
     }
     if (isset($this->paramsGrouped[$paramName]['systemName'])) {
         $responseProfile = ResponseProfilePeer::retrieveBySystemName($this->paramsGrouped[$paramName]['systemName']);
     }
     if ($responseProfile) {
         return new KalturaResponseProfile($responseProfile);
     }
     $typeReflector = KalturaTypeReflectorCacher::get('KalturaDetachedResponseProfile');
     return $this->buildObject($typeReflector, $this->paramsGrouped[$paramName], $paramName);
 }
 protected function getFieldValuesXml(EntryDistribution $entryDistribution, $fieldName = null)
 {
     $entry = entryPeer::retrieveByPKNoFilter($entryDistribution->getEntryId());
     if (!$entry) {
         KalturaLog::err('Entry not found with ID [' . $entryDistribution->getEntryId() . ']');
         return null;
     }
     // set the default criteria to use the current entry distribution partner id (it is restored later)
     // this is needed for related entries under kMetadataMrssManager which is using retrieveByPK without the correct partner id filter
     $oldEntryCriteria = entryPeer::getCriteriaFilter()->getFilter();
     myPartnerUtils::resetPartnerFilter('entry');
     myPartnerUtils::addPartnerToCriteria('entry', $entryDistribution->getPartnerId(), true);
     try {
         $mrss = null;
         $mrssParams = new kMrssParameters();
         if ($this->getItemXpathsToExtend()) {
             $mrssParams->setItemXpathsToExtend($this->getItemXpathsToExtend());
         }
         $mrss = kMrssManager::getEntryMrssXml($entry, $mrss, $mrssParams);
         $mrssStr = $mrss->asXML();
     } catch (Exception $e) {
         // restore the original criteria so it will not get stuck due to the exception
         entryPeer::getCriteriaFilter()->setFilter($oldEntryCriteria);
         throw $e;
     }
     // restore the original criteria
     entryPeer::getCriteriaFilter()->setFilter($oldEntryCriteria);
     if (!$mrssStr) {
         KalturaLog::err('No MRSS returned for entry [' . $entry->getId() . ']');
         return null;
     }
     $mrssObj = new DOMDocument();
     if (!$mrssObj->loadXML($mrssStr)) {
         KalturaLog::err('Error loading MRSS XML object for entry [' . $entry->getId() . ']');
         return null;
     }
     $xslObj = new DOMDocument();
     $xslStr = $this->getFieldValuesXslt($entryDistribution, $fieldName);
     $xslStr = trim($xslStr);
     if (!$xslObj->loadXML($xslStr)) {
         KalturaLog::err('Error loading distribution profile XSLT for profile ID [' . $this->getId() . ']');
         return null;
     }
     $proc = new XSLTProcessor();
     $proc->registerPHPFunctions(kXml::getXslEnabledPhpFunctions());
     $proc->importStyleSheet($xslObj);
     $resultXml = $proc->transformToXml($mrssObj);
     //in order to keep the UTF-8 encoding we transformToXml http://www.php.net/manual/en/xsltprocessor.transformtodoc.php#69305
     $resultXmlObj = new DOMDocument();
     $resultXmlObj->loadXML($resultXml);
     if (!$resultXmlObj) {
         KalturaLog::err('Error transforming XML for distribution profile [' . $this->getId() . '] and entry id [' . $entry->getId() . ']');
         return null;
     }
     /* DEBUG logs
     		KalturaLog::log('entry mrss = '.$mrssStr);
     		KalturaLog::log('profile xslt = '.$xslStr);
     		*/
     KalturaLog::debug('Result XML: ' . $resultXmlObj->saveXML());
     return $resultXmlObj;
 }
Пример #20
0
 public function getEntryMrssDoc(EntryDistribution $entryDistribution)
 {
     $entry = entryPeer::retrieveByPK($entryDistribution->getEntryId());
     // set the default criteria to use the current entry distribution partner id (it is restored later)
     // this is needed for related entries under kMetadataMrssManager which is using retrieveByPK without the correct partner id filter
     $oldEntryCriteria = entryPeer::getCriteriaFilter()->getFilter();
     myPartnerUtils::resetPartnerFilter('entry');
     myPartnerUtils::addPartnerToCriteria('entry', $this->getPartnerId(), true);
     try {
         $mrss = null;
         $mrssParams = new kMrssParameters();
         if ($this->getItemXpathsToExtend()) {
             $mrssParams->setItemXpathsToExtend($this->getItemXpathsToExtend());
         }
         $mrss = kMrssManager::getEntryMrssXml($entry, $mrss, $mrssParams);
         $mrssStr = $mrss->asXML();
     } catch (Exception $e) {
         // restore the original criteria so it will not get stuck due to the exception
         entryPeer::getCriteriaFilter()->setFilter($oldEntryCriteria);
         throw $e;
     }
     // restore the original criteria
     entryPeer::getCriteriaFilter()->setFilter($oldEntryCriteria);
     $mrssObj = new DOMDocument();
     if (!$mrssObj->loadXML($mrssStr)) {
         throw new Exception('Entry mrss xml is not valid');
     }
     return $mrssObj;
 }