story.dbcore.admin
Class Document

java.lang.Object
  extended by story.dbcore.admin.Document

public class Document
extends java.lang.Object

Container and manager for a set of nodes (separated into different NodeRepositories) and the links between them (stored in a single LinkRepository). Akin to a document of a word processor.

Despite its importance, this class should not be instantiated or handled by anything other than a DBCoreInterface. If you'd like to access any of these functions, construct a Command and pass it to the DBCoreInterface.


Method Summary
 NodeAddress findNodeAddress(NodeID nodeID)
          Find a node by its ID.
 DocumentID getID()
          Get the string identifier for this Document.
 RelatedNodes getLinksOfNode(NodeAddress nodeAddress, LinkType linkType, LinkDirection direction)
          Get a RelatedNodes object through which you could query the nodes which link to or from some node in a Document.
 AttributeValue getNodeAttribute(NodeAddress nodeAddress, AttributeID attribute, boolean overrideInheritance)
          Retrieve a node's attribute's value.
 NodeProxy getNodeProxy(NodeAddress address)
           
 NodeRepositoryID getRepositoryID(NodeRepository repository)
           
 boolean nodeAttributeEquals(NodeAddress nodeAddress, AttributeID attribute, AttributeValue other, boolean overrideInheritance)
          Determine whether a node's attribute is equal to some constant value.
 boolean nodeAttributeGreaterThan(NodeAddress nodeAddress, AttributeID attribute, AttributeValue other, boolean overrideInheritance)
          Determine whether a node's attribute is greater than some constant value.
 CommandReturn unlink(NodeAddress fromAddress, LinkType linkType, NodeAddress toAddress)
          Remove all direct links of a certain type between two nodes in the Document.
 SatisfactionResult validateNodeInstancing(NodeInstancing instancing)
          Determine the validity of a NodeInstancing.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getID

public DocumentID getID()
Get the string identifier for this Document.

Returns:
The identifier.

getRepositoryID

public NodeRepositoryID getRepositoryID(NodeRepository repository)
                                 throws Scheherexception
Throws:
Scheherexception

getNodeProxy

public NodeProxy getNodeProxy(NodeAddress address)
                       throws Scheherexception
Throws:
Scheherexception

unlink

public CommandReturn unlink(NodeAddress fromAddress,
                            LinkType linkType,
                            NodeAddress toAddress)
                     throws Scheherexception
Remove all direct links of a certain type between two nodes in the Document.

Parameters:
from - The node on the left side of the link.
linkType - The type of link to remove.
to - The node on the right side of the link.
Throws:
NoSuchLinks - If there are no such links.
Scheherexception - If some other error occurs.

getLinksOfNode

public RelatedNodes getLinksOfNode(NodeAddress nodeAddress,
                                   LinkType linkType,
                                   LinkDirection direction)
                            throws Scheherexception
Get a RelatedNodes object through which you could query the nodes which link to or from some node in a Document.

Parameters:
to - The node on the right side of the relation
linkType - The type of link the nodes will be related as
direction - The appropriate LinkDirection: From will return nodes that occur on the right side of the link from the given node; To for nodes on the left side.
Returns:
A RelatedNodes if there are such nodes, null otherwise.
Throws:
Scheherexception

findNodeAddress

public NodeAddress findNodeAddress(NodeID nodeID)
                            throws Scheherexception
Find a node by its ID. Throws an exception if there is no such node with the ID, or more than one node with the ID.

Throws:
Scheherexception

getNodeAttribute

public AttributeValue getNodeAttribute(NodeAddress nodeAddress,
                                       AttributeID attribute,
                                       boolean overrideInheritance)
                                throws Scheherexception
Retrieve a node's attribute's value.

Throws:
Scheherexception

nodeAttributeEquals

public boolean nodeAttributeEquals(NodeAddress nodeAddress,
                                   AttributeID attribute,
                                   AttributeValue other,
                                   boolean overrideInheritance)
                            throws Scheherexception
Determine whether a node's attribute is equal to some constant value.

Throws:
Scheherexception

nodeAttributeGreaterThan

public boolean nodeAttributeGreaterThan(NodeAddress nodeAddress,
                                        AttributeID attribute,
                                        AttributeValue other,
                                        boolean overrideInheritance)
                                 throws Scheherexception
Determine whether a node's attribute is greater than some constant value.

Throws:
Scheherexception

validateNodeInstancing

public SatisfactionResult validateNodeInstancing(NodeInstancing instancing)
                                          throws Scheherexception
Determine the validity of a NodeInstancing.

Throws:
Scheherexception


Copyright © 2011 David K. Elson. All Rights Reserved.