public function validateEntry(entry $dbEntry)
 {
     parent::validateEntry($dbEntry);
     $this->validatePropertyNotNull('resource');
     $this->validatePropertyNotNull('assetParamsId');
     $this->resource->validateEntry($dbEntry);
 }
 public function validateEntry(entry $dbEntry)
 {
     parent::validateEntry($dbEntry);
     $this->validatePropertyNotNull('resource');
     if (!$this->resource instanceof KalturaEntryResource && !$this->resource instanceof KalturaAssetResource) {
         throw new KalturaAPIException(KalturaErrors::RESOURCE_TYPE_NOT_SUPPORTED, get_class($this->resource));
     }
     $this->resource->validateEntry($dbEntry);
 }
 public function validateEntry(entry $dbEntry)
 {
     parent::validateEntry($dbEntry);
     $this->validatePropertyNotNull('fileSyncObjectType');
     $this->validatePropertyNotNull('objectSubType');
     $this->validatePropertyNotNull('objectId');
 }
 public function validateEntry(entry $dbEntry)
 {
     parent::validateEntry($dbEntry);
     $this->validatePropertyNotNull('entryId');
     $srcEntry = entryPeer::retrieveByPK($this->entryId);
     if (!$srcEntry) {
         throw new KalturaAPIException(KalturaErrors::ENTRY_ID_NOT_FOUND, $this->entryId);
     }
     if ($srcEntry->getMediaType() == KalturaMediaType::IMAGE) {
         return parent::validateEntry($dbEntry);
     }
     $srcFlavorAsset = null;
     if (is_null($this->flavorParamsId)) {
         $srcFlavorAsset = assetPeer::retrieveOriginalByEntryId($this->entryId);
         if (!$srcFlavorAsset) {
             throw new KalturaAPIException(KalturaErrors::ORIGINAL_FLAVOR_ASSET_IS_MISSING);
         }
     } else {
         $srcFlavorAsset = assetPeer::retrieveByEntryIdAndParams($this->entryId, $this->flavorParamsId);
         if (!$srcFlavorAsset) {
             throw new KalturaAPIException(KalturaErrors::FLAVOR_ASSET_ID_NOT_FOUND, $this->assetId);
         }
     }
     $key = $srcFlavorAsset->getSyncKey(asset::FILE_SYNC_ASSET_SUB_TYPE_ASSET);
     $c = FileSyncPeer::getCriteriaForFileSyncKey($key);
     $c->addAnd(FileSyncPeer::FILE_TYPE, array(FileSync::FILE_SYNC_FILE_TYPE_FILE, FileSync::FILE_SYNC_FILE_TYPE_LINK), Criteria::IN);
     $fileSyncs = FileSyncPeer::doSelect($c);
     foreach ($fileSyncs as $fileSync) {
         $fileSync = kFileSyncUtils::resolve($fileSync);
         if ($fileSync->getFileType() == FileSync::FILE_SYNC_FILE_TYPE_FILE) {
             return;
         }
     }
     throw new KalturaAPIException(KalturaErrors::FILE_DOESNT_EXIST);
 }
Ejemplo n.º 5
0
 public function validateEntry(entry $dbEntry)
 {
     parent::validateEntry($dbEntry);
     $srcEntry = entryPeer::retrieveByPK($this->entryId);
     if (!$srcEntry) {
         throw new KalturaAPIException(KalturaErrors::ENTRY_ID_NOT_FOUND, $this->entryId);
     }
     if ($srcEntry->getMediaType() == KalturaMediaType::IMAGE) {
         return parent::validateEntry($dbEntry);
     }
 }
 public function validateEntry(entry $dbEntry)
 {
     parent::validateEntry($dbEntry);
     $dc = $this->getDc();
     if ($dc == kDataCenterMgr::getCurrentDcId()) {
         return;
     }
     $remoteDCHost = kDataCenterMgr::getRemoteDcExternalUrlByDcId($dc);
     if ($remoteDCHost) {
         kFile::dumpApiRequest($remoteDCHost);
     }
     throw new KalturaAPIException(KalturaErrors::REMOTE_DC_NOT_FOUND, $dc);
 }
 public function validateEntry(entry $dbEntry)
 {
     parent::validateEntry($dbEntry);
     $this->validatePropertyNotNull('assetId');
     $srcFlavorAsset = assetPeer::retrieveById($this->assetId);
     if (!$srcFlavorAsset) {
         throw new KalturaAPIException(KalturaErrors::FLAVOR_ASSET_ID_NOT_FOUND, $resource->assetId);
     }
     $key = $srcFlavorAsset->getSyncKey(asset::FILE_SYNC_ASSET_SUB_TYPE_ASSET);
     $c = FileSyncPeer::getCriteriaForFileSyncKey($key);
     $c->addAnd(FileSyncPeer::FILE_TYPE, array(FileSync::FILE_SYNC_FILE_TYPE_FILE, FileSync::FILE_SYNC_FILE_TYPE_LINK), Criteria::IN);
     $fileSyncs = FileSyncPeer::doSelect($c);
     foreach ($fileSyncs as $fileSync) {
         $fileSync = kFileSyncUtils::resolve($fileSync);
         if ($fileSync->getFileType() == FileSync::FILE_SYNC_FILE_TYPE_FILE) {
             return;
         }
     }
     throw new KalturaAPIException(KalturaErrors::FILE_DOESNT_EXIST);
 }
 /**
  * Update content of attachment asset
  *
  * @action setContent
  * @param string $id
  * @param KalturaContentResource $contentResource
  * @return KalturaAttachmentAsset
  * @throws KalturaAttachmentErrors::ATTACHMENT_ASSET_ID_NOT_FOUND
  * @throws KalturaErrors::UPLOAD_TOKEN_INVALID_STATUS_FOR_ADD_ENTRY
  * @throws KalturaErrors::UPLOADED_FILE_NOT_FOUND_BY_TOKEN
  * @throws KalturaErrors::RECORDED_WEBCAM_FILE_NOT_FOUND
  * @throws KalturaAttachmentErrors::ATTACHMENT_ASSET_ID_NOT_FOUND
  * @throws KalturaErrors::STORAGE_PROFILE_ID_NOT_FOUND
  * @throws KalturaErrors::RESOURCE_TYPE_NOT_SUPPORTED 
  * @validateUser asset::entry id edit
  */
 function setContentAction($id, KalturaContentResource $contentResource)
 {
     $dbAttachmentAsset = assetPeer::retrieveById($id);
     if (!$dbAttachmentAsset || !$dbAttachmentAsset instanceof AttachmentAsset) {
         throw new KalturaAPIException(KalturaAttachmentErrors::ATTACHMENT_ASSET_ID_NOT_FOUND, $id);
     }
     $dbEntry = $dbAttachmentAsset->getentry();
     if (!$dbEntry || !in_array($dbEntry->getType(), $this->mediaTypes)) {
         throw new KalturaAPIException(KalturaErrors::ENTRY_ID_NOT_FOUND, $dbAttachmentAsset->getEntryId());
     }
     $previousStatus = $dbAttachmentAsset->getStatus();
     $contentResource->validateEntry($dbAttachmentAsset->getentry());
     $contentResource->validateAsset($dbAttachmentAsset);
     $kContentResource = $contentResource->toObject();
     $this->attachContentResource($dbAttachmentAsset, $kContentResource);
     $contentResource->entryHandled($dbAttachmentAsset->getentry());
     kEventsManager::raiseEvent(new kObjectDataChangedEvent($dbAttachmentAsset));
     $newStatuses = array(AttachmentAsset::ASSET_STATUS_READY, AttachmentAsset::ASSET_STATUS_VALIDATING, AttachmentAsset::ASSET_STATUS_TEMP);
     if ($previousStatus == AttachmentAsset::ASSET_STATUS_QUEUED && in_array($dbAttachmentAsset->getStatus(), $newStatuses)) {
         kEventsManager::raiseEvent(new kObjectAddedEvent($dbAttachmentAsset));
     }
     $attachmentAsset = new KalturaAttachmentAsset();
     $attachmentAsset->fromObject($dbAttachmentAsset);
     return $attachmentAsset;
 }
Ejemplo n.º 9
0
 /**
  * Update content of caption asset
  *
  * @action setContent
  * @param string $id
  * @param KalturaContentResource $contentResource
  * @return KalturaCaptionAsset
  * @throws KalturaCaptionErrors::CAPTION_ASSET_ID_NOT_FOUND
  * @throws KalturaErrors::UPLOAD_TOKEN_INVALID_STATUS_FOR_ADD_ENTRY
  * @throws KalturaErrors::UPLOADED_FILE_NOT_FOUND_BY_TOKEN
  * @throws KalturaErrors::RECORDED_WEBCAM_FILE_NOT_FOUND
  * @throws KalturaCaptionErrors::CAPTION_ASSET_ID_NOT_FOUND
  * @throws KalturaErrors::STORAGE_PROFILE_ID_NOT_FOUND
  * @throws KalturaErrors::RESOURCE_TYPE_NOT_SUPPORTED
  * @validateUser asset::entry id edit 
  */
 function setContentAction($id, KalturaContentResource $contentResource)
 {
     $dbCaptionAsset = assetPeer::retrieveById($id);
     if (!$dbCaptionAsset || !$dbCaptionAsset instanceof CaptionAsset) {
         throw new KalturaAPIException(KalturaCaptionErrors::CAPTION_ASSET_ID_NOT_FOUND, $id);
     }
     $dbEntry = $dbCaptionAsset->getentry();
     if (!$dbEntry || !in_array($dbEntry->getType(), $this->getEnabledMediaTypes()) || !in_array($dbEntry->getMediaType(), array(KalturaMediaType::VIDEO, KalturaMediaType::AUDIO))) {
         throw new KalturaAPIException(KalturaErrors::ENTRY_ID_NOT_FOUND, $dbCaptionAsset->getEntryId());
     }
     $previousStatus = $dbCaptionAsset->getStatus();
     $contentResource->validateEntry($dbCaptionAsset->getentry());
     $contentResource->validateAsset($dbCaptionAsset);
     $kContentResource = $contentResource->toObject();
     $this->attachContentResource($dbCaptionAsset, $kContentResource);
     $contentResource->entryHandled($dbCaptionAsset->getentry());
     $newStatuses = array(CaptionAsset::ASSET_STATUS_READY, CaptionAsset::ASSET_STATUS_VALIDATING, CaptionAsset::ASSET_STATUS_TEMP);
     if ($previousStatus == CaptionAsset::ASSET_STATUS_QUEUED && in_array($dbCaptionAsset->getStatus(), $newStatuses)) {
         kEventsManager::raiseEvent(new kObjectAddedEvent($dbCaptionAsset));
     } else {
         kEventsManager::raiseEvent(new kObjectDataChangedEvent($dbCaptionAsset));
     }
     $captionAsset = new KalturaCaptionAsset();
     $captionAsset->fromObject($dbCaptionAsset, $this->getResponseProfile());
     return $captionAsset;
 }
 /**
  * Update content of thumbnail asset
  *
  * @action setContent
  * @param string $id
  * @param KalturaContentResource $contentResource
  * @return KalturaThumbAsset
  * @throws KalturaErrors::THUMB_ASSET_ID_NOT_FOUND
  * @throws KalturaErrors::UPLOAD_TOKEN_INVALID_STATUS_FOR_ADD_ENTRY
  * @throws KalturaErrors::UPLOADED_FILE_NOT_FOUND_BY_TOKEN
  * @throws KalturaErrors::RECORDED_WEBCAM_FILE_NOT_FOUND
  * @throws KalturaErrors::THUMB_ASSET_ID_NOT_FOUND
  * @throws KalturaErrors::STORAGE_PROFILE_ID_NOT_FOUND
  * @throws KalturaErrors::RESOURCE_TYPE_NOT_SUPPORTED
  * @validateUser asset::entry id edit 
  */
 function setContentAction($id, KalturaContentResource $contentResource)
 {
     $dbThumbAsset = assetPeer::retrieveById($id);
     if (!$dbThumbAsset || !$dbThumbAsset instanceof thumbAsset) {
         throw new KalturaAPIException(KalturaErrors::THUMB_ASSET_ID_NOT_FOUND, $id);
     }
     $dbEntry = $dbThumbAsset->getentry();
     if (!$dbEntry) {
         throw new KalturaAPIException(KalturaErrors::ENTRY_ID_NOT_FOUND, $dbThumbAsset->getEntryId());
     }
     $previousStatus = $dbThumbAsset->getStatus();
     $contentResource->validateEntry($dbThumbAsset->getentry());
     $contentResource->validateAsset($dbThumbAsset);
     $kContentResource = $contentResource->toObject();
     $this->attachContentResource($dbThumbAsset, $kContentResource);
     $contentResource->entryHandled($dbThumbAsset->getentry());
     kEventsManager::raiseEvent(new kObjectDataChangedEvent($dbThumbAsset));
     $newStatuses = array(thumbAsset::ASSET_STATUS_READY, thumbAsset::ASSET_STATUS_VALIDATING, thumbAsset::ASSET_STATUS_TEMP);
     if ($previousStatus == thumbAsset::ASSET_STATUS_QUEUED && in_array($dbThumbAsset->getStatus(), $newStatuses)) {
         kEventsManager::raiseEvent(new kObjectAddedEvent($dbThumbAsset));
     }
     $thumbAssetsCount = assetPeer::countThumbnailsByEntryId($dbThumbAsset->getEntryId());
     $defaultThumbKey = $dbEntry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_THUMB);
     //If the thums has the default tag or the entry is in no content and this is the first thumb
     if ($dbEntry->getCreateThumb() && ($dbThumbAsset->hasTag(thumbParams::TAG_DEFAULT_THUMB) || $dbEntry->getStatus() == KalturaEntryStatus::NO_CONTENT && $thumbAssetsCount == 1 && !kFileSyncUtils::fileSync_exists($defaultThumbKey))) {
         $this->setAsDefaultAction($dbThumbAsset->getId());
     }
     $thumbAsset = new KalturaThumbAsset();
     $thumbAsset->fromObject($dbThumbAsset);
     return $thumbAsset;
 }
 public function validateEntry(entry $dbEntry)
 {
     parent::validateEntry($dbEntry);
     $this->validatePropertyNotNull('url');
 }
Ejemplo n.º 12
0
 /**
  * Update content of flavor asset
  *
  * @action setContent
  * @param string $id
  * @param KalturaContentResource $contentResource
  * @return KalturaFlavorAsset
  * @throws KalturaErrors::FLAVOR_ASSET_ID_NOT_FOUND
  * @throws KalturaErrors::UPLOAD_TOKEN_INVALID_STATUS_FOR_ADD_ENTRY
  * @throws KalturaErrors::UPLOADED_FILE_NOT_FOUND_BY_TOKEN
  * @throws KalturaErrors::RECORDED_WEBCAM_FILE_NOT_FOUND
  * @throws KalturaErrors::FLAVOR_ASSET_ID_NOT_FOUND
  * @throws KalturaErrors::STORAGE_PROFILE_ID_NOT_FOUND
  * @throws KalturaErrors::RESOURCE_TYPE_NOT_SUPPORTED 
  * @validateUser asset::entry id edit
  */
 function setContentAction($id, KalturaContentResource $contentResource)
 {
     $dbFlavorAsset = assetPeer::retrieveById($id);
     if (!$dbFlavorAsset || !$dbFlavorAsset instanceof flavorAsset) {
         throw new KalturaAPIException(KalturaErrors::FLAVOR_ASSET_ID_NOT_FOUND, $id);
     }
     $dbEntry = $dbFlavorAsset->getentry();
     if (!$dbEntry) {
         throw new KalturaAPIException(KalturaErrors::ENTRY_ID_NOT_FOUND, $dbFlavorAsset->getEntryId());
     }
     $contentResource->validateEntry($dbFlavorAsset->getentry());
     $contentResource->validateAsset($dbFlavorAsset);
     $kContentResource = $contentResource->toObject();
     $this->attachContentResource($dbFlavorAsset, $kContentResource);
     $contentResource->entryHandled($dbFlavorAsset->getentry());
     kEventsManager::raiseEvent(new kObjectDataChangedEvent($dbFlavorAsset));
     $newStatuses = array(asset::ASSET_STATUS_EXPORTING, flavorAsset::FLAVOR_ASSET_STATUS_READY, flavorAsset::FLAVOR_ASSET_STATUS_QUEUED, flavorAsset::FLAVOR_ASSET_STATUS_TEMP);
     if (in_array($dbFlavorAsset->getStatus(), $newStatuses)) {
         kEventsManager::raiseEvent(new kObjectAddedEvent($dbFlavorAsset));
     }
     $flavorAsset = KalturaFlavorAsset::getInstance($dbFlavorAsset, $this->getResponseProfile());
     return $flavorAsset;
 }
Ejemplo n.º 13
0
 public function validateEntry(entry $dbEntry)
 {
     parent::validateEntry($dbEntry);
     $this->resource->validateEntry($dbEntry);
 }