Example #1
0
 protected function copyModifiedColumns(BatchJobLog $batchJobLog, BatchJob $batchJob, array $modifiedColumns)
 {
     $shouldSkipInTranslation = array(BatchJobPeer::LOCK_INFO, BatchJobPeer::HISTORY, BatchJobPeer::BATCH_JOB_LOCK_ID, BatchJobPeer::EXECUTION_STATUS);
     foreach ($modifiedColumns as $modifiedColumn) {
         $fieldPosLog = -1;
         try {
             if (in_array($modifiedColumn, $shouldSkipInTranslation)) {
                 if ($modifiedColumn == BatchJobPeer::EXECUTION_STATUS) {
                     $batchJobLog->setAbort($batchJob->getExecutionStatus() == BatchJobExecutionStatus::ABORTED);
                 }
                 continue;
             }
             $fieldName = BatchJobPeer::translateFieldName($modifiedColumn, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME);
             $fieldPosJob = BatchJobPeer::translateFieldName($modifiedColumn, BasePeer::TYPE_COLNAME, BasePeer::TYPE_NUM);
             $fieldPosLog = BatchJobLogPeer::translateFieldName($fieldName, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM);
         } catch (PropelException $e) {
             KalturaLog::err("Could not set value for BatchJobLog field {$fieldName}, exception thrown: " . $e->getMessage());
         }
         if ($fieldPosLog != -1) {
             $batchJobLog->setByPosition($fieldPosLog, $batchJob->getByPosition($fieldPosJob));
         }
         if ($modifiedColumn == BatchJobPeer::DATA) {
             //set param_1 for the $batchJobLog
             $batchJobData = $batchJob->getData();
             /* @var $batchJobData kBulkUploadJobData */
             $batchJobLog->setParam1($batchJobData->getBulkUploadObjectType());
         }
     }
     return $batchJobLog;
 }
 protected function copyModifiedColumns(BatchJobLog $batchJobLog, BatchJob $batchJob, array $modifiedColumns)
 {
     foreach ($modifiedColumns as $modifiedColumn) {
         try {
             $fieldName = BatchJobPeer::translateFieldName($modifiedColumn, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME);
             $fieldPosJob = BatchJobPeer::translateFieldName($modifiedColumn, BasePeer::TYPE_COLNAME, BasePeer::TYPE_NUM);
             $fieldPosLog = BatchJobLogPeer::translateFieldName($fieldName, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM);
         } catch (PropelException $e) {
             KalturaLog::err("Could not set value for BatchJobLog field {$fieldName}, exception thrown: " . $e->getMessage());
         }
         $batchJobLog->setByPosition($fieldPosLog, $batchJob->getByPosition($fieldPosJob));
         if ($modifiedColumn == BatchJobPeer::DATA) {
             //set param_1 for the $batchJobLog
             $batchJobData = $batchJob->getData();
             /* @var $batchJobData kBulkUploadJobData */
             $batchJobLog->setParam1($batchJobData->getBulkUploadObjectType());
         }
     }
     return $batchJobLog;
 }
Example #3
0
 /**
  * The function fills the batch job log to contain all the information the
  * current batch job contains in it.
  */
 public function copyIntoBatchLog(BatchJobLog $copyObj)
 {
     // Batch Job Fields
     $copyObj->setJobType($this->job_type);
     $copyObj->setJobSubType($this->job_sub_type);
     $copyObj->setData($this->data);
     $copyObj->setStatus($this->status);
     $copyObj->setAbort($this->execution_status == BatchJobExecutionStatus::ABORTED);
     $copyObj->setMessage($this->message);
     $copyObj->setDescription($this->description);
     $copyObj->setCreatedAt($this->created_at);
     $copyObj->setUpdatedAt($this->updated_at);
     $copyObj->setPriority($this->priority);
     $copyObj->setQueueTime($this->queue_time);
     $copyObj->setFinishTime($this->finish_time);
     $copyObj->setEntryId($this->entry_id);
     $copyObj->setPartnerId($this->partner_id);
     $copyObj->setLastSchedulerId($this->last_scheduler_id);
     $copyObj->setLastWorkerId($this->last_worker_id);
     $copyObj->setBulkJobId($this->bulk_job_id);
     $copyObj->setRootJobId($this->root_job_id);
     $copyObj->setParentJobId($this->parent_job_id);
     $copyObj->setDc($this->dc);
     $copyObj->setErrType($this->err_type);
     $copyObj->setErrNumber($this->err_number);
     // Batch job lock info
     if ($this->getLockInfo() != null) {
         $copyObj->setFileSize($this->getLockInfo()->getEstimatedEffort());
         $copyObj->setLockVersion($this->getLockInfo()->getLockVersion());
     }
     // Batch job lock fields
     $dbBatchJobLock = $this->getBatchJobLock();
     if ($dbBatchJobLock !== null) {
         $copyObj->setProcessorExpiration($dbBatchJobLock->getExpiration());
         $copyObj->setExecutionAttempts($dbBatchJobLock->getExecutionAttempts());
         $copyObj->setCheckAgainTimeout($dbBatchJobLock->getStartAt());
         $copyObj->setSchedulerId($dbBatchJobLock->getSchedulerId());
         $copyObj->setWorkerId($dbBatchJobLock->getWorkerId());
         $copyObj->setBatchIndex($dbBatchJobLock->getBatchIndex());
     }
     $copyObj->setNew(true);
     $copyObj->setId(NULL);
     // this is a auto-increment column, so set to default value
 }
Example #4
0
 /**
  * Adds an object to the instance pool.
  *
  * Propel keeps cached copies of objects in an instance pool when they are retrieved
  * from the database.  In some cases -- especially when you override doSelect*()
  * methods in your stub classes -- you may need to explicitly add objects
  * to the cache in order to ensure that the same objects are always returned by doSelect*()
  * and retrieveByPK*() calls.
  *
  * @param      BatchJobLog $value A BatchJobLog object.
  * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
  */
 public static function addInstanceToPool(BatchJobLog $obj, $key = null)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if ($key === null) {
             $key = (string) $obj->getId();
         }
         if (isset(self::$instances[$key]) || count(self::$instances) < kConf::get('max_num_instances_in_pool')) {
             self::$instances[$key] = $obj;
             kMemoryManager::registerPeer('BatchJobLogPeer');
         }
     }
 }
 /**
  * Adds an object to the instance pool.
  *
  * Propel keeps cached copies of objects in an instance pool when they are retrieved
  * from the database.  In some cases -- especially when you override doSelect*()
  * methods in your stub classes -- you may need to explicitly add objects
  * to the cache in order to ensure that the same objects are always returned by doSelect*()
  * and retrieveByPK*() calls.
  *
  * @param      BatchJobLog $value A BatchJobLog object.
  * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
  */
 public static function addInstanceToPool(BatchJobLog $obj, $key = null)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if ($key === null) {
             $key = (string) $obj->getId();
         }
         // if key === null
         self::$instances[$key] = $obj;
     }
 }