The EIController class handles all correspondence between the model and the view architectures.

The EIController class implements the Singleton design pattern.

 Methods

Empties the queue.

clearQueue() 

Retrieves an error, if any, for a given nid.

getError($nid) : bool

Parameters

$nid

Returns

bool

Returns the single instance of the EIController class.

getInstance() : \EIController | null
Static

Returns

Retrieves the version of the current ontology on the Eagle-I node.

getOntologyVersion() : mixed

Returns

mixed

Retrieves a clone of the current Queue.

getQueue() : mixed

Returns

mixed

Retrieves the size of the current Queue.

getQueueSize() : int

Returns

int

Formulate a suitable message for the user from an activity id.

getUserMessage($aid) : array

More specifically a message ready for drupal_set_message.

Parameters

$aid

  • the activity id

Returns

array- an array in the form (message, status)

Maps a node to an EIExchangeInstance and pushes it to the Eagle-I node api, returning the result of the API exchange.

processNode($node, $batch) : bool | null

Parameters

$node

  • either the node object, or the nid to process

$batch

Exceptions

\Exception - if the Eagle-I ontology on the Drupal site doesn't match that on the node.

Returns

boolnull- the activity id of the logged activity or null if no activity was logged

Process the passed number of nids in the queue, or all nids if no number is passed.

processQueue(null $num) 

Parameters

$num

null

Add the passed nids to the Queue.

queueNodes($nids) 

The nids may be an array, or a single scaler int.

Parameters

$nids

Provides a testing interface for the EIDataConnector object

testDataConnector($type, bool $uri) : string

Parameters

$type

$uri

bool

Returns

string

Provides a testing interface for the EIDataMapper object

testDataMapper($nid) : string

Parameters

$nid

Returns

string

__construct()

__construct() 
access private

Remove all errors from the errors table for a given nid.

cleanErrors($nid) 
access private

Parameters

$nid

Retrieve whether Drupal has the same ontology version as the Eagle-I node or not.

hasCurrentOntology() : bool
access private

Returns

bool

Log activity in the activity table.

logActivity($nid, $eid, null $exchangeInstance, null $instanceUpdateRequest) : bool | null
access private

Parameters

$nid

$eid

$exchangeInstance

null

$instanceUpdateRequest

null

Returns

boolnull

Log an error in the errors table.

logError($ex) : int | null
access private

Parameters

$ex

  • The exception object caught.

Returns

intnull

Updates the stored uris with those received from the Eagle-I node.

updateNodeUris($instanceUpdateRequest) 
access private

Parameters

$instanceUpdateRequest

Write a record to the eagle_i_uris table for the given data.

writeUriRecord($data, $update) 
access private

Parameters

$data

An array containing the nid and the uri

$update

Pass true if updating the table

 Properties

 

$instance : null
 

$dataConnector : \EIDataConnector | null
access private
 

$dataMapper : \EIDataMapper | null
access private
 

$queue : \EIQueue | null
access private