Package Products :: Package Zuul :: Package routers :: Class TreeRouter
[hide private]
[frames] | no frames]

Class TreeRouter

source code

ZenUtils.Ext.DirectRouter --+
                            |
                           TreeRouter

A common base class for routers that have a hierarchical tree structure.

Instance Methods [hide private]
dictionary
addNode(self, type, contextUid, id, description=None)
Add a node to the existing tree underneath the node specified by the context UID
source code
DirectResponse
deleteNode(self, uid)
Deletes a node from the tree.
source code
DirectResponse
moveOrganizer(self, targetUid, organizerUid)
Move the organizer uid to be underneath the organizer specified by the targetUid.
source code
 
gzip_b64(self, string)
gzip an arbitrary string, base64 encode it, and return it
source code
 
gunzip_b64(self, string)
Base 64 decode a string, then gunzip it and return the result as JSON.
source code
 
_getFacade(self)
Abstract method for child classes to use to get their facade
source code
[dictionary]
asyncGetTree(self, id=None, additionalKeys=())
Server side method for asynchronous tree calls.
source code
DirectResponse
objectExists(self, uid)
Returns: Properties:
source code
 
_canDeleteUid(self, uid)
We can not delete top level UID's.
source code
Method Details [hide private]

addNode(self, type, contextUid, id, description=None)

source code 

Add a node to the existing tree underneath the node specified by the context UID

Parameters:
  • type (string) - Either 'class' or 'organizer'
  • contextUid (string) - Path to the node that will be the new node's parent (ex. /zport/dmd/Devices)
  • id (string) - Identifier of the new node, must be unique in the parent context
  • description (string) - (optional) Describes this new node (default: None)
Returns: dictionary
Marshaled form of the created node
Decorators:
  • @contextRequire("Manage DMD", 'contextUid')

deleteNode(self, uid)

source code 

Deletes a node from the tree.

NOTE: You can not delete a root node of a tree

Parameters:
  • uid (string) - Unique identifier of the node we wish to delete
Returns: DirectResponse
Properties:
  • msg: (string) Status message
Decorators:
  • @contextRequire("Manage DMD", 'uid')

moveOrganizer(self, targetUid, organizerUid)

source code 

Move the organizer uid to be underneath the organizer specified by the targetUid.

Parameters:
  • targetUid (string) - New parent of the organizer
  • organizerUid (string) - The organizer to move
Returns: DirectResponse
Properties:
  • data: (dictionary) Moved organizer

gunzip_b64(self, string)

source code 

Base 64 decode a string, then gunzip it and return the result as JSON. The input to this method should be gzipped, base 64 encoded JSON. Base 64 encoded strings are allowed to have up to 2 '='s of padding. The zenoss Ext router eats these, so there is some logic to try padding them back into the string should initial decoding fail.

asyncGetTree(self, id=None, additionalKeys=())

source code 

Server side method for asynchronous tree calls. Retrieves the immediate children of the node specified by "id"

NOTE: our convention on the UI side is if we are asking for the root node then return the root and its children otherwise just return the children

Parameters:
  • id (string) - The uid of the node we are getting the children for
Returns: [dictionary]
Object representing the immediate children

objectExists(self, uid)

source code 
Returns: DirectResponse
  • Properties:
    • exists - Returns true if we can find the object specified by the uid

_canDeleteUid(self, uid)

source code 

We can not delete top level UID's. For example:

  • '/zport/dmd/Processes' this will return False (we can NOT delete)
  • '/zport/dmd/Processes/Child' will return True (we can delete this)