const DB_TABLE_NODE_INFORMATION = 'node_data';
// Constants for database column names
- const DB_COLUMN_NODE_NR = 'node_nr';
- const DB_COLUMN_NODE_ID = 'node_id';
- const DB_COLUMN_NODE_TYPE = 'node_type';
+ const DB_COLUMN_NODE_NR = 'node_nr';
+ const DB_COLUMN_NODE_ID = 'node_id';
+ const DB_COLUMN_SESSION_ID = 'session_id';
+ const DB_COLUMN_NODE_TYPE = 'node_type';
/**
* Protected constructor
// "Insert" this request instance completely into the database
$this->getDatabaseInstance()->queryInsertDataSet($dataSetInstance);
}
+
+ /**
+ * 'Registers' a new session id along with data provided in the node instance.
+ * This may sound confusing but avoids double code very nicely...
+ *
+ * @param $nodeInstance A node instance
+ * @param $requestInstance An instance of a Requestable class
+ * @return void
+ */
+ public function registerSessionId (BaseHubNode $nodeInstance, Requestable $requestInstance) {
+ // Get a dataset instance
+ $dataSetInstance = ObjectFactory::createObjectByConfiguredName('dataset_criteria_class', array(self::DB_TABLE_NODE_INFORMATION));
+
+ // Set the primary key
+ $dataSetInstance->setUniqueKey(self::DB_COLUMN_NODE_ID);
+
+ // Add registration elements to the dataset
+ $nodeInstance->addElementsToDataSet($dataSetInstance, $requestInstance);
+
+ // "Insert" this request instance completely into the database
+ $this->getDatabaseInstance()->queryInsertDataSet($dataSetInstance);
+ }
}
// [EOF]
$wrapperInstance = ObjectFactory::createObjectByConfiguredName('node_info_db_wrapper_class');
// Register the node id with our wrapper
- $wrapperInstance->registerNodeId($this, $this->getRequestInstance());
+ $wrapperInstance->registerSessionId($this, $this->getRequestInstance());
// Output message
$this->debugOutput('BOOTSTRAP: Created new session-id: ' . $this->getSessionId() . '');