public function load()
 {
     //Starting off loading sample data.
     global $_CALEM_conf;
     $loadConf = new CalemDataLoadConf();
     $loadConf->init($_CALEM_conf['calem_data_load_sample']);
     $sampleLoad = new CalemDataLoader();
     $sampleLoad->load($loadConf);
     $sampleLoad->validate($loadConf);
     //Reset wo count
     $cntReset = new CalemDashWoCountResetTask();
     $result = $cntReset->execute();
     return $result;
 }
 public function load()
 {
     //Starting off loading sample data.
     global $_CALEM_conf;
     $loadConf = new CalemDataLoadConf();
     $loadConf->init($_CALEM_conf['calem_data_load_init']);
     $sampleLoad = new CalemDataLoader();
     $sampleLoad->load($loadConf);
     //Now loading special ones
     $loaders = $loadConf->getLoaders();
     if ($loaders) {
         foreach ($loaders as $cls) {
             require_once 'loader/' . $cls . '.php';
             $load = new $cls();
             $load->load();
         }
     }
     $sampleLoad->validate($loadConf);
 }
Example #3
0
 /**
  * Data loading validation
  */
 public function validate(CalemDataLoadConf $loadConf)
 {
     $this->conf = $loadConf;
     //Get a handle to the global config.
     global $_CALEM_conf;
     //Verify that DB has been setup
     if (!$this->dbHandler->dbExist($_CALEM_conf['calem_db_name'], $this->conn)) {
         throw new CalemException("Database " . $_CALEM_conf['calem_db_name'] . " does not exit. Please configure DB first.", 0);
     }
     $this->dbHandler->releaseDatabaseAdminConnection();
     //Get a reference to the resource manager
     $tableMap = $this->resourceMgr->getTableMap();
     //Get list of tables.
     $tables = $tableMap->getTableMap();
     //Get a dbo handle
     $dbo = new CalemDbo();
     foreach ($tables as $table) {
         if ($this->logger->isDebugEnabled()) {
             $this->logger->debug("Validating data for " . $table);
         }
         $tableDd = $this->resourceMgr->getTableDd($table);
         //Skip some tables such as dropdown
         if ($this->skipTable($tableDd)) {
             continue;
         }
         //Loading data from multiple dataset
         $files = $loadConf->getDataList($table);
         if ($this->logger->isDebugEnabled()) {
             $this->logger->debug("files for {$table} = " . var_export($files, true));
         }
         foreach ($files as $file) {
             $this->validateFile($tableDd, $file, $dbo);
         }
     }
 }