public static function fromDbArray($arr)
 {
     $newArr = new KalturaDropFolderFileArray();
     foreach ($arr as $obj) {
         $nObj = new KalturaDropFolderFile();
         $nObj->fromObject($obj);
         $newArr[] = $nObj;
     }
     return $newArr;
 }
 public function toObject($dbObject = null, $skip = array())
 {
     if (!$dbObject) {
         $dbObject = new WebexDropFolderFile();
     }
     return parent::toObject($dbObject, $skip);
 }
 public static function fromDbArray($arr, KalturaDetachedResponseProfile $responseProfile = null)
 {
     $newArr = new KalturaDropFolderFileArray();
     foreach ($arr as $obj) {
         $nObj = KalturaDropFolderFile::getInstanceByType($obj->getType());
         $nObj->fromObject($obj, $responseProfile);
         $newArr[] = $nObj;
     }
     return $newArr;
 }
 /**
  * Set the KalturaDropFolderFile status to ignore (KalturaDropFolderFileStatus::IGNORE)
  * 
  * @action ignore
  * @param int $dropFolderFileId 
  * @return KalturaDropFolderFile
  *
  * @throws KalturaErrors::INVALID_OBJECT_ID
  */
 public function ignoreAction($dropFolderFileId)
 {
     $dbDropFolderFile = DropFolderFilePeer::retrieveByPK($dropFolderFileId);
     if (!$dbDropFolderFile) {
         throw new KalturaAPIException(KalturaErrors::INVALID_OBJECT_ID, $dropFolderFileId);
     }
     $dbDropFolderFile->setStatus(DropFolderFileStatus::IGNORE);
     $dbDropFolderFile->save();
     $dropFolderFile = new KalturaDropFolderFile();
     $dropFolderFile->fromObject($dbDropFolderFile);
     return $dropFolderFile;
 }
 function update($dropFolderFileId, KalturaDropFolderFile $dropFolderFile)
 {
     $kparams = array();
     $this->client->addParam($kparams, "dropFolderFileId", $dropFolderFileId);
     $this->client->addParam($kparams, "dropFolderFile", $dropFolderFile->toParams());
     $this->client->queueServiceActionCall("dropfolder_dropfolderfile", "update", $kparams);
     if ($this->client->isMultiRequest()) {
         return $this->client->getMultiRequestResult();
     }
     $resultObject = $this->client->doQueue();
     $this->client->throwExceptionIfError($resultObject);
     $this->client->validateObjectType($resultObject, "KalturaDropFolderFile");
     return $resultObject;
 }
Esempio n. 6
0
 private function newFileAddedOrDetected(KalturaDropFolderFile $dropFolderFile, $fileStatus)
 {
     // check for required parameters
     $dropFolderFile->validatePropertyNotNull('dropFolderId');
     $dropFolderFile->validatePropertyNotNull('fileName');
     $dropFolderFile->validatePropertyMinValue('fileSize', 0);
     // check that drop folder id exists in the system
     $dropFolder = DropFolderPeer::retrieveByPK($dropFolderFile->dropFolderId);
     if (!$dropFolder) {
         throw new KalturaAPIException(KalturaDropFolderErrors::DROP_FOLDER_NOT_FOUND, $dropFolderFile->dropFolderId);
     }
     // save in database
     $dropFolderFile->status = null;
     $dbDropFolderFile = $dropFolderFile->toInsertableObject();
     /* @var $dbDropFolderFile DropFolderFile  */
     $dbDropFolderFile->setPartnerId($dropFolder->getPartnerId());
     $dbDropFolderFile->setStatus($fileStatus);
     $dbDropFolderFile->setType($dropFolder->getType());
     try {
         $dbDropFolderFile->save();
     } catch (PropelException $e) {
         if ($e->getCause() && $e->getCause()->getCode() == self::MYSQL_CODE_DUPLICATE_KEY) {
             $existingDropFolderFile = DropFolderFilePeer::retrieveByDropFolderIdAndFileName($dropFolderFile->dropFolderId, $dropFolderFile->fileName);
             switch ($existingDropFolderFile->getStatus()) {
                 case DropFolderFileStatus::PARSED:
                     KalturaLog::info('Exisiting file status is PARSED, updating status to [' . $fileStatus . ']');
                     $existingDropFolderFile = $dropFolderFile->toUpdatableObject($existingDropFolderFile);
                     $existingDropFolderFile->setStatus($fileStatus);
                     $existingDropFolderFile->save();
                     $dbDropFolderFile = $existingDropFolderFile;
                     break;
                 case DropFolderFileStatus::DETECTED:
                     KalturaLog::info('Exisiting file status is DETECTED, updating status to [' . $fileStatus . ']');
                     $existingDropFolderFile = $dropFolderFile->toUpdatableObject($existingDropFolderFile);
                     if ($existingDropFolderFile->getStatus() != $fileStatus) {
                         $existingDropFolderFile->setStatus($fileStatus);
                     }
                     $existingDropFolderFile->save();
                     $dbDropFolderFile = $existingDropFolderFile;
                     break;
                 case DropFolderFileStatus::UPLOADING:
                     if ($fileStatus == DropFolderFileStatus::UPLOADING) {
                         KalturaLog::log('Exisiting file status is UPLOADING, updating properties');
                         $existingDropFolderFile = $dropFolderFile->toUpdatableObject($existingDropFolderFile);
                         $existingDropFolderFile->save();
                         $dbDropFolderFile = $existingDropFolderFile;
                         break;
                     }
                 default:
                     KalturaLog::log('Setting current file to PURGED [' . $existingDropFolderFile->getId() . ']');
                     $existingDropFolderFile->setStatus(DropFolderFileStatus::PURGED);
                     $existingDropFolderFile->save();
                     $newDropFolderFile = $dbDropFolderFile->copy();
                     if ($existingDropFolderFile->getLeadDropFolderFileId() && $existingDropFolderFile->getLeadDropFolderFileId() != $existingDropFolderFile->getId()) {
                         KalturaLog::info('Updating lead id [' . $existingDropFolderFile->getLeadDropFolderFileId() . ']');
                         $newDropFolderFile->setLeadDropFolderFileId($existingDropFolderFile->getLeadDropFolderFileId());
                     }
                     $newDropFolderFile->save();
                     $dbDropFolderFile = $newDropFolderFile;
             }
         } else {
             throw $e;
         }
     }
     // return the saved object
     $dropFolderFile = KalturaDropFolderFile::getInstanceByType($dbDropFolderFile->getType());
     $dropFolderFile->fromObject($dbDropFolderFile, $this->getResponseProfile());
     return $dropFolderFile;
 }