tree

tree

tree

Database tree management based on Joe Celko's nested tree model.

Metadata

deleteBranch()

Delete a node and the branch beneath it.

Arguments

Name Type Required Default Options Description
dsn string No [runtime expression]
objectid UUID Yes
dbowner string No [runtime expression]

deleteTree()

Arguments

Name Type Required Default Options Description
typename string Yes
dsn string No [runtime expression]
dbowner string No [runtime expression]

deployTree()

Deploy tree table for MSSQL7+.

Arguments

Name Type Required Default Options Description
dsn string Yes [runtime expression]

fixBranch()

Fixes tree from passed root node down. Returns number of nodes below it.

Arguments

Name Type Required Default Options Description
parentid string Yes
nLeft numeric Yes
nLevel numeric Yes
dsn string Yes [runtime expression]
dbowner string No [runtime expression]

getAncestors()

Get a query of objects ordered from the root node to the current node.

Arguments

Name Type Required Default Options Description
objectid UUID Yes
bIncludeSelf boolean No false
dsn string No [runtime expression]
nLevel numeric No
dbowner string No [runtime expression]

getBloodLine()

Get the ancestors, the siblings of each older generation, the siblings and the children of a given objectid.

Arguments

Name Type Required Default Options Description
dsn string Yes [runtime expression]
jointable string Yes
ObjectID string Yes
levelsabove numeric Yes 2
levelsbelow numeric No 1
status string No
dbowner string No [runtime expression]
maxdepth numeric No 0 Sets the maximum depth the tree will go. 0 means unlimited

getChildren()

Get children of the specified node.

Arguments

Name Type Required Default Options Description
dsn string Yes [runtime expression]
objectid UUID Yes
dbowner string No [runtime expression]

getDescendants()

Get the entire branch with the option to hide empty nodes from the results

Arguments

Name Type Required Default Options Description
objectid UUID Yes
depth string No 0
lColumns string No
aFilter array No [runtime expression]
dsn string No [runtime expression]
bIncludeSelf boolean No 0 set this to 1 if you want to include the objectid you are passing
bHideEmptyNodes boolean No 0 Hides empty nodes from results.
l404Check string No externalLink,internalRedirectID,externalRedirectURL,dmHTML,dmLink,dmInclude,dmFlash,dmImage,dmFile
dbowner string No [runtime expression]

getLeaves()

Gets the leaf objects of the nodes passed in

Arguments

Name Type Required Default Options Description
lNodeIds string Yes list of node ids, can be a single node id or just one
dsn string Yes [runtime expression]
dbowner string No [runtime expression]

getNode()

Gets any given node in the nested tree model

Arguments

Name Type Required Default Options Description
objectid UUID Yes
dsn string Yes [runtime expression]
dbowner string No [runtime expression]

getParentID()

Get an objects parent ID in the NTM

Arguments

Name Type Required Default Options Description
objectid string Yes
dsn String No [runtime expression]
dbowner string No [runtime expression]

getRootNode()

Get root node for the specified typename.

Arguments

Name Type Required Default Options Description
dsn string No [runtime expression]
typename string Yes
dbowner string No [runtime expression]

getSecondaryNav()

Get the Secondary Nav

Arguments

Name Type Required Default Options Description
dsn string Yes [runtime expression]
objectid UUID Yes
dbowner string No [runtime expression]

getSiblings()

Get siblings for the node specified. That is, all nodes with the same parent.

Arguments

Name Type Required Default Options Description
dsn string Yes [runtime expression]
objectid UUID Yes
lColumns string No
aFilter array No [runtime expression]
bIncludeSelf boolean No 0 set this to 1 if you want to include the objectid you are passing

moveBranch()

Prune and graft a node and the branch beneath it.

Arguments

Name Type Required Default Options Description
dsn string Yes [runtime expression]
objectid UUID Yes The object that is at the head of the branch to be moved.
parentid UUID Yes The node to which it will be attached as a child. Note this function attaches the node as an only child or as the first child to the left of a group of siblings.
pos numeric No 1 The position in the tree
dbowner string No [runtime expression]

numberOfNodesAtObjectLevel()

The number of nodes at the same level as an object

Arguments

Name Type Required Default Options Description
objectid uuid Yes
dsn string No [runtime expression]
dbowner string No [runtime expression]

rebuildTree()

Fixes tree using parentid/objectid relationship. If nodes returned is 0 then no tree found for typename

Arguments

Name Type Required Default Options Description
typename string Yes dmNavigation
dsn string Yes [runtime expression]
dbowner string No [runtime expression]

rootNodeExists()

Checks to see if a root node of a given type already exists

Arguments

Name Type Required Default Options Description
typename String Yes
dsn string No [runtime expression]
dbowner string No [runtime expression]

setChild()

Set child node.

Arguments

Name Type Required Default Options Description
dsn string No [runtime expression]
parentid UUID Yes The tree node that is the parent.
objectid UUID Yes The child node to be inserted.
objectname string Yes The child node object label.
typename string Yes The child node object type.
pos numeric Yes The position the new child node will take amongst the siblings. 1 = extreme left, 2 = second from left etc.
dbowner string No [runtime expression]

setOldest()

Set node as only or oldest child. That is, a child that appears first in the list of children under the parent (ie. the oldest). Use only for new objects

Arguments

Name Type Required Default Options Description
dsn string Yes [runtime expression]
parentid UUID Yes
objectid UUID Yes
objectname string Yes
typename string Yes
dbowner string No [runtime expression]

setRootNode()

Set root node for a specific object type.

Arguments

Name Type Required Default Options Description
dsn string No [runtime expression]
objectid UUID Yes
objectname string Yes
typename string Yes
dbowner string No [runtime expression]

setYoungest()

Set node as youngest child. That is, a child that appears last in the list of children under the parent (ie. the youngest).

Arguments

Name Type Required Default Options Description
dsn string Yes [runtime expression]
parentid UUID Yes
objectid UUID Yes
objectname string Yes
typename string Yes
dbowner string No [runtime expression]