/**
  * Save Aggregator Result to the DB
  *
  * @param tx_caretaker_AggregatorNode $node
  * @param tx_caretaker_AggregatorResult $aggregator_result
  * @return integer UID of the new DB result Record
  */
 public function addNodeResult(tx_caretaker_AggregatorNode $node, tx_caretaker_AggregatorResult $aggregator_result)
 {
     //add an undefined row to the testresult column
     $instance = $node->getInstance();
     if ($instance) {
         $instanceUid = $instance->getUid();
     } else {
         $instanceUid = 0;
     }
     $values = array('aggregator_uid' => $node->getUid(), 'aggregator_type' => $node->getType(), 'instance_uid' => $instanceUid, 'result_status' => $aggregator_result->getState(), 'tstamp' => $aggregator_result->getTstamp(), 'result_num_undefined' => $aggregator_result->getNumUNDEFINED(), 'result_num_ok' => $aggregator_result->getNumOK(), 'result_num_warnig' => $aggregator_result->getNumWARNING(), 'result_num_error' => $aggregator_result->getNumERROR(), 'result_msg' => $aggregator_result->getMessage()->getText(), 'result_values' => serialize($aggregator_result->getMessage()->getValues()), 'result_submessages' => serialize($aggregator_result->getSubMessages()));
     $GLOBALS['TYPO3_DB']->exec_INSERTquery('tx_caretaker_aggregatorresult', $values);
     return $GLOBALS['TYPO3_DB']->sql_insert_id();
 }