/**
  * @param AttachmentAsset $attachmentAsset
  * @param kContentResource $contentResource
  * @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
  */
 protected function attachContentResource(AttachmentAsset $attachmentAsset, kContentResource $contentResource)
 {
     switch ($contentResource->getType()) {
         case 'kUrlResource':
             return $this->attachUrlResource($attachmentAsset, $contentResource);
         case 'kLocalFileResource':
             return $this->attachLocalFileResource($attachmentAsset, $contentResource);
         case 'kFileSyncResource':
             return $this->attachFileSyncResource($attachmentAsset, $contentResource);
         case 'kRemoteStorageResource':
         case 'kRemoteStorageResources':
             return $this->attachRemoteStorageResource($attachmentAsset, $contentResource);
         default:
             $msg = "Resource of type [" . get_class($contentResource) . "] is not supported";
             KalturaLog::err($msg);
             if ($attachmentAsset->getStatus() == AttachmentAsset::ASSET_STATUS_QUEUED || $attachmentAsset->getStatus() == AttachmentAsset::ASSET_STATUS_NOT_APPLICABLE) {
                 $attachmentAsset->setDescription($msg);
                 $attachmentAsset->setStatus(asset::ASSET_STATUS_ERROR);
                 $attachmentAsset->save();
             }
             throw new KalturaAPIException(KalturaErrors::RESOURCE_TYPE_NOT_SUPPORTED, get_class($contentResource));
     }
 }
示例#2
0
 /**
  * @param FileAsset $dbFileAsset
  * @param kContentResource $contentResource
  * @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
  */
 protected function attachContentResource(FileAsset $dbFileAsset, kContentResource $contentResource)
 {
     switch ($contentResource->getType()) {
         case 'kLocalFileResource':
             return $this->attachLocalFileResource($dbFileAsset, $contentResource);
         case 'kFileSyncResource':
             return $this->attachFileSyncResource($dbFileAsset, $contentResource);
         default:
             $msg = "Resource of type [" . get_class($contentResource) . "] is not supported";
             KalturaLog::err($msg);
             throw new KalturaAPIException(KalturaErrors::RESOURCE_TYPE_NOT_SUPPORTED, get_class($contentResource));
     }
 }