/**
  * @see SugarView::display()
  */
 public function display()
 {
     global $mod_strings, $app_strings, $current_user;
     global $sugar_config;
     if ($this->importSource === FALSE) {
         $GLOBALS['log']->fatal("Found invalid adapter");
         $this->handleImportError($mod_strings['LBL_EXTERNAL_ERROR_NO_SOURCE']);
     }
     $columncount = isset($_REQUEST['columncount']) ? $_REQUEST['columncount'] : '';
     $fieldKeyTranslator = $this->getSugarToExternalFieldMapping($columncount);
     try {
         $this->importSource->loadDataSet($this->recordsPerImport);
     } catch (Exception $e) {
         $GLOBALS['log']->fatal("Unable to import external feed, exception: " . $e->getMessage());
         $this->handleImportError($mod_strings['LBL_EXTERNAL_ERROR_FEED_CORRUPTED']);
     }
     if (!ImportCacheFiles::ensureWritable()) {
         $GLOBALS['log']->fatal($mod_strings['LBL_ERROR_IMPORT_CACHE_NOT_WRITABLE']);
         $this->handleImportError($mod_strings['LBL_ERROR_IMPORT_CACHE_NOT_WRITABLE']);
     }
     $importer = new Importer($this->importSource, $this->bean);
     $importer->setFieldKeyTranslator($fieldKeyTranslator);
     $importer->import();
     //Send back our results.
     $metaResult = array('done' => FALSE, 'totalRecordCount' => $this->importSource->getTotalRecordCount());
     echo json_encode($metaResult);
     sugar_cleanup(TRUE);
 }