public static function fromBatchJobArray($arr)
 {
     $newArr = new KalturaBatchJobArray();
     if (is_array($arr)) {
         foreach ($arr as $obj) {
             $nObj = new KalturaBatchJob();
             $nObj->fromObject($obj);
             $newArr[] = $nObj;
         }
     }
     return $newArr;
 }
コード例 #2
0
 /**
  * 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);
 }
コード例 #3
0
 /**
  * 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);
 }
コード例 #4
0
 /**
  * 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);
 }
コード例 #5
0
 /**
  * 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;
 }
コード例 #6
0
 /**
  * batch updateExclusiveTransformMetadataJob action updates a BatchJob of type METADATA_TRANSFORM that was claimed using the getExclusiveTransformMetadataJobs
  * 
  * @action updateExclusiveTransformMetadataJob
  * @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 updateExclusiveTransformMetadataJobAction($id, KalturaExclusiveLockKey $lockKey, KalturaBatchJob $job)
 {
     $dbBatchJob = BatchJobPeer::retrieveByPK($id);
     // verifies that the job is of the right type
     if ($dbBatchJob->getJobType() != KalturaBatchJobType::METADATA_TRANSFORM) {
         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);
 }