|
Tripal
|


Public Member Functions | |
| __construct (array $configuration, $plugin_id, $plugin_definition, ?Messenger $messenger=NULL, ?TripalLogger $logger=NULL, ?TripalFileRetriever $fileretriever=NULL, ?TripalBackendPublishManager $publish_manager=NULL,) | |
| describeUploadFileFormat () | |
| setJob ($job) | |
| startTransactions () | |
| rollbackTransaction (string $stage) | |
| createImportJob ($run_args, $file_details=[]) | |
| load ($import_id) | |
| submitJob () | |
| prepareFiles () | |
| cleanFile () | |
| postRun () | |
| setArguments (array $arguments) | |
| getArguments () | |
Public Member Functions inherited from Drupal\tripal\TripalImporter\Interfaces\TripalImporterInterface | |
| form ($form, &$form_state) | |
| formSubmit ($form, &$form_state) | |
| formValidate ($form, &$form_state) | |
| run () | |
| addAnalysis ($form, &$form_state) | |
Static Public Member Functions | |
| static | create (ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition,) |
Protected Member Functions | |
| setTotalItems ($total_items) | |
| addItemsHandled ($num_handled) | |
| setItemsHandled ($total_handled) | |
| setInterval ($interval) | |
| xmlIsValid (string $xml) | |
Protected Attributes | |
| $messenger = NULL | |
| $logger = NULL | |
| $fileretriever = NULL | |
| $publish_manager = NULL | |
| $job | |
| $arguments | |
| $import_id | |
| $is_prepared | |
| $reported | |
| $plugin_id | |
| $plugin_definition | |
Defines an interface for tripal impoerter plugins.
| Drupal\tripal\TripalImporter\TripalImporterBase::__construct | ( | array | $configuration, |
| $plugin_id, | |||
| $plugin_definition, | |||
| ?Messenger | $messenger = NULL, |
||
| ?TripalLogger | $logger = NULL, |
||
| ?TripalFileRetriever | $fileretriever = NULL, |
||
| ?TripalBackendPublishManager | $publish_manager = NULL |
||
| ) |
Constructs a TripalImporterBase object.
| array | $configuration | A configuration array containing information about the plugin instance. |
| string | $plugin_id | The plugin ID for the plugin instance. |
| mixed | $plugin_definition | The plugin implementation definition. |
| ?Drupal |
Core\Messenger\Messenger The Drupal messenger service.
| ?Drupal |
tripal\Services\TripalLogger The Tripal logger service.
| ?Drupal |
tripal\Services\TripalFileRetriever The Tripal file retrieval service.
| ?Drupal |
tripal\TripalBackendPublish\PluginManager\TripalBackendPublishManager The Tripal publish manager service.
|
protected |
Adds to the count of the total number of items that have been handled.
| int | $num_handled |
| Drupal\tripal\TripalImporter\TripalImporterBase::cleanFile | ( | ) |
Cleans up any temporary files that were created by the prepareFile().
This function should be called after a run() to remove any temporary files and keep them from building up on the server.
|
static |
Implements ContainerFactoryPluginInterface->create().
| Symfony\Component\DependencyInjection\ContainerInterface | $container | The container. |
| array | $configuration | A configuration array containing information about the plugin instance. |
| string | $plugin_id | The plugin ID for the plugin instance. |
| mixed | $plugin_definition | The plugin implementation definition. |
Reimplemented in Drupal\tripal_chado\Plugin\TripalImporter\GFF3Importer, Drupal\tripal_chado\Plugin\TripalImporter\OBOImporter, Drupal\tripal_chado\Plugin\TripalImporter\PubSearchQueryImporter, Drupal\tripal_chado\Plugin\TripalImporter\TaxonomyImporter, and Drupal\tripal_chado\TripalImporter\ChadoImporterBase.
| Drupal\tripal\TripalImporter\TripalImporterBase::createImportJob | ( | $run_args, | |
$file_details = [] |
|||
| ) |
Creates a new importer record.
| array | $run_args | An associative array of the arguments needed to run the importer. Each importer will have its own defined set of arguments. |
| array | $file_details | An associative array with one of the following keys: -fid: provides the Drupal managed File ID for the file. -file_local: provides the full path to the file on the server. -file_remote: provides the remote URL for the file. This argument is optional if the loader does not use the built-in file loader. |
| Drupal\tripal\TripalImporter\TripalImporterBase::describeUploadFileFormat | ( | ) |
Provide more informative description than is ideal in the annotation alone.
NOTE: Supports full HTML.
| Drupal\tripal\TripalImporter\TripalImporterBase::getArguments | ( | ) |
Retrieves the list of arguments that were provided to the importer.
| Drupal\tripal\TripalImporter\TripalImporterBase::load | ( | $import_id | ) |
Loads an existing import record into this object.
| int | $import_id | The ID of the import record. |
| Drupal\tripal\TripalImporter\TripalImporterBase::postRun | ( | ) |
Performs tasks after the importer has completed.
Implements Drupal\tripal\TripalImporter\Interfaces\TripalImporterInterface.
Reimplemented in Drupal\tripal_chado\Plugin\TripalImporter\OBOImporter, and Drupal\tripal_chado\TripalImporter\ChadoImporterBase.
| Drupal\tripal\TripalImporter\TripalImporterBase::prepareFiles | ( | ) |
Prepares the importer files for execution.
This function must be run prior to the run() function to ensure that the import file is ready to go, i.e. it is downloaded and if necessary it has been uncompressed.
| Drupal\tripal\TripalImporter\TripalImporterBase::rollbackTransaction | ( | string | $stage | ) |
Clean-up anything related to this import in case of error.
Called when an exception is caught during run() or postRun(). NOTE: This is called after the transaction on the current database is rolled back. If you want to rollback all changes in multiple Drupal-managed connections then add each one via startTransaction(). This should only be needed to perform partial clean-up or when importing into non Drupal-managed connections.
| string | $stage | A string indicating where this method was called from. Expected to be one of 'run' or 'postRun'. |
| Drupal\tripal\TripalImporter\TripalImporterBase::setArguments | ( | array | $arguments | ) |
Stores a set of arguments for the importer
| array | $arguments | Associative array |
|
protected |
Updates the percent interval when the job progress is updated.
Updating the job progress incurrs a database write which takes time and if it occurs to frequently can slow down the loader. This should be a value between 0 and 100 to indicate a percent interval (e.g. 1 means update the progress every time the num_handled increases by 1%).
| int | $interval | A number between 0 and 100. |
|
protected |
Sets the number of items that have been processed.
This should be called anytime the loader wants to indicate how many items have been processed. The amount of progress will be calculated using this number. If the amount of items handled exceeds the interval specified then the progress is reported to the user. If this loader is associated with a job then the job progress is also updated.
| int | $total_handled | The total number of items that have been processed. |
| Drupal\tripal\TripalImporter\TripalImporterBase::setJob | ( | $job | ) |
Associate this importer with the Tripal job that is running it.
Associating an import with a job will allow the importer to log messages to the job log.
| \Drupal\tripal\Services\TripalJob | $job | An instance of a TripalJob. |
|
protected |
Sets the total number if items to be processed.
This should typically be called near the beginning of the loading process to indicate the number of items that must be processed.
| int | $total_items | The total number of items to process. |
| Drupal\tripal\TripalImporter\TripalImporterBase::startTransactions | ( | ) |
Creates a database transaction in the specific schema(s) this importer will be importing data into.
Reimplemented in Drupal\tripal_chado\TripalImporter\ChadoImporterBase.
| Drupal\tripal\TripalImporter\TripalImporterBase::submitJob | ( | ) |
Submits the importer for execution as a job.
|
protected |
Validates whether XML is valid or not.
| string | $xml | The XML to be checked. |
|
protected |
The arguments needed for the importer. This is a list of key/value pairs in an associative array.
|
protected |
The ID for this import record.
|
protected |
Prior to running an importer it must be prepared to make sure the file is available. Preparing the importer will download all the necessary files. This value is set to TRUE after the importer is prepared for running.
|
protected |
The job that this importer is associated with. This is needed for updating the status of the job.