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 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()); } $dbBatchJobLock = BatchJobLockPeer::retrieveByPK($jobId); $job = new KalturaBatchJob(); $job->fromBatchJob($dbBatchJob, $dbBatchJobLock); $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; }
/** * 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->fromBatchJob($dbBatchJob); }