Tripal
Public Member Functions | Public Attributes | List of all members
Drupal\tripal_chado\Task\ChadoIntegrator Class Reference
Inheritance diagram for Drupal\tripal_chado\Task\ChadoIntegrator:
Inheritance graph
[legend]
Collaboration diagram for Drupal\tripal_chado\Task\ChadoIntegrator:
Collaboration graph
[legend]

Public Member Functions

 validateParameters ()
 
 performTask ()
 
 getProgress ()
 
 getStatus ()
 
- Public Member Functions inherited from Drupal\tripal_chado\Task\ChadoTaskBase
 getTripalDbxClass ($class)
 
- Public Member Functions inherited from Drupal\tripal_biodb\Task\BioTaskBase
 __construct (?\Drupal\Core\Database\Connection $database=NULL, ?\Psr\Log\LoggerInterface $logger=NULL, ?\Drupal\tripal_biodb\Lock\SharedLockBackendInterface $locker=NULL, ?\Drupal\Core\State\StateInterface $state=NULL)
 
 setParameters (array $parameters=[])
 
 getId ()
 
 getLogger ()
 

Public Attributes

const TASK_NAME = 'integrator'
 
- Public Attributes inherited from Drupal\tripal_chado\Task\ChadoTaskBase
const TASK_NAME = 'chado'
 
- Public Attributes inherited from Drupal\tripal_biodb\Task\BioTaskBase
const TASK_NAME = 'task'
 
const STATE_KEY_DATA_PREFIX = 'tripal_biodb_'
 

Additional Inherited Members

- Protected Member Functions inherited from Drupal\tripal_biodb\Task\BioTaskBase
 prepareSchemas (array $schema_list)
 
 getSchemaLockName (\Drupal\tripal\TripalDBX\TripalDbxConnection $db)
 
 initId ()
 
 acquireTaskLocks ()
 
 releaseTaskLocks ()
 
- Protected Attributes inherited from Drupal\tripal_biodb\Task\BioTaskBase
 $id
 
 $connection
 
 $logger
 
 $locker
 
 $state
 
 $parameters = ['input_schemas' => [], 'output_schemas' => [], ]
 
 $inputSchemas = []
 
 $outputSchemas = []
 

Detailed Description

Chado integrator.

Usage:

// Where 'chado' is the name of the Chado schema to integrate into Tripal.
$integrator = \Drupal::service('tripal_chado.integrator');
$integrator->setParameters([
'input_schemas' => ['chado'],
]);
if (!$integrator->performTask()) {
// Display a message telling the user the task failed and details are in
// the site logs.
}

Member Function Documentation

◆ getProgress()

Drupal\tripal_chado\Task\ChadoIntegrator::getProgress ( )

{Returns the percent of progress of current task.This method can also be used to check if a task is currently running if it has a > 0 value. A negative value means an error occured while running.

Returns
float A value between -1 and 1, 0 meaning the task has not been started yet, 1 meaning the task is completed with success and a negative value meaning that the task failed. The negative value may be used as a code to identify the error.
}

Implements Drupal\tripal_biodb\Task\BioTaskInterface.

◆ getStatus()

Drupal\tripal_chado\Task\ChadoIntegrator::getStatus ( )

{{Returns a string describing current status of the performed task.This function returns the last known status, even if the task ended. In case of failure, this function may return the reason of the failure.

Returns
string A localized description.
}}

Reimplemented from Drupal\tripal_biodb\Task\BioTaskBase.

◆ performTask()

Drupal\tripal_chado\Task\ChadoIntegrator::performTask ( )

Imports a given existing chado schema into Tripal system.

By "integrating" or "importing" we mean that a Chado schema may have been loaded into the database without Tripal and Tripal has not been configured to use it. Therefor, such a schema needs to be "integrated" into Tripal system in order to be used under Tripal/Drupal.

Task parameter array provided to the class constructor includes:

  • 'input_schemas' array: one input Chado schema that must exist and be at version >=1.3 (required)
  • 'output_schemas' array: no output schema

Example:

['input_schemas' => ['original_name'], ]
Returns
bool TRUE if the task was performed with success and FALSE if the task was completed but without the expected success.
Exceptions
Drupal

Reimplemented from Drupal\tripal_biodb\Task\BioTaskBase.

◆ validateParameters()

Drupal\tripal_chado\Task\ChadoIntegrator::validateParameters ( )

Validate task parameters.

Parameter array provided to the class constructor must include one input schema and no output schema as shown:

['input_schemas' => ['schema_name'], ]
Exceptions

Implements Drupal\tripal_biodb\Task\BioTaskInterface.

Member Data Documentation

◆ TASK_NAME

const Drupal\tripal_chado\Task\ChadoIntegrator::TASK_NAME = 'integrator'

Name of the task.


The documentation for this class was generated from the following file: