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
 
_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
 
_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:
  • @require('Manage DMD')

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:
  • @require('Manage DMD')

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

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

_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)