Tripal
Public Member Functions | Public Attributes | List of all members
Drupal\tripal_chado\Task\ChadoRenamer Class Reference
Inheritance diagram for Drupal\tripal_chado\Task\ChadoRenamer:
Inheritance graph
[legend]
Collaboration diagram for Drupal\tripal_chado\Task\ChadoRenamer:
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 = 'renamer'
 
- 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 renamer.

Usage:

// Where 'chado' is the name of the Chado schema to rename and
// 'new_chado_name' is the new name to use.
$renamer = \Drupal::service('tripal_chado.renamer');
$renamer->setParameters([
'output_schemas' => ['chado', 'new_chado_name'],
]);
if (!$renamer->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\ChadoRenamer::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\ChadoRenamer::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\ChadoRenamer::performTask ( )

Renames a given Chado schema.

Task parameter array provided to the class constructor includes:

  • 'output_schemas' array: 2 output schemas. The first one is the old schema name and the second one is the new schema name.

Example:

['output_schemas' => ['old_schema_name', 'new_schema_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\ChadoRenamer::validateParameters ( )

Validate task parameters.

Parameter array provided to the class constructor must include two output schema as shown:

['output_schemas' => ['old_schema_name', 'new_schema_name'], ]
Exceptions

Implements Drupal\tripal_biodb\Task\BioTaskInterface.

Member Data Documentation

◆ TASK_NAME

const Drupal\tripal_chado\Task\ChadoRenamer::TASK_NAME = 'renamer'

Name of the task.


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