public static function fromBatchJobArray($arr)
 {
     $newArr = new KalturaBatchJobArray();
     if (is_array($arr)) {
         foreach ($arr as $obj) {
             $nObj = new KalturaBatchJob();
             $nObj->fromBatchJob($obj);
             $newArr[] = $nObj;
         }
     }
     return $newArr;
 }
 /**
  * batch updateExclusiveVirusScanJob action updates a BatchJob of type VIRUS_SCAN that was claimed using the getExclusiveVirusScanJobs
  * 
  * @action updateExclusiveVirusScanJob
  * @param int $id The id of the job to free
  * @param KalturaExclusiveLockKey $lockKey The unique lock key from the batch-process. Is used for the locking mechanism  
  * @param KalturaBatchJob $job
  * @return KalturaBatchJob 
  */
 function updateExclusiveVirusScanJobAction($id, KalturaExclusiveLockKey $lockKey, KalturaBatchJob $job)
 {
     $dbBatchJob = BatchJobPeer::retrieveByPK($id);
     // verifies that the job is of the right type
     $jobType = VirusScanPlugin::getBatchJobTypeCoreValue(VirusScanBatchJobType::VIRUS_SCAN);
     if ($dbBatchJob->getJobType() != $jobType) {
         throw new KalturaAPIException(APIErrors::UPDATE_EXCLUSIVE_JOB_WRONG_TYPE, $id, serialize($lockKey), serialize($job));
     }
     $dbBatchJob = kBatchManager::updateExclusiveBatchJob($id, $lockKey->toObject(), $job->toObject($dbBatchJob));
     $batchJob = new KalturaBatchJob();
     // start from blank
     return $batchJob->fromObject($dbBatchJob);
 }
 /**
  * batch updateExclusiveFileSyncImportJob action updates a BatchJob of type FILESYNC_IMPORT that was claimed using the getExclusiveFileSyncImportJobs
  * 
  * @action updateExclusiveFileSyncImportJob
  * @param int $id The id of the job to free
  * @param KalturaExclusiveLockKey $lockKey The unique lock key from the batch-process. Is used for the locking mechanism  
  * @param KalturaBatchJob $job
  * @return KalturaBatchJob 
  */
 function updateExclusiveFileSyncImportJobAction($id, KalturaExclusiveLockKey $lockKey, KalturaBatchJob $job)
 {
     $dbBatchJob = BatchJobPeer::retrieveByPK($id);
     // verifies that the job is of the right type
     if ($dbBatchJob->getJobType() != KalturaBatchJobType::FILESYNC_IMPORT) {
         throw new KalturaAPIException(APIErrors::UPDATE_EXCLUSIVE_JOB_WRONG_TYPE, $id, serialize($lockKey), serialize($job));
     }
     $dbBatchJob = kBatchManager::updateExclusiveBatchJob($id, $lockKey->toObject(), $job->toObject($dbBatchJob));
     $batchJob = new KalturaBatchJob();
     // start from blank
     return $batchJob->fromObject($dbBatchJob);
 }
 function updateExclusiveJob($id, KalturaExclusiveLockKey $lockKey, KalturaBatchJob $job)
 {
     $kparams = array();
     $this->client->addParam($kparams, "id", $id);
     $this->client->addParam($kparams, "lockKey", $lockKey->toParams());
     $this->client->addParam($kparams, "job", $job->toParams());
     $this->client->queueServiceActionCall("metadata_metadatabatch", "updateExclusiveJob", $kparams);
     if ($this->client->isMultiRequest()) {
         return null;
     }
     $resultObject = $this->client->doQueue();
     $this->client->throwExceptionIfError($resultObject);
     $this->client->validateObjectType($resultObject, "KalturaBatchJob");
     return $resultObject;
 }
 function addBatchJob(KalturaBatchJob $batchJob)
 {
     $kparams = array();
     $this->client->addParam($kparams, "batchJob", $batchJob->toParams());
     $this->client->queueServiceActionCall("jobs", "addBatchJob", $kparams);
     if ($this->client->isMultiRequest()) {
         return null;
     }
     $resultObject = $this->client->doQueue();
     $this->client->throwExceptionIfError($resultObject);
     $this->client->validateObjectType($resultObject, "KalturaBatchJob");
     return $resultObject;
 }
 /**
  * batch updateExclusiveDistributionFetchReportJob action updates a BatchJob of type DISTRIBUTION_FETCH_REPORT that was claimed using the getExclusiveDistributionFetchReportJobs
  * 
  * @action updateExclusiveDistributionFetchReportJob
  * @param int $id The id of the job to free
  * @param KalturaExclusiveLockKey $lockKey The unique lock key from the batch-process. Is used for the locking mechanism  
  * @param KalturaBatchJob $job
  * @return KalturaBatchJob 
  */
 function updateExclusiveDistributionFetchReportJobAction($id, KalturaExclusiveLockKey $lockKey, KalturaBatchJob $job)
 {
     $dbBatchJob = BatchJobPeer::retrieveByPK($id);
     // verifies that the job is of the right type
     $jobType = ContentDistributionPlugin::getBatchJobTypeCoreValue(ContentDistributionBatchJobType::DISTRIBUTION_FETCH_REPORT);
     if ($dbBatchJob->getJobType() != $jobType) {
         throw new KalturaAPIException(APIErrors::UPDATE_EXCLUSIVE_JOB_WRONG_TYPE, $id, serialize($lockKey), serialize($job));
     }
     $dbBatchJob = kBatchManager::updateExclusiveBatchJob($id, $lockKey->toObject(), $job->toObject($dbBatchJob));
     $batchJob = new KalturaBatchJob();
     // start from blank
     return $batchJob->fromObject($dbBatchJob);
 }
 /**
  * batch updateExclusiveJobAction action updates a BatchJob of extended type that was claimed using the getExclusiveJobs
  * 
  * @action updateExclusiveJob
  * @param int $id The id of the job to free
  * @param KalturaExclusiveLockKey $lockKey The unique lock key from the batch-process. Is used for the locking mechanism  
  * @param KalturaBatchJob $job
  * @return KalturaBatchJob 
  */
 function updateExclusiveJobAction($id, KalturaExclusiveLockKey $lockKey, KalturaBatchJob $job)
 {
     $dbBatchJob = BatchJobPeer::retrieveByPK($id);
     $dbBatchJob = kBatchManager::updateExclusiveBatchJob($id, $lockKey->toObject(), $job->toObject($dbBatchJob));
     $batchJob = new KalturaBatchJob();
     // start from blank
     return $batchJob->fromObject($dbBatchJob);
 }
 /**
  * batch getStatusAction returns the status of task
  * 
  * @action getStatus
  * @param int $jobId the id of the job  
  * @param KalturaBatchJobType $jobType the type of the job
  * @param KalturaFilterPager $pager pager for the child jobs  
  * @return KalturaBatchJobResponse 
  */
 function getStatusAction($jobId, $jobType, KalturaFilterPager $pager = null)
 {
     $dbJobType = kPluginableEnumsManager::apiToCore('BatchJobType', $jobType);
     $dbBatchJob = BatchJobPeer::retrieveByPK($jobId);
     if ($dbBatchJob->getJobType() != $dbJobType) {
         throw new KalturaAPIException(APIErrors::GET_EXCLUSIVE_JOB_WRONG_TYPE, $jobType, $dbBatchJob->getId());
     }
     $job = new KalturaBatchJob();
     $job->fromObject($dbBatchJob);
     $batchJobResponse = new KalturaBatchJobResponse();
     $batchJobResponse->batchJob = $job;
     if (!$pager) {
         $pager = new KalturaFilterPager();
     }
     $c = new Criteria();
     $pager->attachToCriteria($c);
     $childBatchJobs = $dbBatchJob->getChildJobs($c);
     $batchJobResponse->childBatchJobs = KalturaBatchJobArray::fromBatchJobArray($childBatchJobs);
     return $batchJobResponse;
 }
Exemple #9
0
 function updateExclusivePreConvertJob($id, $processorLocation, $pocessorName, KalturaBatchJob $preConvertJob, $entryStatus = null)
 {
     $kparams = array();
     $this->client->addParam($kparams, "id", $id);
     $this->client->addParam($kparams, "processorLocation", $processorLocation);
     $this->client->addParam($kparams, "pocessorName", $pocessorName);
     $this->client->addParam($kparams, "preConvertJob", $preConvertJob->toParams());
     $this->client->addParam($kparams, "entryStatus", $entryStatus);
     $this->client->queueServiceActionCall("batch", "updateExclusivePreConvertJob", $kparams);
     if ($this->client->isMultiRequest()) {
         return null;
     }
     $resultObject = $this->client->doQueue();
     $this->client->throwExceptionIfError($resultObject);
     $this->client->validateObjectType($resultObject, "KalturaBatchJob");
     return $resultObject;
 }
 private function updateJob(KalturaBatchJob $job)
 {
     $dbJob = BatchJobPeer::retrieveByPK($job->id);
     $dbJob = $job->toObject($dbJob);
     $dbJob->save();
 }