// Search for the node number zero which is hard-coded the default
$searchInstance->addCriteria(NodeInformationDatabaseWrapper::DB_COLUMN_NODE_NR, 1);
- $searchInstance->addCriteria(NodeInformationDatabaseWrapper::DB_COLUMN_NODE_TYPE, $this->__toString());
+ $searchInstance->addCriteria(NodeInformationDatabaseWrapper::DB_COLUMN_NODE_TYPE, $requestInstance->getRequestElement('mode'));
$searchInstance->setLimit(1);
// Get a result back
// Get the node id from result and set it
$this->setNodeId($this->getField(NodeInformationDatabaseWrapper::DB_COLUMN_NODE_ID));
+
+ // Output message
+ $this->getDebugInstance()->output('Re-using found node-id: ' . $this->getNodeId() . '');
} else {
// Get an RNG instance (Random Number Generator)
$rngInstance = ObjectFactory::createObjectByConfiguredName('rng_class');
// Generate a pseudo-random string
- $randomString = $rngInstance->randomString(255);
+ $randomString = $rngInstance->randomString(255) . ':' . $requestInstance->getRequestElement('mode');
// Get a crypto instance
$cryptoInstance = ObjectFactory::createObjectByConfiguredName('crypto_class');
$this->setNodeId($cryptoInstance->hashString($cryptoInstance->encryptString($randomString)));
// Register the node id with our wrapper
- $wrapperInstance->registerNodeId($this);
+ $wrapperInstance->registerNodeId($this, $requestInstance);
+
+ // Output message
+ $this->getDebugInstance()->output('Creating new node-id: ' . $this->getNodeId() . '');
}
}
* Adds registration elements to a given dataset instance
*
* @param $criteriaInstance An instance of a storeable criteria
+ * @param $requestInstance An instance of a Requestable class
* @return void
*/
- public function addElementsToDataSet (StoreableCriteria $criteriaInstance) {
+ public function addElementsToDataSet (StoreableCriteria $criteriaInstance, Requestable $requestInstance) {
// Add node number and type
$criteriaInstance->addCriteria(NodeInformationDatabaseWrapper::DB_COLUMN_NODE_NR, 1);
- $criteriaInstance->addCriteria(NodeInformationDatabaseWrapper::DB_COLUMN_NODE_TYPE, $this->__toString());
+ $criteriaInstance->addCriteria(NodeInformationDatabaseWrapper::DB_COLUMN_NODE_TYPE, $requestInstance->getRequestElement('mode'));
// Add the node id
$criteriaInstance->addCriteria(NodeInformationDatabaseWrapper::DB_COLUMN_NODE_ID, $this->getNodeId());