This class provides a mechanism for caching different parts of a hierarchy and
acts as an interface between the datastructures and the database. A single instance of this class will be included with a single
object and all its
objects.
The class maintains a single
object called
that will store the parts of the hierarchy already cached. In addition, there is a special array called
- tree
. Given an id of a cached node, this array enables us to determine whether any of the node's inheritors or ancestors have been cached as well. In specific, each element of the array corresponds to a unique node (each index of the array is a node id) and is another array storing one
- cache
object and two integer values. If any of the integer values is positive, then that means that we have information about the cache status of the node's immediate ancestors or inheritors. Specifically, the two integer values determine the amount of caching, i.e. the first integer specifies the number of tree levels cached down the node, and the second integer specifies the number of tree levels cached up the node. If any of these values is negative then that means that the caching extends all the way up or down. If any of the two values is zero, then nothing has been cached in the corresponding direction.
Caching occurs when the user calls the accessor methods of the
class, i.e.
,
- traverse()
or
.
Located in /harmoni/core/oki2/hierarchy/HierarchyCache.class.php (line 39)
This is true if the hierarchy will allow multiple parents.
Given an id of a cached node,
this array enables us to determine whether any of the node's inheritors or ancestors have been cached as well. In specific, each element of the array corresponds to a unique node (each index of the array is a node id) and is another array storing one
object and two integer values. If any of the integer values is positive, then that means that we have information about the cache status of the node's immediate ancestors or inheritors. Specifically, the two integer values determine the amount of caching, i.e. the first integer specifies the number of tree levels cached down the node, and the second integer specifies the number of tree levels cached up the node. If any of these values is negative then that means that the caching extends all the way down or up. If any of the two values is zero, then nothing has been cached in the corresponding direction.
The database connection as returned by the DBHandler.
The id of the hierarchy.
A cache of the created traversalInfoObjects. Intended to help solve some of the memory blowup in Concerto. Checking 20 AZs on about 25 Assets in Concerto was traversing such that ~100,000 HarmoniTraversalInfo objects were being created.
This is a SELECT query that we will often use to get one single node from the database.
Constructor
Makes the first node the parent of the second node.
Clear the ancestory rows for a given node
Attempts to create the specified node in the database and adds the specified parent.
Attempts to create the specified node as root node in the database.
Attempts to delete the specified node in the database. Only leaf nodes can be deleted.
Caches the children (if not cached already) of the given node by fecthing them from the database if neccessary, and then inserting them in
and updating
- _tree
.
- _cache
Returns (and caches if necessary) the node with the specified string id.
Gets node(s) from the database that match the criteria specified by the given where condition.
Caches the parents (if not cached already) of the given node by fecthing them from the database if neccessary, and then inserting them in
and updating
- _tree
.
- _cache
Return true if the node is a leaf
Returns true if the node specified by the idString exists. The node is cached for future access if it is found
Build the ancestory rows for a given node
Build the ancestory rows for a node and its decendents
Removes the first node from the list of parents of the second node.
Performs a depth-first pre-order traversal. It either returns the previously cached nodes or fetches them from the database and then caches them (depending on whtether they had been already cached).
, this argument specifies that the traversal will go down the children; if
- true
then it will go up the parents.
- false
Returns
if the node with the specified string id has been cached.
- true
Determines whether a node has been cached down
Determines whether a node has been cached up
Traverses down and caches whatever needs to be cached.
Traverses up and caches whatever needs to be cached.
Traverses up the ancestory table and caches whatever needs to be cached.
Documentation generated on Wed, 19 Sep 2007 10:24:31 -0400 by phpDocumentor 1.3.0RC3