Ejemplo n.º 1
0
 public function onUpdateOrCreate($fileId, $content, $pharPath = null)
 {
     $parsed = OMParser::parse($content);
     $observation = $this->omMapper->getByUuid($parsed['uuid']);
     $insert = false;
     if ($observation == null) {
         $observation = new ObservationModel();
         $insert = true;
     }
     $observation->setUuid($parsed['uuid']);
     $observation->setName($parsed['name']);
     $observation->setDescription($parsed['description']);
     $observation->setFileId($fileId);
     $observation->setStatus(true);
     $observation->setSystemUuid($parsed['system-uuid']);
     $observation->setResultFile($parsed['result-file']);
     $observation->setTimestamp(time());
     $observation->setPharPath($pharPath);
     if ($insert === true) {
         $this->omMapper->insert($observation);
     } else {
         $this->omMapper->update($observation);
     }
 }
Ejemplo n.º 2
0
 /**
  * Return the type of the node
  * @param $node node to analyze
  */
 function getType($node)
 {
     $xmlFile = FileUtil::endsWith($node->getName(), XML);
     if ($xmlFile === true) {
         $xml = new \SimpleXMLElement($node->getContent());
         if (OMParser::accept($xml)) {
             return OM;
         } else {
             if (SensorMLParser::accept($xml)) {
                 return SML;
             }
         }
     }
     return UNKNOW;
 }