/** * @param kBatchJobStatusEventConsumer $consumer * @return bool true if should continue to the next consumer */ protected function doConsume(KalturaEventConsumer $consumer) { if (!$consumer->shouldConsumeJobStatusEvent($this->dbBatchJob)) { return true; } KalturaLog::debug(get_class($this) . " event consumed by " . get_class($consumer) . " job id [" . $this->dbBatchJob->getId() . "] type [" . $this->dbBatchJob->getJobType() . "] sub type [" . $this->dbBatchJob->getJobSubType() . "] status [" . $this->dbBatchJob->getStatus() . "]"); return $consumer->updatedJob($this->dbBatchJob, $this->twinJob); }
/** * @param kBatchJobStatusEventConsumer $consumer * @return bool true if should continue to the next consumer */ protected function doConsume(KalturaEventConsumer $consumer) { if (!$consumer->shouldConsumeJobStatusEvent($this->dbBatchJob)) { return true; } KalturaLog::debug('consumer [' . get_class($consumer) . '] started handling [' . get_class($this) . '] job id [' . $this->dbBatchJob->getId() . '] type [' . $this->dbBatchJob->getJobType() . '] sub type [' . $this->dbBatchJob->getJobSubType() . '] status [' . $this->dbBatchJob->getStatus() . ']'); $result = $consumer->updatedJob($this->dbBatchJob); KalturaLog::debug('consumer [' . get_class($consumer) . '] finished handling [' . get_class($this) . '] job id [' . $this->dbBatchJob->getId() . '] type [' . $this->dbBatchJob->getJobType() . '] sub type [' . $this->dbBatchJob->getJobSubType() . '] status [' . $this->dbBatchJob->getStatus() . ']'); return $result; }
public function shouldConsumeJobStatusEvent(BatchJob $dbBatchJob) { if ($dbBatchJob->getJobType() == ContentDistributionPlugin::getBatchJobTypeCoreValue(ContentDistributionBatchJobType::DISTRIBUTION_FETCH_REPORT)) { return true; } return false; }
public function shouldConsumeJobStatusEvent(BatchJob $dbBatchJob) { if ($dbBatchJob->getJobType() == BatchJobType::FILESYNC_IMPORT) { return true; } return false; }
public function shouldConsumeJobStatusEvent(BatchJob $dbBatchJob) { if ($dbBatchJob->getJobType() == BatchJobType::METADATA_TRANSFORM) { return true; } return false; }
public function shouldConsumeJobStatusEvent(BatchJob $dbBatchJob) { if ($dbBatchJob->getJobType() == IntegrationPlugin::getBatchJobTypeCoreValue(IntegrationBatchJobType::INTEGRATION) && $dbBatchJob->getStatus() == BatchJob::BATCHJOB_STATUS_DONT_PROCESS && $dbBatchJob->getData()->getTriggerType() == BpmEventNotificationIntegrationPlugin::getIntegrationTriggerCoreValue(BpmEventNotificationIntegrationTrigger::BPM_EVENT_NOTIFICATION)) { return true; } return false; }
public function shouldConsumeJobStatusEvent(BatchJob $dbBatchJob) { if ($dbBatchJob->getJobType() != IntegrationPlugin::getBatchJobTypeCoreValue(IntegrationBatchJobType::INTEGRATION)) { return false; } $closedStatusList = array(BatchJob::BATCHJOB_STATUS_FINISHED, BatchJob::BATCHJOB_STATUS_FAILED, BatchJob::BATCHJOB_STATUS_ABORTED, BatchJob::BATCHJOB_STATUS_FATAL, BatchJob::BATCHJOB_STATUS_FINISHED_PARTIALLY); return in_array($dbBatchJob->getStatus(), $closedStatusList); }
public function shouldConsumeJobStatusEvent(BatchJob $dbBatchJob) { // consume import jobs with data of type kDropFolderImportJobData if ($dbBatchJob->getJobType() == BatchJobType::IMPORT && get_class($dbBatchJob->getData()) == 'kDropFolderImportJobData') { return true; } return false; }
/** * @param BatchJob $dbBatchJob * @return bool true if the consumer should handle the event */ public function shouldConsumeJobStatusEvent(BatchJob $dbBatchJob) { $jobType = ScheduledTaskPlugin::getBatchJobTypeCoreValue(ScheduledTaskBatchType::SCHEDULED_TASK); if ($dbBatchJob->getJobType() == $jobType) { return true; } return false; }
public function shouldConsumeJobStatusEvent(BatchJob $dbBatchJob) { $jobTypes = array(ContentDistributionPlugin::getBatchJobTypeCoreValue(ContentDistributionBatchJobType::DISTRIBUTION_SUBMIT), ContentDistributionPlugin::getBatchJobTypeCoreValue(ContentDistributionBatchJobType::DISTRIBUTION_UPDATE)); if (in_array($dbBatchJob->getJobType(), $jobTypes)) { return true; } return false; }
public function shouldConsumeJobStatusEvent(BatchJob $dbBatchJob) { if ($dbBatchJob->getJobType() == BatchJobType::STORAGE_EXPORT && $dbBatchJob->getJobSubType() == KontikiPlugin::getStorageProfileProtocolCoreValue(KontikiStorageProfileProtocol::KONTIKI)) { if (KontikiPlugin::isAllowedPartner($dbBatchJob->getPartnerId())) { return true; } } return false; }
public function shouldConsumeJobStatusEvent(BatchJob $dbBatchJob) { if ($dbBatchJob->getStatus() == BatchJob::BATCHJOB_STATUS_FAILED) { $parseMultiBatchJobType = CaptionPlugin::getBatchJobTypeCoreValue(ParseMultiLanguageCaptionAssetBatchType::PARSE_MULTI_LANGUAGE_CAPTION_ASSET); if ($dbBatchJob->getJobType() == $parseMultiBatchJobType) { return true; } } return false; }
public function shouldConsumeJobStatusEvent(BatchJob $dbBatchJob) { if (in_array($dbBatchJob->getStatus(), array(BatchJob::BATCHJOB_STATUS_FAILED, BatchJob::BATCHJOB_STATUS_DONT_PROCESS, BatchJob::BATCHJOB_STATUS_FINISHED)) && $dbBatchJob->getJobType() == IntegrationPlugin::getBatchJobTypeCoreValue(IntegrationBatchJobType::INTEGRATION)) { $providerType = $dbBatchJob->getJobSubType(); if ($providerType == VoicebasePlugin::getProviderTypeCoreValue(VoicebaseIntegrationProviderType::VOICEBASE)) { return true; } } return false; }
/** * @param BatchJob $dbBatchJob * @param BatchJob $twinJob * @return bool true if should continue to the next consumer */ public function updatedJob(BatchJob $dbBatchJob, BatchJob $twinJob = null) { switch ($dbBatchJob->getJobType()) { case BatchJobType::FILESYNC_IMPORT: $dbBatchJob = $this->updatedFileSyncImport($dbBatchJob, $dbBatchJob->getData(), $twinJob); break; default: break; } return true; }
public function shouldConsumeJobStatusEvent(BatchJob $dbBatchJob) { try { $jobObjectType = DropFolderXmlBulkUploadPlugin::getBatchJobObjectTypeCoreValue(DropFolderBatchJobObjectType::DROP_FOLDER_FILE); $jobStatuses = array(BatchJob::BATCHJOB_STATUS_FINISHED, BatchJob::BATCHJOB_STATUS_FINISHED_PARTIALLY, BatchJob::BATCHJOB_STATUS_FAILED, BatchJob::BATCHJOB_STATUS_FATAL, BatchJob::BATCHJOB_STATUS_QUEUED); $isMatch = $dbBatchJob->getJobType() == BatchJobType::BULKUPLOAD && $dbBatchJob->getObjectType() == $jobObjectType && in_array($dbBatchJob->getStatus(), $jobStatuses); return $isMatch; } catch (Exception $e) { KalturaLog::err('Failed to process shouldConsumeJobStatusEvent - ' . $e->getMessage()); } return false; }
public function shouldConsumeJobStatusEvent(BatchJob $dbBatchJob) { if ($dbBatchJob->getJobType() != EventNotificationPlugin::getBatchJobTypeCoreValue(EventNotificationBatchType::EVENT_NOTIFICATION_HANDLER)) { return false; } if ($dbBatchJob->getJobSubType() != BusinessProcessNotificationPlugin::getBusinessProcessNotificationTemplateTypeCoreValue(BusinessProcessNotificationTemplateType::BPM_START)) { return false; } if ($dbBatchJob->getStatus() != BatchJob::BATCHJOB_STATUS_FINISHED) { return false; } return true; }
/** * @param BaseObject $object * @param BatchJob $raisedJob */ public function __construct(BaseObject $object, BatchJob $raisedJob = null) { $this->object = $object; $this->raisedJob = $raisedJob; $additionalLog = ''; if (method_exists($object, 'getId')) { $additionalLog .= ' id [' . $object->getId() . ']'; } if ($raisedJob) { $additionalLog .= ' raised job id [' . $raisedJob->getId() . '] of type [' . $raisedJob->getJobType() . ']'; } KalturaLog::debug("Event [" . get_class($this) . "] object type [" . get_class($object) . "]" . $additionalLog); }
/** * @param BatchJob $dbBatchJob * @param BatchJob $twinJob * @return bool true if should continue to the next consumer */ public function updatedJob(BatchJob $dbBatchJob, BatchJob $twinJob = null) { switch ($dbBatchJob->getJobType()) { case BatchJobType::METADATA_IMPORT: $dbBatchJob = $this->updatedImportMetadata($dbBatchJob, $dbBatchJob->getData(), $twinJob); break; case BatchJobType::METADATA_TRANSFORM: $dbBatchJob = $this->updatedTransformMetadata($dbBatchJob, $dbBatchJob->getData(), $twinJob); break; default: break; } return true; }
public function updatedJob(BatchJob $dbBatchJob, BatchJob $twinJob = null) { $data = $dbBatchJob->getData(); if (!$data instanceof kDistributionJobData) { return true; } $attUverseCoreValueType = kPluginableEnumsManager::apiToCore('DistributionProviderType', AttUverseDistributionPlugin::getApiValue(AttUverseDistributionProviderType::ATT_UVERSE)); if ($data->getProviderType() != $attUverseCoreValueType) { return true; } $jobTypesToFinish = array(ContentDistributionPlugin::getBatchJobTypeCoreValue(ContentDistributionBatchJobType::DISTRIBUTION_SUBMIT), ContentDistributionPlugin::getBatchJobTypeCoreValue(ContentDistributionBatchJobType::DISTRIBUTION_UPDATE)); if (in_array($dbBatchJob->getJobType(), $jobTypesToFinish) && $dbBatchJob->getStatus() == BatchJob::BATCHJOB_STATUS_FINISHED) { return self::onDistributionJobFinished($dbBatchJob, $data, $twinJob); } if ($dbBatchJob->getJobType() == ContentDistributionPlugin::getBatchJobTypeCoreValue(ContentDistributionBatchJobType::DISTRIBUTION_DELETE) && $dbBatchJob->getStatus() == BatchJob::BATCHJOB_STATUS_PENDING) { kJobsManager::updateBatchJob($dbBatchJob, BatchJob::BATCHJOB_STATUS_FINISHED); } return true; }
public function shouldConsumeJobStatusEvent(BatchJob $dbBatchJob) { $jobTypes = array(ContentDistributionPlugin::getBatchJobTypeCoreValue(ContentDistributionBatchJobType::DISTRIBUTION_SUBMIT), ContentDistributionPlugin::getBatchJobTypeCoreValue(ContentDistributionBatchJobType::DISTRIBUTION_UPDATE)); if (!in_array($dbBatchJob->getJobType(), $jobTypes)) { // wrong job type return false; } $data = $dbBatchJob->getData(); if (!$data instanceof kDistributionJobData) { KalturaLog::err('Wrong job data type'); return false; } $crossKalturaCoreValueType = kPluginableEnumsManager::apiToCore('DistributionProviderType', CrossKalturaDistributionPlugin::getApiValue(CrossKalturaDistributionProviderType::CROSS_KALTURA)); if ($data->getProviderType() == $crossKalturaCoreValueType) { return true; } // not the right provider return false; }
public function updatedJob(BatchJob $dbBatchJob) { $data = $dbBatchJob->getData(); if (!$data instanceof kDistributionJobData) { return true; } $doubleClickCoreValueType = kPluginableEnumsManager::apiToCore('DistributionProviderType', DoubleClickDistributionPlugin::getApiValue(DoubleClickDistributionProviderType::DOUBLECLICK)); if ($data->getProviderType() != $doubleClickCoreValueType) { return true; } if ($dbBatchJob->getStatus() != BatchJob::BATCHJOB_STATUS_PENDING) { return true; } $jobTypesToFinish = array(ContentDistributionPlugin::getBatchJobTypeCoreValue(ContentDistributionBatchJobType::DISTRIBUTION_SUBMIT), ContentDistributionPlugin::getBatchJobTypeCoreValue(ContentDistributionBatchJobType::DISTRIBUTION_UPDATE), ContentDistributionPlugin::getBatchJobTypeCoreValue(ContentDistributionBatchJobType::DISTRIBUTION_DELETE), ContentDistributionPlugin::getBatchJobTypeCoreValue(ContentDistributionBatchJobType::DISTRIBUTION_FETCH_REPORT), ContentDistributionPlugin::getBatchJobTypeCoreValue(ContentDistributionBatchJobType::DISTRIBUTION_ENABLE), ContentDistributionPlugin::getBatchJobTypeCoreValue(ContentDistributionBatchJobType::DISTRIBUTION_DISABLE)); if (in_array($dbBatchJob->getJobType(), $jobTypesToFinish)) { kJobsManager::updateBatchJob($dbBatchJob, BatchJob::BATCHJOB_STATUS_FINISHED); } return true; }
/** * @param BatchJob $dbBatchJob * @param BatchJob $twinJob */ public function updatedJob(BatchJob $dbBatchJob, BatchJob $twinJob = null) { if ($dbBatchJob->getJobType() == ContentDistributionPlugin::getBatchJobTypeCoreValue(ContentDistributionBatchJobType::DISTRIBUTION_SUBMIT)) { self::onDistributionSubmitJobUpdated($dbBatchJob, $dbBatchJob->getData(), $twinJob); } if ($dbBatchJob->getJobType() == ContentDistributionPlugin::getBatchJobTypeCoreValue(ContentDistributionBatchJobType::DISTRIBUTION_UPDATE)) { self::onDistributionUpdateJobUpdated($dbBatchJob, $dbBatchJob->getData(), $twinJob); } if ($dbBatchJob->getJobType() == ContentDistributionPlugin::getBatchJobTypeCoreValue(ContentDistributionBatchJobType::DISTRIBUTION_DELETE)) { self::onDistributionDeleteJobUpdated($dbBatchJob, $dbBatchJob->getData(), $twinJob); } if ($dbBatchJob->getJobType() == ContentDistributionPlugin::getBatchJobTypeCoreValue(ContentDistributionBatchJobType::DISTRIBUTION_FETCH_REPORT)) { self::onDistributionFetchReportJobUpdated($dbBatchJob, $dbBatchJob->getData(), $twinJob); } if ($dbBatchJob->getJobType() == ContentDistributionPlugin::getBatchJobTypeCoreValue(ContentDistributionBatchJobType::DISTRIBUTION_ENABLE)) { self::onDistributionEnableJobUpdated($dbBatchJob, $dbBatchJob->getData(), $twinJob); } if ($dbBatchJob->getJobType() == ContentDistributionPlugin::getBatchJobTypeCoreValue(ContentDistributionBatchJobType::DISTRIBUTION_DISABLE)) { self::onDistributionDisableJobUpdated($dbBatchJob, $dbBatchJob->getData(), $twinJob); } return true; }
public function updatedJob(BatchJob $dbBatchJob, BatchJob $twinJob = null) { if ($dbBatchJob->getStatus() != BatchJob::BATCHJOB_STATUS_PENDING) { return true; } if ($dbBatchJob->getJobType() == BatchJobType::PROVISION_PROVIDE) { $entry = $dbBatchJob->getEntry(false, false); $partner = $entry->getPartner(); $limeLightLiveParamsJSON = $partner->getLiveStreamProvisionParams(); $limeLightLiveParams = json_decode($limeLightLiveParamsJSON); if (!isset($limeLightLiveParams->Limelight) || !isset($limeLightLiveParams->Limelight->limelightPrimaryPublishUrl) || !isset($limeLightLiveParams->Limelight->limelightSecondaryPublishUrl) || !isset($limeLightLiveParams->Limelight->limelightStreamUrl)) { kJobsManager::updateBatchJob($dbBatchJob, BatchJob::BATCHJOB_STATUS_FAILED); return true; } $data = $dbBatchJob->getData(); $data->setPrimaryBroadcastingUrl($limeLightLiveParams->Limelight->limelightPrimaryPublishUrl); $data->setSecondaryBroadcastingUrl($limeLightLiveParams->Limelight->limelightSecondaryPublishUrl); $data->setRtmp($limeLightLiveParams->Limelight->limelightStreamUrl); $data->setStreamName($entry->getId() . '_%i'); $dbBatchJob->setData($data); } kJobsManager::updateBatchJob($dbBatchJob, BatchJob::BATCHJOB_STATUS_FINISHED); return true; }
private function isContentProcessorMatch(BatchJob $dbBatchJob) { $batchJobType = DropFolderPlugin::getCoreValue('BatchJobType', DropFolderBatchType::DROP_FOLDER_CONTENT_PROCESSOR); $jobStatuses = array(BatchJob::BATCHJOB_STATUS_FAILED, BatchJob::BATCHJOB_STATUS_RETRY, BatchJob::BATCHJOB_STATUS_FATAL); $isMatch = $dbBatchJob->getJobType() == $batchJobType && in_array($dbBatchJob->getStatus(), $jobStatuses); return $isMatch; }
public function shouldConsumeJobStatusEvent(BatchJob $dbBatchJob) { $jobType = $dbBatchJob->getJobType(); $data = $dbBatchJob->getData(); // copy cue points only if it's the first file and this is the primary server if ($jobType == BatchJobType::CONVERT_LIVE_SEGMENT && $dbBatchJob->getStatus() == BatchJob::BATCHJOB_STATUS_FINISHED && $data->getFileIndex() == 0 && $data->getMediaServerIndex() == MediaServerIndex::PRIMARY) { $asset = assetPeer::retrieveByIdNoFilter($data->getAssetId()); if ($asset->hasTag(assetParams::TAG_RECORDING_ANCHOR)) { return true; } } elseif ($jobType == BatchJobType::CONCAT && $dbBatchJob->getStatus() == BatchJob::BATCHJOB_STATUS_FINISHED) { $convertLiveSegmentJobData = $dbBatchJob->getParentJob()->getData(); $asset = assetPeer::retrieveByIdNoFilter($convertLiveSegmentJobData->getAssetId()); if ($asset->hasTag(assetParams::TAG_RECORDING_ANCHOR)) { return true; } } return false; }
/** * @param BatchJob $dbBatchJob * @param BatchJob $twinJob * @return bool true if should continue to the next consumer */ public function updatedJob(BatchJob $dbBatchJob, BatchJob $twinJob = null) { // virus scan only works in api_v3 context because it uses dynamic enums if (!class_exists('kCurrentContext') || !kCurrentContext::isApiV3Context()) { return true; } if ($dbBatchJob->getJobType() == VirusScanPlugin::getBatchJobTypeCoreValue(VirusScanBatchJobType::VIRUS_SCAN)) { $dbBatchJob = $this->updatedVirusScan($dbBatchJob, $dbBatchJob->getData(), $twinJob); } return true; }
public function shouldConsumeJobStatusEvent(BatchJob $dbBatchJob) { if (!class_exists('kCurrentContext') || !kCurrentContext::isApiV3Context()) { return false; } if ($dbBatchJob->getJobType() == VirusScanPlugin::getBatchJobTypeCoreValue(VirusScanBatchJobType::VIRUS_SCAN)) { return true; } return false; }
/** * @param BatchJob $parentJob * @param int $postConvertAssetType * @param string $srcFileSyncLocalPath * @param int $flavorAssetId * @param int $flavorParamsOutputId * @param bool $createThumb * @param int $thumbOffset * @param string $customData * @return BatchJob */ public static function addPostConvertJob(BatchJob $parentJob = null, $postConvertAssetType, $srcFileSyncLocalPath, $flavorAssetId, $flavorParamsOutputId, $createThumb = false, $thumbOffset = 3) { $postConvertData = new kPostConvertJobData(); $postConvertData->setPostConvertAssetType($postConvertAssetType); $postConvertData->setSrcFileSyncLocalPath($srcFileSyncLocalPath); $postConvertData->setFlavorParamsOutputId($flavorParamsOutputId); $postConvertData->setFlavorAssetId($flavorAssetId); $postConvertData->setThumbOffset($thumbOffset); $postConvertData->setCreateThumb($createThumb); if ($parentJob) { $parentData = $parentJob->getData(); if ($parentData instanceof kConvartableJobData) { $postConvertData->setCurrentOperationSet($parentData->getCurrentOperationSet()); $postConvertData->setCurrentOperationIndex($parentData->getCurrentOperationIndex()); } } $flavorAsset = assetPeer::retrieveById($flavorAssetId); $flavorParamsOutput = null; if ($createThumb) { $flavorParamsOutput = assetParamsOutputPeer::retrieveByPK($flavorParamsOutputId); if (!$flavorParamsOutput) { if ($flavorAsset) { $postConvertData->setThumbHeight($flavorAsset->getHeight()); $postConvertData->setThumbBitrate($flavorAsset->getBitrate()); } else { $postConvertData->setCreateThumb(false); } } elseif (!$flavorParamsOutput->getVideoBitrate()) { $postConvertData->setCreateThumb(false); } elseif ($flavorParamsOutput->getSourceRemoteStorageProfileId() != StorageProfile::STORAGE_KALTURA_DC) { $postConvertData->setCreateThumb(false); } elseif ($flavorAsset) { $entry = $flavorAsset->getentry(); if ($entry) { $thisFlavorHeight = $flavorParamsOutput->getHeight(); $thisFlavorBitrate = $flavorParamsOutput->getVideoBitrate(); $createThumb = false; if ($entry->getThumbBitrate() < $thisFlavorBitrate) { $createThumb = true; } elseif ($entry->getThumbBitrate() == $thisFlavorBitrate && $entry->getThumbHeight() < $thisFlavorHeight) { $createThumb = true; } if ($createThumb) { $postConvertData->setCreateThumb(true); $postConvertData->setThumbHeight($thisFlavorHeight); $postConvertData->setThumbBitrate($thisFlavorBitrate); } } } } $batchJob = null; $mediaParserType = $flavorParamsOutput ? $flavorParamsOutput->getMediaParserType() : mediaParserType::MEDIAINFO; if ($parentJob) { //Job will be created with parent job as his root job $useSameRoot = true; if ($parentJob->getJobType() == BatchJobType::CONVERT_PROFILE) { $useSameRoot = false; } $batchJob = $parentJob->createChild(BatchJobType::POSTCONVERT, $mediaParserType, $useSameRoot); } else { $batchJob = new BatchJob(); $batchJob->setEntryId($flavorAsset->getEntryId()); $batchJob->setPartnerId($flavorAsset->getPartnerId()); } $batchJob->setObjectId($flavorAsset->getId()); $batchJob->setObjectType(BatchJobObjectType::ASSET); KalturaLog::log("Post Convert created with file: " . $postConvertData->getSrcFileSyncLocalPath()); return kJobsManager::addJob($batchJob, $postConvertData, BatchJobType::POSTCONVERT, $mediaParserType); }
public function toData(BatchJob $dbBatchJob) { $dbData = null; if (is_null($this->jobType)) { $this->jobType = kPluginableEnumsManager::coreToApi('BatchJobType', $dbBatchJob->getJobType()); } switch ($dbBatchJob->getJobType()) { case KalturaBatchJobType::BULKUPLOAD: $dbData = new kBulkUploadJobData(); if (is_null($this->data)) { $this->data = new KalturaBulkUploadJobData(); } break; case KalturaBatchJobType::CONVERT: $dbData = new kConvertJobData(); if (is_null($this->data)) { $this->data = new KalturaConvertJobData(); } break; case KalturaBatchJobType::CONVERT_PROFILE: $dbData = new kConvertProfileJobData(); if (is_null($this->data)) { $this->data = new KalturaConvertProfileJobData(); } break; case KalturaBatchJobType::EXTRACT_MEDIA: $dbData = new kExtractMediaJobData(); if (is_null($this->data)) { $this->data = new KalturaExtractMediaJobData(); } break; case KalturaBatchJobType::IMPORT: $dbData = new kImportJobData(); if (is_null($this->data)) { $this->data = new KalturaImportJobData(); } break; case KalturaBatchJobType::POSTCONVERT: $dbData = new kPostConvertJobData(); if (is_null($this->data)) { $this->data = new KalturaPostConvertJobData(); } break; case KalturaBatchJobType::MAIL: $dbData = new kMailJobData(); if (is_null($this->data)) { $this->data = new KalturaMailJobData(); } break; case KalturaBatchJobType::NOTIFICATION: $dbData = new kNotificationJobData(); if (is_null($this->data)) { $this->data = new KalturaNotificationJobData(); } break; case KalturaBatchJobType::BULKDOWNLOAD: $dbData = new kBulkDownloadJobData(); if (is_null($this->data)) { $this->data = new KalturaBulkDownloadJobData(); } break; case KalturaBatchJobType::FLATTEN: $dbData = new kFlattenJobData(); if (is_null($this->data)) { $this->data = new KalturaFlattenJobData(); } break; case KalturaBatchJobType::PROVISION_PROVIDE: case KalturaBatchJobType::PROVISION_DELETE: $jobSubType = $dbBatchJob->getJobSubType(); $dbData = kAkamaiProvisionJobData::getInstance($jobSubType); if (is_null($this->data)) { $this->data = KalturaProvisionJobData::getJobDataInstance($jobSubType); } break; case KalturaBatchJobType::CONVERT_COLLECTION: $dbData = new kConvertCollectionJobData(); if (is_null($this->data)) { $this->data = new KalturaConvertCollectionJobData(); } break; case KalturaBatchJobType::STORAGE_EXPORT: $dbData = new kStorageExportJobData(); if (is_null($this->data)) { $this->data = new KalturaStorageExportJobData(); } break; case KalturaBatchJobType::MOVE_CATEGORY_ENTRIES: $dbData = new kMoveCategoryEntriesJobData(); if (is_null($this->data)) { $this->data = new KalturaMoveCategoryEntriesJobData(); } break; case KalturaBatchJobType::STORAGE_DELETE: $dbData = new kStorageDeleteJobData(); if (is_null($this->data)) { $this->data = new KalturaStorageDeleteJobData(); } break; case KalturaBatchJobType::CAPTURE_THUMB: $dbData = new kCaptureThumbJobData(); if (is_null($this->data)) { $this->data = new KalturaCaptureThumbJobData(); } break; case KalturaBatchJobType::INDEX: $dbData = new kIndexJobData(); if (is_null($this->data)) { $this->data = new KalturaIndexJobData(); } break; case KalturaBatchJobType::COPY: $dbData = new kCopyJobData(); if (is_null($this->data)) { $this->data = new KalturaCopyJobData(); } break; case KalturaBatchJobType::DELETE: $dbData = new kDeleteJobData(); if (is_null($this->data)) { $this->data = new KalturaDeleteJobData(); } break; case KalturaBatchJobType::DELETE_FILE: $dbData = new kDeleteFileJobData(); if (is_null($this->data)) { $this->data = new KalturaDeleteFileJobData(); } break; case KalturaBatchJobType::CONVERT_LIVE_SEGMENT: $dbData = new kConvertLiveSegmentJobData(); if (is_null($this->data)) { $this->data = new KalturaConvertLiveSegmentJobData(); } break; case KalturaBatchJobType::CONCAT: $dbData = new kConcatJobData(); if (is_null($this->data)) { $this->data = new KalturaConcatJobData(); } break; case KalturaBatchJobType::COPY_PARTNER: $dbData = new kCopyPartnerJobData(); if (is_null($this->data)) { $this->data = new KalturaCopyPartnerJobData(); } break; case KalturaBatchJobType::RECALCULATE_CACHE: switch ($dbBatchJob->getJobSubType()) { case RecalculateCacheType::RESPONSE_PROFILE: $dbData = new kRecalculateResponseProfileCacheJobData(); if (is_null($this->data)) { $this->data = new KalturaRecalculateResponseProfileCacheJobData(); } break; } break; default: $dbData = KalturaPluginManager::loadObject('kJobData', $dbBatchJob->getJobType()); if (is_null($this->data)) { $this->data = KalturaPluginManager::loadObject('KalturaJobData', $this->jobType); } } if (is_null($dbBatchJob->getData())) { $dbBatchJob->setData($dbData); } if ($this->data instanceof KalturaJobData) { $dbData = $this->data->toObject($dbBatchJob->getData()); $dbBatchJob->setData($dbData); } return $dbData; }
private static function getParentJobForWaitingAssetConversion($entryId, BatchJob $parentJob = null) { if ($parentJob && $parentJob->getJobType() == BatchJobType::POSTCONVERT) { //In case the flavor conversion is triggered by the ingested flavor add the conversion job //under the convert profile job if available $c = new Criteria(); $c->add(BatchJobPeer::ENTRY_ID, $entryId); $c->add(BatchJobPeer::JOB_TYPE, BatchJobType::CONVERT_PROFILE); $statuses = BatchJobPeer::getUnClosedStatusList(); $statuses[] = BatchJob::BATCHJOB_STATUS_ALMOST_DONE; $c->add(BatchJobPeer::STATUS, $statuses, Criteria::IN); $batchJob = BatchJobPeer::doSelectOne($c); if ($batchJob) { return $batchJob; } } return $parentJob; }