Tripal
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Drupal\tripal\Plugin\TripalIdSpace\TripalDefaultIdSpace Class Reference
Inheritance diagram for Drupal\tripal\Plugin\TripalIdSpace\TripalDefaultIdSpace:
Inheritance graph
[legend]
Collaboration diagram for Drupal\tripal\Plugin\TripalIdSpace\TripalDefaultIdSpace:
Collaboration graph
[legend]

Public Member Functions

 __construct (array $configuration, $plugin_id, $plugin_definition)
 
 getParent ($child)
 
 setURLPrefix ($prefix)
 
 setDefaultVocabulary ($vocab)
 
 recordExists ()
 
 isValid ()
 
 destroy ()
 
 removeTerm ($accession)
 
 setDescription ($description)
 
 getURLPrefix ()
 
 getDescription ()
 
 createRecord ()
 
 getDefaultVocabulary ()
 
 saveTerm ($term, array $options=[])
 
- Public Member Functions inherited from Drupal\tripal\TripalVocabTerms\TripalCollectionPluginBase
 getName ()
 
- Public Member Functions inherited from Drupal\tripal\TripalVocabTerms\Interfaces\TripalIdSpaceInterface
 getChildren ($parent=NULL)
 
 getTerm ($accession, $options=[])
 
 getTerms ($name, $options=[])
 
 saveTerm (TripalTerm $term, array $options=[])
 

Protected Member Functions

 loadIdSpace ()
 
 findTermRecord (TripalTerm $term)
 
 insertTerm (TripalTerm $term, array $options)
 
 updateTerm (TripalTerm $term, object &$cvterm, array $options)
 

Protected Attributes

 $is_valid = FALSE
 
- Protected Attributes inherited from Drupal\tripal\TripalVocabTerms\TripalCollectionPluginBase
 $messageLogger = NULL
 

Detailed Description

Default Implementation of TripalIdSpaceBase

@TripalIdSpace( id = "tripal_default_id_space", label = @Translation("Deafult Tripal IdSpace"), )

Constructor & Destructor Documentation

◆ __construct()

Drupal\tripal\Plugin\TripalIdSpace\TripalDefaultIdSpace::__construct ( array  $configuration,
  $plugin_id,
  $plugin_definition 
)

Member Function Documentation

◆ createRecord()

Drupal\tripal\Plugin\TripalIdSpace\TripalDefaultIdSpace::createRecord ( )

Creates the records needed for this collection.This must only be called once on this new collection instance that has just been created by its collection plugin manager.

Implements Drupal\tripal\TripalVocabTerms\Interfaces\TripalCollectionPluginInterface.

◆ destroy()

Drupal\tripal\Plugin\TripalIdSpace\TripalDefaultIdSpace::destroy ( )

Destroys this collection.This must only be called once when on this existing collection that is being removed from its collection plugin manager.

Implements Drupal\tripal\TripalVocabTerms\Interfaces\TripalCollectionPluginInterface.

◆ findTermRecord()

Drupal\tripal\Plugin\TripalIdSpace\TripalDefaultIdSpace::findTermRecord ( TripalTerm  $term)
protected

Retrieve a term record from tripal_terms table.

This function uses the IdSpace, vocabulary, and accession values to uniquely identify a term.

Parameters
TripalTerm$termThe TripalTerm object to save.
Returns
object The cvterm record in object form.

◆ getDefaultVocabulary()

Drupal\tripal\Plugin\TripalIdSpace\TripalDefaultIdSpace::getDefaultVocabulary ( )

Returns this id space's default vocabulary name or NULL if no default has been set.

Returns
string The vocabulary name.

Implements Drupal\tripal\TripalVocabTerms\Interfaces\TripalIdSpaceInterface.

◆ getDescription()

Drupal\tripal\Plugin\TripalIdSpace\TripalDefaultIdSpace::getDescription ( )

Returns the description of this id space.

Returns
string The description.

Implements Drupal\tripal\TripalVocabTerms\Interfaces\TripalIdSpaceInterface.

◆ getParent()

Drupal\tripal\Plugin\TripalIdSpace\TripalDefaultIdSpace::getParent (   $child)

Gets the parent of the given term. The given term must be a valid term for this id space. If the given term is a root of this id space then NULL is returned.

Parameters
Drupal\tripal\TripalVocabTerms\TripalTerm$childThe given term.
Returns
Drupal\tripal\TripalVocabTerms\TripalTerm|NULL The parent term or NULL.

Implements Drupal\tripal\TripalVocabTerms\Interfaces\TripalIdSpaceInterface.

◆ getURLPrefix()

Drupal\tripal\Plugin\TripalIdSpace\TripalDefaultIdSpace::getURLPrefix ( )

Returns the URL prefix of this id space.

Returns
string The URL prefix.

Implements Drupal\tripal\TripalVocabTerms\Interfaces\TripalIdSpaceInterface.

◆ insertTerm()

Drupal\tripal\Plugin\TripalIdSpace\TripalDefaultIdSpace::insertTerm ( TripalTerm  $term,
array  $options 
)
protected

Inserts a new term.

The term should be checked that it does not exist prior to calling this function.

Parameters
\Drupal\tripal\TripalVocabTerms\TripalTerm$termThe term object to update
array$optionsThe options passed to the saveTerm() function.
Returns
boolean True if the insert was successful, false otherwise.

◆ isValid()

Drupal\tripal\Plugin\TripalIdSpace\TripalDefaultIdSpace::isValid ( )

Tests if this collection is valid or not.

Returns
bool True if this collection is valid or false otherwise.

Implements Drupal\tripal\TripalVocabTerms\Interfaces\TripalCollectionPluginInterface.

◆ loadIdSpace()

Drupal\tripal\Plugin\TripalIdSpace\TripalDefaultIdSpace::loadIdSpace ( )
protected

Loads an ID Space record

Returns
array An associative array containing the columns of the `db1 table of Chado or NULL if the db could not be found.

◆ recordExists()

Drupal\tripal\Plugin\TripalIdSpace\TripalDefaultIdSpace::recordExists ( )

Indicates if the underlying data store has a record for this collection.This function will be called by the collection plugin manager to ensure that the record for this collection exists and if not allow it to create it by calling the create() method or prevent addition of duplicate entries.

Returns
bool True if a record exists in the data store, False if not.

Implements Drupal\tripal\TripalVocabTerms\Interfaces\TripalCollectionPluginInterface.

◆ removeTerm()

Drupal\tripal\Plugin\TripalIdSpace\TripalDefaultIdSpace::removeTerm (   $accession)

Removes the term with the given accession from this id space. All children terms are also removed. !!!WARNING!!! If the removed term in this id space is referenced by entities this could break data integrity. This method must be used with extreme caution!

Parameters
string$accessionThe accession.
Returns
bool True if the term was removed or false otherwise.

Implements Drupal\tripal\TripalVocabTerms\Interfaces\TripalIdSpaceInterface.

◆ saveTerm()

Drupal\tripal\Plugin\TripalIdSpace\TripalDefaultIdSpace::saveTerm (   $term,
array  $options = [ ] 
)

◆ setDefaultVocabulary()

Drupal\tripal\Plugin\TripalIdSpace\TripalDefaultIdSpace::setDefaultVocabulary (   $vocab)

{{Sets the default vocabulary of this id space to the given vocabulary name.Removes this id space from its previous default vocabulary if one is set and then adds this id space to its new default vocabulary if the given name is not NULL. It is still the responsibility of an implementation to actually save changes to its default vocabulary.

Parameters
stringname The vocabulary name.
Returns
bool True on success or false otherwise.
}}

Reimplemented from Drupal\tripal\TripalVocabTerms\TripalIdSpaceBase.

◆ setDescription()

Drupal\tripal\Plugin\TripalIdSpace\TripalDefaultIdSpace::setDescription (   $description)

Sets the description of this id space.

Parameters
string$descriptionThe description.
Returns
bool True if the value was set or false otherwise.

Implements Drupal\tripal\TripalVocabTerms\Interfaces\TripalIdSpaceInterface.

◆ setURLPrefix()

Drupal\tripal\Plugin\TripalIdSpace\TripalDefaultIdSpace::setURLPrefix (   $prefix)

Sets the URL prefix of this id space to the given URL prefix.

Parameters
string$prefixThe URL prefix.
Returns
bool True if the value was set or false otherwise.

Implements Drupal\tripal\TripalVocabTerms\Interfaces\TripalIdSpaceInterface.

◆ updateTerm()

Drupal\tripal\Plugin\TripalIdSpace\TripalDefaultIdSpace::updateTerm ( TripalTerm  $term,
object &  $cvterm,
array  $options 
)
protected

Updates an existing term.

The term should be checked that it already exists prior to execution of this function.

Parameters
\Drupal\tripal\TripalVocabTerms\TripalTerm$termThe term object to update
object$cvtermThe record object for the term to update from the Chado cvterm table.
array$optionsThe options passed to the saveTerm() function.
Returns
boolean True if the update was successful, false otherwise.

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