Module: nagvis
Branch: master
Commit: dd6088d39e391f56e32b0fd2ff81868d91591138
URL:    
http://nagvis.git.sourceforge.net/git/gitweb.cgi?p=nagvis/nagvis;a=commit;h=dd6088d39e391f56e32b0fd2ff81868d91591138

Author: Lars Michelsen <[email protected]>
Date:   Mon Oct 19 18:41:41 2009 +0200

 #147 Ensuring that there are no duplicate object_ids

---

 share/server/core/classes/NagVisAutoMap.php        |    1 +
 share/server/core/classes/objects/NagVisObject.php |   12 ++++++++++++
 share/server/core/classes/objects/NagiosHost.php   |    4 ++++
 3 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/share/server/core/classes/NagVisAutoMap.php 
b/share/server/core/classes/NagVisAutoMap.php
index 1d860e7..acdb18d 100644
--- a/share/server/core/classes/NagVisAutoMap.php
+++ b/share/server/core/classes/NagVisAutoMap.php
@@ -606,6 +606,7 @@ class NagVisAutoMap extends GlobalMap {
                $hostObject = new NagVisHost($this->CORE, $this->BACKEND, 
$this->backend_id, $hostName);
                $hostObject->fetchMembers();
                
$hostObject->setConfiguration($this->MAPCFG->getObjectConfiguration());
+               $hostObject->setObjectId(0);
                $this->rootObject = $hostObject;
        }
 }
diff --git a/share/server/core/classes/objects/NagVisObject.php 
b/share/server/core/classes/objects/NagVisObject.php
index 7a1ab6c..64f2c8f 100644
--- a/share/server/core/classes/objects/NagVisObject.php
+++ b/share/server/core/classes/objects/NagVisObject.php
@@ -130,6 +130,18 @@ class NagVisObject {
        }
        
        /**
+        * PUBLIC setObjectId()
+        *
+        * Set method for the object id
+        *
+        * @param   Integer    Object id to set for the object
+        * @author  Lars Michelsen <[email protected]>
+        */
+       public function setObjectId($id) {
+               $this->object_id = $id;
+       }
+       
+       /**
         * Get method for the name of the object
         *
         * @return      String          Name of the object
diff --git a/share/server/core/classes/objects/NagiosHost.php 
b/share/server/core/classes/objects/NagiosHost.php
index 94ca4e0..0a78098 100644
--- a/share/server/core/classes/objects/NagiosHost.php
+++ b/share/server/core/classes/objects/NagiosHost.php
@@ -322,6 +322,10 @@ class NagiosHost extends NagVisStatefulObject {
                                        $OBJ->setConfiguration($objConf);
                                        $OBJ->fetchIcon();
                                        
+                                       // The number of objects on the map 
controlls the object id to take
+                                       // 0 is reserved for the root host
+                                       
$OBJ->setObjectId(count($arrHostnames)+1);
+                                       
                                        // Append the object to the 
childObjects array
                                        $this->childObjects[] = $OBJ;
                                        


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Nagvis-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nagvis-checkins

Reply via email to