public function fromObject($source_object)
 {
     /* @var $source_object CaptionAssetItem */
     $ret = parent::fromObject($source_object);
     $this->asset = new KalturaCaptionAsset();
     $this->asset->fromObject($source_object->getAsset());
     $entry = $source_object->getEntry();
     $this->entry = KalturaEntryFactory::getInstanceByType($entry->getType());
     $this->entry->fromObject($entry);
     return $ret;
 }
예제 #2
0
 /**
  * Generic add entry using an uploaded file, should be used when the uploaded entry type is not known
  *
  * @action addFromUploadedFile
  * @param KalturaBaseEntry $entry
  * @param string $uploadTokenId
  * @param KalturaEntryType $type
  * @return KalturaBaseEntry
  */
 function addFromUploadedFileAction(KalturaBaseEntry $entry, $uploadTokenId, $type = -1)
 {
     try {
         // check that the uploaded file exists
         $entryFullPath = kUploadTokenMgr::getFullPathByUploadTokenId($uploadTokenId);
     } catch (kCoreException $ex) {
         if ($ex->getCode() == kUploadTokenException::UPLOAD_TOKEN_INVALID_STATUS) {
         }
         throw new KalturaAPIException(KalturaErrors::UPLOAD_TOKEN_INVALID_STATUS_FOR_ADD_ENTRY);
         throw $ex;
     }
     if (!file_exists($entryFullPath)) {
         $remoteDCHost = kUploadTokenMgr::getRemoteHostForUploadToken($uploadTokenId, kDataCenterMgr::getCurrentDcId());
         if ($remoteDCHost) {
             kFile::dumpApiRequest($remoteDCHost);
         } else {
             throw new KalturaAPIException(KalturaErrors::UPLOADED_FILE_NOT_FOUND_BY_TOKEN);
         }
     }
     // validate the input object
     //$entry->validatePropertyMinLength("name", 1);
     if (!$entry->name) {
         $entry->name = $this->getPartnerId() . '_' . time();
     }
     // first copy all the properties to the db entry, then we'll check for security stuff
     $dbEntry = $entry->toInsertableObject(new entry());
     $dbEntry->setType($type);
     $dbEntry->setMediaType(entry::ENTRY_MEDIA_TYPE_AUTOMATIC);
     $this->checkAndSetValidUser($entry, $dbEntry);
     $this->checkAdminOnlyInsertProperties($entry);
     $this->validateAccessControlId($entry);
     $this->validateEntryScheduleDates($entry);
     $dbEntry->setPartnerId($this->getPartnerId());
     $dbEntry->setSubpId($this->getPartnerId() * 100);
     $dbEntry->setSourceId($uploadTokenId);
     $dbEntry->setSourceLink($entryFullPath);
     $dbEntry->setDefaultModerationStatus();
     $dbEntry->save();
     $kshow = $this->createDummyKShow();
     $kshowId = $kshow->getId();
     myEntryUtils::setEntryTypeAndMediaTypeFromFile($dbEntry, $entryFullPath);
     // setup the needed params for my insert entry helper
     $paramsArray = array("entry_media_source" => KalturaSourceType::FILE, "entry_media_type" => $dbEntry->getMediaType(), "entry_full_path" => $entryFullPath, "entry_license" => $dbEntry->getLicenseType(), "entry_credit" => $dbEntry->getCredit(), "entry_source_link" => $dbEntry->getSourceLink(), "entry_tags" => $dbEntry->getTags());
     $token = $this->getKsUniqueString();
     $insert_entry_helper = new myInsertEntryHelper(null, $dbEntry->getKuserId(), $kshowId, $paramsArray);
     $insert_entry_helper->setPartnerId($this->getPartnerId(), $this->getPartnerId() * 100);
     $insert_entry_helper->insertEntry($token, $dbEntry->getType(), $dbEntry->getId(), $dbEntry->getName(), $dbEntry->getTags(), $dbEntry);
     $dbEntry = $insert_entry_helper->getEntry();
     kUploadTokenMgr::closeUploadTokenById($uploadTokenId);
     myNotificationMgr::createNotification(kNotificationJobData::NOTIFICATION_TYPE_ENTRY_ADD, $dbEntry);
     $entry->fromObject($dbEntry);
     return $entry;
 }
예제 #3
0
 public function fromObject($sourceObject)
 {
     if (!$sourceObject) {
         return;
     }
     parent::fromObject($sourceObject);
 }
예제 #4
0
 /**
  * @return DocumentEntry
  */
 public function toObject($dbObject = null, $skip = array())
 {
     if (is_null($dbObject)) {
         $dbObject = new DocumentEntry();
     }
     return parent::toObject($dbObject, $skip);
 }
예제 #5
0
 public function doFromObject($source_object, KalturaDetachedResponseProfile $responseProfile = null)
 {
     /* @var $source_object CaptionAssetItem */
     $ret = parent::doFromObject($source_object, $responseProfile);
     if ($this->shouldGet('asset', $responseProfile)) {
         $this->asset = new KalturaCaptionAsset();
         $this->asset->fromObject($source_object->getAsset());
     }
     if ($this->shouldGet('entry', $responseProfile)) {
         $entry = $source_object->getEntry();
         if ($entry) {
             $this->entry = KalturaEntryFactory::getInstanceByType($entry->getType());
             $this->entry->fromObject($entry);
         }
     }
     return $ret;
 }
예제 #6
0
 /**
  * @param KalturaBaseEntry $entry
  * @return entry
  */
 protected function prepareEntryForInsert(KalturaBaseEntry $entry)
 {
     // create a default name if none was given
     if (!$entry->name) {
         $entry->name = $this->getPartnerId() . '_' . time();
     }
     // first copy all the properties to the db entry, then we'll check for security stuff
     $dbEntry = $entry->toInsertableObject(new entry());
     $this->checkAndSetValidUser($entry, $dbEntry);
     $this->checkAdminOnlyInsertProperties($entry);
     $this->validateAccessControlId($entry);
     $this->validateEntryScheduleDates($entry);
     $dbEntry->setPartnerId($this->getPartnerId());
     $dbEntry->setSubpId($this->getPartnerId() * 100);
     $dbEntry->setDefaultModerationStatus();
     return $dbEntry;
 }
예제 #7
0
 public function toObject($dbObject = null, $skip = array())
 {
     /* @var $dbObject entry */
     parent::toObject($dbObject, $skip);
     if ($this->msDuration) {
         $dbObject->setCalculateDuration(false);
     }
     return $dbObject;
 }
예제 #8
0
 public function fromObject($dbDataEntry)
 {
     parent::fromObject($dbDataEntry);
     //$retrieveDataContentByGet = $dbDataEntry->getFromCustomData('retrieveDataContentByGet');
     $retrieveDataContentByGet = $dbDataEntry->getRetrieveDataContentByGet();
     $this->retrieveDataContentByGet = $retrieveDataContentByGet;
     if ($retrieveDataContentByGet != true) {
         $this->dataContent = '';
     }
 }
예제 #9
0
 public function doFromObject($dbDataEntry, KalturaDetachedResponseProfile $responseProfile = null)
 {
     parent::doFromObject($dbDataEntry, $responseProfile);
     //$retrieveDataContentByGet = $dbDataEntry->getFromCustomData('retrieveDataContentByGet');
     $retrieveDataContentByGet = $dbDataEntry->getRetrieveDataContentByGet();
     if ($this->shouldGet('retrieveDataContentByGet', $responseProfile)) {
         $this->retrieveDataContentByGet = $retrieveDataContentByGet;
     }
     if ($retrieveDataContentByGet != true && $this->shouldGet('dataContent', $responseProfile)) {
         $this->dataContent = '';
     }
 }
예제 #10
0
 protected function prepareEntryForInsert(KalturaBaseEntry $entry, entry $dbEntry = null)
 {
     // first validate the input object
     //$entry->validatePropertyMinLength("name", 1);
     $entry->validatePropertyNotNull("documentType");
     $dbEntry = parent::prepareEntryForInsert($entry);
     if ($entry->conversionProfileId) {
         $dbEntry->setStatus(entryStatus::PRECONVERT);
     } else {
         $dbEntry->setStatus(entryStatus::READY);
     }
     $dbEntry->setDefaultModerationStatus();
     $dbEntry->save();
     return $dbEntry;
 }
예제 #11
0
 /**
  * @param KalturaBaseEntry $entry
  * @param entry $dbEntry
  * @return entry
  */
 protected function prepareEntryForInsert(KalturaBaseEntry $entry, entry $dbEntry = null)
 {
     // create a default name if none was given
     if (!$entry->name) {
         $entry->name = $this->getPartnerId() . '_' . time();
     }
     if ($entry->licenseType === null) {
         $entry->licenseType = KalturaLicenseType::UNKNOWN;
     }
     // first copy all the properties to the db entry, then we'll check for security stuff
     if (!$dbEntry) {
         $entryType = kPluginableEnumsManager::apiToCore('entryType', $entry->type);
         $class = entryPeer::getEntryClassByType($entryType);
         KalturaLog::debug("Creating new entry of API type [{$entry->type}] core type [{$entryType}] class [{$class}]");
         $dbEntry = new $class();
     }
     $dbEntry = $entry->toInsertableObject($dbEntry);
     $this->checkAndSetValidUserInsert($entry, $dbEntry);
     $this->checkAdminOnlyInsertProperties($entry);
     $this->validateAccessControlId($entry);
     $this->validateEntryScheduleDates($entry, $dbEntry);
     $dbEntry->setPartnerId($this->getPartnerId());
     $dbEntry->setSubpId($this->getPartnerId() * 100);
     $dbEntry->setDefaultModerationStatus();
     return $dbEntry;
 }
예제 #12
0
 /**
  * @param KalturaBaseEntry $entry
  * @return entry
  */
 protected function prepareEntryForInsert(KalturaBaseEntry $entry)
 {
     // first validate the input object
     //$entry->validatePropertyMinLength("name", 1);
     $entry->validatePropertyNotNull("mediaType");
     $dbEntry = parent::prepareEntryForInsert($entry);
     if ($this->getConversionQualityFromRequest()) {
         $dbEntry->setConversionQuality($this->getConversionQualityFromRequest());
     }
     $kshow = $this->createDummyKShow();
     $kshowId = $kshow->getId();
     $dbEntry->setKshowId($kshowId);
     $dbEntry->save();
     return $dbEntry;
 }
예제 #13
0
 protected function prepareEntryForInsert(KalturaBaseEntry $entry, entry $dbEntry = null)
 {
     if (!$entry instanceof KalturaMediaEntry) {
         throw new KalturaAPIException(KalturaErrors::INVALID_ENTRY_TYPE, $entry->id, $entry->getType(), entryType::MEDIA_CLIP);
     }
     $entry->validatePropertyNotNull("mediaType");
     $conversionQuality = $this->getConversionQuality($entry);
     if (!is_null($conversionQuality)) {
         $entry->conversionQuality = $conversionQuality;
     }
     $dbEntry = parent::prepareEntryForInsert($entry, $dbEntry);
     $kshow = $this->createDummyKShow();
     $kshowId = $kshow->getId();
     $dbEntry->setKshowId($kshowId);
     $dbEntry->save();
     return $dbEntry;
 }
예제 #14
0
 public function fromObject($sourceObject)
 {
     if (!$sourceObject) {
         return;
     }
     parent::fromObject($sourceObject);
     $host = requestUtils::getHost();
     $this->executeUrl = myPlaylistUtils::toPlaylistUrl($sourceObject, $host);
     if ($this->playlistType == KalturaPlaylistType::DYNAMIC) {
         $this->playlistContentXmlToFilters();
     }
 }
 /**
  * Update the content resource associated with the entry.
  * 
  * @action updateContent
  * @param string $entryId Entry id to update
  * @param KalturaResource $resource Resource to be used to replace entry content
  * @param int $conversionProfileId The conversion profile id to be used on the entry
  * @return KalturaBaseEntry The updated entry
  * 
  * @throws KalturaErrors::ENTRY_ID_NOT_FOUND
  * @validateUser entry entryId edit
  */
 function updateContentAction($entryId, KalturaResource $resource, $conversionProfileId = null)
 {
     $dbEntry = entryPeer::retrieveByPK($entryId);
     if (!$dbEntry) {
         throw new KalturaAPIException(KalturaErrors::ENTRY_ID_NOT_FOUND, $entryId);
     }
     $baseEntry = new KalturaBaseEntry();
     $baseEntry->fromObject($dbEntry);
     switch ($dbEntry->getType()) {
         case entryType::MEDIA_CLIP:
             $service = new MediaService();
             $service->initService('media', 'media', $this->actionName);
             $service->replaceResource($resource, $dbEntry, $conversionProfileId);
             $baseEntry->fromObject($dbEntry);
             return $baseEntry;
         case entryType::MIX:
         case entryType::PLAYLIST:
         case entryType::DATA:
         case entryType::LIVE_STREAM:
         default:
             // TODO load from plugin manager other entry services such as document
             throw new KalturaAPIException(KalturaErrors::ENTRY_TYPE_NOT_SUPPORTED, $baseEntry->type);
     }
     return $baseEntry;
 }
 public function getMapBetweenObjects()
 {
     return array_merge(parent::getMapBetweenObjects(), self::$map_between_objects);
 }
예제 #17
0
 public function doFromObject($sourceObject, KalturaDetachedResponseProfile $responseProfile = null)
 {
     if (!$sourceObject) {
         return;
     }
     parent::doFromObject($sourceObject, $responseProfile);
     if ($this->shouldGet('executeUrl', $responseProfile)) {
         $this->executeUrl = myPlaylistUtils::toPlaylistUrl($sourceObject, requestUtils::getHost());
     }
     if ($this->shouldGet('filters', $responseProfile) && $this->playlistType == KalturaPlaylistType::DYNAMIC) {
         $this->playlistContentXmlToFilters();
     }
 }
예제 #18
0
 function addFromUploadedFile(KalturaBaseEntry $entry, $uploadTokenId, $type = -1)
 {
     $kparams = array();
     $this->client->addParam($kparams, "entry", $entry->toParams());
     $this->client->addParam($kparams, "uploadTokenId", $uploadTokenId);
     $this->client->addParam($kparams, "type", $type);
     $resultObject = $this->client->callService("baseentry", "addFromUploadedFile", $kparams);
     $this->client->throwExceptionIfError($resultObject);
     $this->client->validateObjectType($resultObject, "KalturaBaseEntry");
     return $resultObject;
 }
 function update($entryId, KalturaBaseEntry $baseEntry)
 {
     $kparams = array();
     $this->client->addParam($kparams, "entryId", $entryId);
     $this->client->addParam($kparams, "baseEntry", $baseEntry->toParams());
     $this->client->queueServiceActionCall("baseentry", "update", $kparams);
     if ($this->client->isMultiRequest()) {
         return null;
     }
     $resultObject = $this->client->doQueue();
     $this->client->throwExceptionIfError($resultObject);
     $this->client->validateObjectType($resultObject, "KalturaBaseEntry");
     return $resultObject;
 }
예제 #20
0
 function addFromUploadedFile(KalturaBaseEntry $entry, $uploadTokenId, $type = -1)
 {
     $kparams = array();
     $this->client->addParam($kparams, "entry", $entry->toParams());
     $this->client->addParam($kparams, "uploadTokenId", $uploadTokenId);
     $this->client->addParam($kparams, "type", $type);
     $this->client->queueServiceActionCall("baseentry", "addFromUploadedFile", $kparams);
     if ($this->client->isMultiRequest()) {
         return null;
     }
     $resultObject = $this->client->doQueue();
     $this->client->throwExceptionIfError($resultObject);
     $this->client->validateObjectType($resultObject, "KalturaBaseEntry");
     return $resultObject;
 }