edu.mit.stellar.api.ecm
Interface Node

All Known Subinterfaces:
NodeM

public interface Node

Node Interface for accessing readable properties a node in the ECM. An object implementing only this interface is immutable.

Version:
$Revision: 29988 $, $Date: 2008-02-09 22:10:42 -0500 (Sat, 09 Feb 2008) $
Author:
MIT Stellar team

Method Summary
 java.util.Date getAccessed()
          cm:accessed mandatory property with direct accessor.
 Node getAncestor(int degree)
          From JCR Item interface, probably useful.
 java.lang.String getCorrespondingNodePath()
          (adapted) From JCR Node interface, needed.
 java.util.Date getCreated()
          cm:created mandatory property with direct accessor.
 java.lang.String getCreator()
          cm:creator mandatory property with direct accessor.
 int getDepth()
          From JCR Item interface, probably useful.
 java.lang.String getDescription()
          cm:description mandatory property with direct accessor.
 int getIndex()
          From JCR Node interface, needed.
 java.util.Date getModified()
          cm:modified mandatory property with direct accessor.
 java.lang.String getModifier()
          cm:modifier mandatory property with direct accessor.
 java.lang.String getName()
          From JCR Item interface, probably needed.
 Node getNode(java.lang.String relPath)
          From JCR Node interface, needed.
 java.util.List<Node> getNodes()
          From JCR Node interface, needed.
 java.util.List<Node> getNodes(java.lang.String namePattern)
          From JCR Node interface, needed.
 Node getParent()
          From JCR Item interface, needed.
 java.lang.String getPath()
          From JCR Item interface, needed.
 Node getPrimaryItem()
          From JCR Node interface, probably useful.
 java.util.List<javax.jcr.Property> getProperties()
          From JCR Node interface, needed.
 java.util.List<javax.jcr.Property> getProperties(java.lang.String namePattern)
          From JCR Node interface, needed.
 javax.jcr.Property getProperty(java.lang.String relPath)
          From JCR Node interface, needed.
 java.lang.String getTitle()
          cm:title mandatory property with direct accessor.
 java.lang.String getUUID()
          From JCR Node interface, needed.
 boolean hasNode(java.lang.String relPath)
          From JCR Node interface, needed.
 boolean hasNodes()
          From JCR Node interface, needed.
 boolean hasProperties()
          From JCR Node interface, needed.
 boolean hasProperty(java.lang.String relPath)
          From JCR Node interface, needed.
 boolean isSame(Node otherNode)
          From JCR Item interface, may be useful.
 

Method Detail

getAncestor

Node getAncestor(int degree)
From JCR Item interface, probably useful. Returns the ancestor of the specified depth. An ancestor of depth x is the Item that is x levels down along the path from the root node to this Item. If depth > n is specified then a ItemNotFoundException is thrown.

Parameters:
depth - An integer, 0 <= depth <= n where n is the depth of this Item.
Returns:
The ancestor of this Item at the specified depth.
Throws:
ItemNotFoundException - if depth < 0 or depth > n where n is the is the depth of this item.
AccessDeniedException - if the current session does not have sufficient access rights to retrieve the specified node.
RepositoryException - if another error occurs.

getDepth

int getDepth()
             throws java.lang.Exception
From JCR Item interface, probably useful. Returns the depth of this Item in the workspace tree. Returns the depth below the root node of this Item (counting this Item itself).

Returns:
The depth of this Item in the workspace hierarchy.
Throws:
RepositoryException - if an error occurs.
java.lang.Exception

getName

java.lang.String getName()
                         throws java.lang.Exception
From JCR Item interface, probably needed. Returns the name of this Item. The name of an item is the last element in its path, minus any square-bracket index that may exist. If this Item is the root node of the workspace (i.e., if this.getDepth() == 0), an empty string will be returned.

Returns:
the (or a) name of this Item or an empty string if this Item is the root node.
Throws:
RepositoryException - if an error occurs.
java.lang.Exception

getParent

Node getParent()
               throws java.lang.Exception
From JCR Item interface, needed. Returns the parent of this Item.

Returns:
The parent of this Item.
Throws:
ItemNotFoundException - if there is no parent. This only happens if this item is the root node of a workspace.
AccessDeniedException - if the current session does not have sufficient access rights to retrieve the parent of this item.
RepositoryException - if another error occurs.
java.lang.Exception

getPath

java.lang.String getPath()
                         throws java.lang.Exception
From JCR Item interface, needed. Returns the absolute path to this item. If the path includes items that are same-name sibling nodes properties then those elements in the path will include the appropriate "square bracket" index notation (for example, /a/b[3]/c).

Returns:
the path of this Item.
Throws:
RepositoryException - if an error occurs.
java.lang.Exception

isSame

boolean isSame(Node otherNode)
               throws java.lang.Exception
From JCR Item interface, may be useful. Returns true if this Node object (the Java object instance) represents the same actual repository item as the object otherNode.

This method does not compare the states of the two items. For example, if two Node objects representing the same actual repository item have been retrieved through two different sessions and one has been modified, then this method will still return true for these two objects. Note that if two Node objects representing the same repository item are retrieved through the same session they will always reflect the same state (see section 6.3.1 Reflecting Node State in the specification document) so comparing state is not an issue.

Parameters:
otherNode - the Node object to be tested for identity with this Node.
Returns:
true if this Node object and otherNode represent the same actual repository item; false otherwise.
Throws:
RepositoryException - if an error occurs.
java.lang.Exception

getNode

Node getNode(java.lang.String relPath)
             throws java.lang.Exception
From JCR Node interface, needed. Returns the node at relPath relative to this node.

If relPath contains a path element that refers to a node with same-name sibling nodes without explicitly including an index using the array-style notation ([x]), then the index [1] is assumed (indexing of same name siblings begins at 1, not 0, in order to preserve compatibility with XPath).

Within the scope of a single Session object, if a Node object has been acquired, any subsequent call of getNode reacquiring the same node must return a Node object reflecting the same state as the earlier Node object. Whether this object is actually the same Node instance, or simply one wrapping the same state, is up to the implementation.

Parameters:
relPath - The relative path of the node to retrieve.
Returns:
The node at relPath.
Throws:
PathNotFoundException - If no node exists at the specified path.
RepositoryException - If another error occurs.
java.lang.Exception

getNodes

java.util.List<Node> getNodes()
                              throws java.lang.Exception
From JCR Node interface, needed. Return a List rather than an iterator for efficient bulk operation. Returns a NodeIterator over all child Nodes of this Node. Does not include properties of this Node. The same reacquisition semantics apply as with getNode(String). If this node has no child nodes, then an empty iterator is returned.

Returns:
A NodeIterator over all child Nodes of this Node.
Throws:
RepositoryException - If an error occurs.
java.lang.Exception

getNodes

java.util.List<Node> getNodes(java.lang.String namePattern)
                              throws java.lang.Exception
From JCR Node interface, needed. Return a List rather than an iterator for efficient bulk operation. Gets all child nodes of this node that match namePattern. The pattern may be a full name or a partial name with one or more wildcard characters ("*"), or a disjunction (using the "|" character to represent logical OR) of these. For example,

N.getNodes("jcr:* | myapp:report | my doc")

would return a NodeIterator holding all child nodes of N that are either called 'myapp:report', begin with the prefix 'jcr:' or are called 'my doc'.

Note that leading and trailing whitespace around a disjunct is ignored, but whitespace within a disjunct forms part of the pattern to be matched.

The EBNF for namePattern is:

namePattern ::= disjunct {'|' disjunct}
disjunct ::= name [':' name]
name ::= '*' | ['*'] fragment {'*' fragment} ['*']
fragment ::= char {char}
char ::= nonspace | ' '
nonspace ::= (* Any Unicode character except: '/', ':', '[', ']', '*', ''', '"', '|' or any whitespace character *)

The pattern is matched against the names (not the paths) of the immediate child nodes of this node.

If this node has no matching child nodes, then an empty iterator is returned.

The same reacquisition semantics apply as with getNode(String).

Parameters:
namePattern - a name pattern
Returns:
a NodeIterator
Throws:
RepositoryException - If an unexpected error occurs.
java.lang.Exception

getProperty

javax.jcr.Property getProperty(java.lang.String relPath)
                               throws java.lang.Exception
From JCR Node interface, needed. Returns the property at relPath relative to this node. The same reacquisition semantics apply as with getNode(String).

Parameters:
relPath - The relative path of the property to retrieve.
Returns:
The property at relPath.
Throws:
PathNotFoundException - If no property exists at the specified path.
RepositoryException - If another error occurs.
java.lang.Exception

getProperties

java.util.List<javax.jcr.Property> getProperties()
                                                 throws java.lang.Exception
From JCR Node interface, needed. Return a List rather than an iterator for efficient bulk operation. Returns all properties of this node. Returns a PropertyIterator over all properties of this node. Does not include child nodes of this node. The same reacquisition semantics apply as with getNode(String). If this node has no properties, then an empty iterator is returned.

Returns:
A PropertyIterator.
Throws:
RepositoryException - If an error occurs.
java.lang.Exception

getProperties

java.util.List<javax.jcr.Property> getProperties(java.lang.String namePattern)
                                                 throws java.lang.Exception
From JCR Node interface, needed. Return a List rather than an iterator for efficient bulk operation. Gets all properties of this node that match namePattern. The pattern may be a full name or a partial name with one or more wildcard characters ("*"), or a disjunction (using the "|" character to represent logical OR) of these. For example,

N.getProperties("jcr:* | myapp:name | my doc")

would return a PropertyIterator holding all properties of N that are either called 'myapp:name', begin with the prefix 'jcr:' or are called 'my doc'.

Note that leading and trailing whitespace around a disjunct is ignored, but whitespace within a disjunct forms part of the pattern to be matched.

The EBNF for namePattern is:

namePattern ::= disjunct {'|' disjunct}
disjunct ::= name [':' name]
name ::= '*' | ['*'] fragment {'*' fragment} ['*']
fragment ::= char {char}
char ::= nonspace | ' '
nonspace ::= (* Any Unicode character except: '/', ':', '[', ']', '*', ''', '"', '|' or any whitespace character *)

The pattern is matched against the names (not the paths) of the immediate child properties of this node.

If this node has no matching properties, then an empty iterator is returned.

The same reacquisition semantics apply as with getNode(String).

Parameters:
namePattern - a name pattern
Returns:
a PropertyIterator
Throws:
RepositoryException - If an unexpected error occurs.
java.lang.Exception

getPrimaryItem

Node getPrimaryItem()
                    throws java.lang.Exception
From JCR Node interface, probably useful. Returns the primary child item of this node. The primary node type of this node may specify one child item (child node or property) of this node as the primary child item. This method returns that item. If this node does not have a primary item, either because none is declared in the node type or because a declared primary item is not present on this node instance, then this method throws an ItemNotFoundException. The same reacquisition semantics apply as with getNode(String).

Returns:
the primary child item.
Throws:
ItemNotFoundException - if this node does not have a primary child item, either because none is declared in the node type or because a declared primary item is not present on this node instance.
RepositoryException - if another error occurs.
java.lang.Exception

getUUID

java.lang.String getUUID()
                         throws java.lang.Exception
From JCR Node interface, needed. Returns the UUID of this node as recorded in this node's jcr:uuid property. This method only works on nodes of mixin node type mix:referenceable. On nonreferenceable nodes, this method throws an UnsupportedRepositoryOperationException. To avoid throwing an exception to determine whether a node has a UUID, a call to isNodeType("mix:referenceable") can be made.

Returns:
the UUID of this node
Throws:
UnsupportedRepositoryOperationException - If this node nonreferenceable.
RepositoryException - If another error occurs.
java.lang.Exception

getIndex

int getIndex()
             throws java.lang.Exception
From JCR Node interface, needed. This method returns the index of this node within the ordered set of its same-name sibling nodes. This index is the one used to address same-name siblings using the square-bracket notation, e.g., /a[3]/b[4]. Note that the index always starts at 1 (not 0), for compatibility with XPath. As a result, for nodes that do not have same-name-siblings, this method will always return 1.

Returns:
The index of this node within the ordered set of its same-name sibling nodes.
Throws:
RepositoryException - if an error occurs.
java.lang.Exception

hasNode

boolean hasNode(java.lang.String relPath)
                throws java.lang.Exception
From JCR Node interface, needed. Indicates whether a node exists at relPath Returns true if a node exists at relPath and false otherwise.

Parameters:
relPath - The path of a (possible) node.
Returns:
true if a node exists at relPath; false otherwise.
Throws:
RepositoryException - If an unspecified error occurs.
java.lang.Exception

hasProperty

boolean hasProperty(java.lang.String relPath)
                    throws java.lang.Exception
From JCR Node interface, needed. Indicates whether a property exists at relPath Returns true if a property exists at relPath and false otherwise.

Parameters:
relPath - The path of a (possible) property.
Returns:
true if a property exists at relPath; false otherwise.
Throws:
RepositoryException - If an unspecified error occurs.
java.lang.Exception

hasNodes

boolean hasNodes()
                 throws java.lang.Exception
From JCR Node interface, needed. Indicates whether this node has child nodes. Returns true if this node has one or more child nodes; false otherwise.

Returns:
true if this node has one or more child nodes; false otherwise.
Throws:
RepositoryException - If an unspecified error occurs.
java.lang.Exception

hasProperties

boolean hasProperties()
                      throws java.lang.Exception
From JCR Node interface, needed. Indicates whether this node has properties. Returns true if this node has one or more properties; false otherwise.

Returns:
true if this node has one or more properties; false otherwise.
Throws:
RepositoryException - If an unspecified error occurs.
java.lang.Exception

getCorrespondingNodePath

java.lang.String getCorrespondingNodePath()
                                          throws java.lang.Exception
(adapted) From JCR Node interface, needed. Returns the absolute path of the node in the specified workspace that corresponds to this node.

The corresponding node is defined as the node in srcWorkspace with the same UUID as this node or, if this node has no UUID, the same path relative to the nearest ancestor that does have a UUID, or the root node, whichever comes first. This is qualified by the requirment that referencable nodes only correspond with other referencables and non-referenceables with other non-referenceables.

If no corresponding node exists then an ItemNotFoundException is thrown.

If the specified workspace does not exist then a NoSuchWorkspaceException is thrown.

If the current Session does not have sufficent rights to perform this operation, an AccessDeniedException is thrown.

Returns:
the absolute path to the corresponding node.
Throws:
ItemNotFoundException - if no corresponding node is found.
NoSuchWorkspaceException - if the workspace is unknown.
AccessDeniedException - if the current session has insufficent rights to perform this operation.
RepositoryException - if another error occurs.
java.lang.Exception

getCreated

java.util.Date getCreated()
                          throws java.lang.Exception
cm:created mandatory property with direct accessor. Equal to Stellar legacy getCreatedDate().

Returns:
cm:created property = jcr:created
Throws:
RepositoryException - if an error occurs.
java.lang.Exception

getCreator

java.lang.String getCreator()
                            throws java.lang.Exception
cm:creator mandatory property with direct accessor. Equal to Stellar legacy getCreatedBy().

Returns:
cm:creator property
Throws:
RepositoryException - if an error occurs.
java.lang.Exception

getModified

java.util.Date getModified()
                           throws java.lang.Exception
cm:modified mandatory property with direct accessor. Equal to Stellar legacy getLastModified().

Returns:
cm:modified property = jcr:lastModified
Throws:
RepositoryException - if an error occurs.
java.lang.Exception

getModifier

java.lang.String getModifier()
                             throws java.lang.Exception
cm:modifier mandatory property with direct accessor. Equal to Stellar legacy getLastModifiedBy().

Returns:
cm:modifier property
Throws:
RepositoryException - if an error occurs.
java.lang.Exception

getAccessed

java.util.Date getAccessed()
                           throws java.lang.Exception
cm:accessed mandatory property with direct accessor.

Returns:
cm:accessed property
Throws:
RepositoryException - if an error occurs.
java.lang.Exception

getTitle

java.lang.String getTitle()
                          throws java.lang.Exception
cm:title mandatory property with direct accessor. Equal to Stellar legacy getLongName().

Returns:
cm:title property
Throws:
RepositoryException - if an error occurs.
java.lang.Exception

getDescription

java.lang.String getDescription()
                                throws java.lang.Exception
cm:description mandatory property with direct accessor. Equal to Stellar legacy getDescription().

Returns:
cm:description property
Throws:
RepositoryException - if an error occurs.
java.lang.Exception


Copyright © 2007-2008 MIT IS&T ISDA. All Rights Reserved.