Module: nagvis
Branch: nagvis-1.4
Commit: 37a8aa07c554f671594f7ff4bdeb47a506682a4d
URL:    
http://nagvis.git.sourceforge.net/git/gitweb.cgi?p=nagvis/nagvis;a=commit;h=37a8aa07c554f671594f7ff4bdeb47a506682a4d

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

#147 Ensuring that there are no duplicate object_ids

---

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

diff --git a/nagvis/nagvis/includes/classes/NagVisAutoMap.php 
b/nagvis/nagvis/includes/classes/NagVisAutoMap.php
index 92baed4..cb8ab1a 100644
--- a/nagvis/nagvis/includes/classes/NagVisAutoMap.php
+++ b/nagvis/nagvis/includes/classes/NagVisAutoMap.php
@@ -557,6 +557,7 @@ class NagVisAutoMap extends GlobalMap {
                $hostObject = new NagVisHost($this->CORE, $this->BACKEND, 
$this->backend_id, $hostName);
                $hostObject->fetchMembers();
                $hostObject->setConfiguration($this->getObjectConfiguration());
+               $hostObject->setObjectId(0);
                $this->rootObject = $hostObject;
        }
 }
diff --git a/nagvis/nagvis/includes/classes/objects/NagVisObject.php 
b/nagvis/nagvis/includes/classes/objects/NagVisObject.php
index d3aafcb..3f3f54c 100644
--- a/nagvis/nagvis/includes/classes/objects/NagVisObject.php
+++ b/nagvis/nagvis/includes/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/nagvis/nagvis/includes/classes/objects/NagiosHost.php 
b/nagvis/nagvis/includes/classes/objects/NagiosHost.php
index 94ca4e0..0a78098 100644
--- a/nagvis/nagvis/includes/classes/objects/NagiosHost.php
+++ b/nagvis/nagvis/includes/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