fmsystem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fmsystem-commits] [6914] Made some fixes to error handling


From: Petur Thorsteinsson
Subject: [Fmsystem-commits] [6914] Made some fixes to error handling
Date: Thu, 03 Feb 2011 19:19:19 +0000

Revision: 6914
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=6914
Author:   peturbjorn
Date:     2011-02-03 19:19:19 +0000 (Thu, 03 Feb 2011)
Log Message:
-----------
Made some fixes to error handling

Modified Paths:
--------------
    branches/dev-bim2/property/inc/class.bobimitem.inc.php

Modified: branches/dev-bim2/property/inc/class.bobimitem.inc.php
===================================================================
--- branches/dev-bim2/property/inc/class.bobimitem.inc.php      2011-02-03 
19:18:30 UTC (rev 6913)
+++ branches/dev-bim2/property/inc/class.bobimitem.inc.php      2011-02-03 
19:19:19 UTC (rev 6914)
@@ -1,10 +1,15 @@
 <?php
+
+       phpgw::import_class('property.bimmodelinformation');
+       
        interface bobimitem {
                public function setIfcXml(SimpleXMLElement  $xml);
                public function setSobimitem(sobimitem $sobimitem);
                public function setSobimtype(sobimtype $sobimtype);
+               public function setSobimmodelinformation(sobimmodelinformation  
$sobimmodelinformation);
                public function setModelId(int $id);
                public function loadIfcItemsIntoDatabase();
+               public function fetchItemsByModelId();
        }
        
        class bobimitem_impl implements bobimitem {
@@ -12,6 +17,7 @@
                /* @var $sobimitem sobimitem */
                private $sobimitem;
                private $sobimtype;
+               private $sobimmodelinformation;
                private $modelId;
                
                public function __construct() {
@@ -23,6 +29,14 @@
                        /* @var $modelInfo SimpleXMLElement */
                        $modelInfo = $this->ifcXml->modelInformation[0];
                        $modelInfoXml =  $modelInfo->asXML();
+                       $bimmodelInformation = new BimModelInformation();
+                       $bimmodelInformation->loadVariablesFromXml($modelInfo);
+                       
$this->sobimmodelinformation->setBimModelInformation($bimmodelInformation);
+                       try {
+                               
$this->sobimmodelinformation->updateModelInformation();
+                       } catch (Exception $e) {
+                               throw $e;
+                       }
                        //var_dump($this->ifcXml);
                        
                        $BimItems = $this->loopThrough();
@@ -37,9 +51,10 @@
                                try {
                                        $this->sobimitem->addBimItem($item);
                                } catch (BimDataException $e) {
-                                       echo "Data exception with 
message:".$e->getMessage()."\n";
-                                       echo 
"Reason:".$e->getPrevious()->getMessage();
-                                       break;
+                                       throw new BimDataException("Data 
exception\n MSG:".$e->getMessage()."\nReason:".$e->getPrevious()->getMessage(), 
$e);
+                                       //echo "Data exception with 
message:".$e->getMessage()."\n";
+                                       //echo 
"Reason:".$e->getPrevious()->getMessage();
+                                       //break;
                                }
                        }
                        
@@ -70,6 +85,13 @@
                        return $BimItemArray;
                }
                /*
+                * Needs the following variables set
+                * 
+                */
+               public function fetchItemsByModelId() {
+                       
+               }
+               /*
                 * @throws IncompleteItemException if the ifc object is missing 
anything
                 */
                private function createBimItem(& $ifcObject) {
@@ -86,10 +108,18 @@
                }
                
                private function checkArguments() {
-                       if(empty($this->ifcXml) || empty($this->sobimitem) || 
empty($this->modelId) || empty($this->sobimtype)) {
-                               throw new InvalidArgumentException("Incorrect 
arguments");
+                       if(empty($this->ifcXml) || empty($this->sobimitem) || 
empty($this->modelId) || empty($this->sobimtype) || 
empty($this->sobimmodelinformation)) {
+                               $args = "IfcXml 
type:".gettype($this->ifcXml)."\n".
+                                               "Sobimitem 
type:".gettype($this->sobimitem)."\n".
+                                               "Model id:".$this->modelId."\n".
+                                               "Sobimtype 
type:".gettype($this->sobimtype)."\n".
+                                               "Sobimmodelinformation 
type:".gettype($this->sobimmodelinformation)."\n";
+                               throw new 
InvalidArgumentException("BObimitem:Incorrect arguments\b".$args);
                        }
                }
+               public function setSobimmodelinformation(sobimmodelinformation  
$sobimmodelinformation) {
+                       $this->sobimmodelinformation = $sobimmodelinformation;
+               }
                public function setModelId(int $id) {
                        $this->modelId = $id;
                }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]