Node Class

com.bea.content
Node Class

public class Node

    extends ContentEntity

A Node represents an element in a hieararchy.

A Node can either be Hierarchy or Content Node. A Hierarchy Node can contain both other Hierarchy and Content Nodes while a Content Node can only contain other Content Nodes.

Nodes have a few system properties that are set by the repository. Nodes also may contain Properties based on the ObjectClass (type) defined for it. Both Content and Hierarchy Nodes may contain an ObjectClass and Properties.

Nodes are uniquely identified in a repository by the uid on their ID. The uid could be a uuid, database id, the path, etc. All nodes also have a path that uniquely identifies it within the repository. The path should be in unix-like format such as /a/b/c where / is the root and a is the root's child. The path must always begin with / and never end with it. So neither of the following are valid: a/b/c/d or /a/b/d/d/.

Node names must not contain either forward, or backslashes.

A Node's Properties may be lazy loaded, depending on the implementation of the underyling operation that retrieved the Node.


Hierarchy
Object
  ContentEntity
    Node
All Implemented Interfaces

Serializable

Field Summary

public static final int
CONTENT
This defines a Node that represents content, such as a file with metadata.
public static final int
HIERARCHY
This defines a Node as a container, like a Folder.
public static final int
NODE
This could either be a Node.HIERARCHY or Node.CONTENT Node.
   
Fields from  com.bea.content.ContentEntity
id
 

Constructor Summary

Node(Calendar createdDate, String createdBy, boolean hasChildren, ID id, String modifiedBy, Calendar modifiedDate, ObjectClass objectClass, ID parentId, String path, Property properties, int type)

Constructor with all attributes.
 

Method Summary

public Node[]
getChildren()
Returns the children of this node.
public Node[]
getContentChildren()
Returns the Content children of this node.
public String
getCreatedBy()
The user who created this node.
public Calendar
getCreatedDate()
The date this node was created on.
public Node[]
getHierarchyChildren()
Returns the Hierarchy children of this node.
public int
getLifeCycleStatus()
Returns the status for this node.
public String
getModifiedBy()
The user who last modified this Node.
public Calendar
getModifiedDate()
The Date when this Node was last modified.
public String
getName()
The Node name.
public ObjectClass
getObjectClass()
The ObjectClass to which this Node is associated.
public ID
getParentId()
Gets the id for the parent of this node.
public String
getPath()
The path where this Node resides.
public Property
getPrimaryProperty()
Gets the primary property for this Node, or null if there isn't one or when the node doesn't have an object class (such as HIERARCHY nodes).
public Property[]
getProperties()
Gets the Properties for this node.
public Property
getProperty(String name)
Returns the property referenced by name or null if the property does not exist.
public InputStream
getPropertyBytes(ID propertyId)
Returns the bytes for the given property.
public int
getType()
The type of the Node.
public boolean
hasChildren()
True if this node has children.
public void
hasChildren(boolean hasChildren)
Set true if the node has children, false if not.
public boolean
isPropertiesNull()
Returns true if the properties have not been set in memory.
public boolean
isRetired()
public void
isRetired(boolean isRetired)
public void
setCreatedBy(String createdBy)
Sets the user who created this node.
public void
setCreatedDate(Calendar createdDate)
Sets the date this node was created on.
public void
setLifeCycleStataus(int lifeCycleStatus)
Sets the lifecycle status.
public void
setModifiedBy(String modifiedBy)
Sets the user who last modified this Node.
public void
setModifiedDate(Calendar modifiedDate)
Sets the Date when this Node was last modified.
public void
setNodeOps(NodeOps nodeOps)
Sets the NodeOps to perform operations on the repository.
public void
setObjectClass(ObjectClass objectClass)
Sets the ObjectClass to which this Node is associated.
public void
setParentId(ID parentId)
Sets this Node's parent id.
public void
setPath(String path)
Sets the path of this Node.
public void
setProperties(Property[] properties)
Sets the Properties for this node.
public void
setType(int type)
Gets the Node type.
public String
toString()
Returns the attributes of this Node in a String.
 
Methods from  com.bea.content.ContentEntity
getId, setId,
 
Methods from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
   

Field Detail

CONTENT

public static final int CONTENT
This defines a Node that represents content, such as a file with metadata. A Content Node may contain other Content Nodes, but not Hierarchy Nodes.


HIERARCHY

public static final int HIERARCHY
This defines a Node as a container, like a Folder. A Hierarchy Node may contain other Hierarchy nodes as well as Content Nodes.


NODE

public static final int NODE
This could either be a Node.HIERARCHY or Node.CONTENT Node. This is not a valid definition for a Node (Node.getType() should never return this value), but may be used as a description.

 

Constructor Detail

Node

public Node(Calendar createdDate, 
            String createdBy, 
            boolean hasChildren, 
            ID id, 
            String modifiedBy, 
            Calendar modifiedDate, 
            ObjectClass objectClass, 
            ID parentId, 
            String path, 
            Property[] properties, 
            int type)
Constructor with all attributes.
 

Method Detail

getChildren() Method

public Node[] getChildren()
throws AuthorizationException
Returns the children of this node. This is a convenience method to NodeOps.getNodeChildren() and does not keep the retrieved values in memory as part of this instance.

Exceptions

AuthorizationException
- if the user attempting the operation is not authrorized.

getContentChildren() Method

public Node[] getContentChildren()
throws AuthorizationException
Returns the Content children of this node. This is a convenience method to NodeOps.getNodeChildren() and does not keep the retrieved values in memory as part of this instance.

Exceptions

AuthorizationException
- if the user attempting the operation is not authrorized.

getCreatedBy() Method

public String getCreatedBy()
The user who created this node.


getCreatedDate() Method

public Calendar getCreatedDate()
The date this node was created on.


getHierarchyChildren() Method

public Node[] getHierarchyChildren()
throws AuthorizationException
Returns the Hierarchy children of this node. This is a convenience method to NodeOps.getNodeChildren() and does not keep the retrieved values in memory as part of this instance.

Exceptions

AuthorizationException
- if the user attempting the operation is not authrorized.

getLifeCycleStatus() Method

public int getLifeCycleStatus()
Returns the status for this node. The Node lifeCycleStatus does not follow the LifeCycle status changes. It may only be set to PUBLISHED or NOT_PUBLISHED. TODO: REMOVE


getModifiedBy() Method

public String getModifiedBy()
The user who last modified this Node.


getModifiedDate() Method

public Calendar getModifiedDate()
The Date when this Node was last modified.


getName() Method

public String getName()
The Node name. This is the last element in the path.


getObjectClass() Method

public ObjectClass getObjectClass()
The ObjectClass to which this Node is associated.


getParentId() Method

public ID getParentId()
Gets the id for the parent of this node.


getPath() Method

public String getPath()
The path where this Node resides. This is unique to the repository.


getPrimaryProperty() Method

public Property getPrimaryProperty()
throws RepositoryException
Gets the primary property for this Node, or null if there isn't one or when the node doesn't have an object class (such as HIERARCHY nodes).

Exceptions

RepositoryException

getProperties() Method

public Property[] getProperties()
throws AuthorizationException
Gets the Properties for this node. Each property must have a corresponding PropertyDefinition defined in the Node's ObjectClass. If the Properties are not currently in memory, they will be retrieved. If you need to check if the Node instance in memory has its Propereties set, use isPropertiesNull().

Exceptions

AuthorizationException
- if the user attempting the operation is not authrorized.

getProperty(String) Method

public Property getProperty(String name)
throws AuthorizationException
Returns the property referenced by name or null if the property does not exist. If the Properties are not currently in memory, they will be retrieved. If you need to check if the Node instance in memory has its Propereties set, use Node.isPropertiesNull().

Exceptions

AuthorizationException
- if the user attempting the operation is not authrorized.

getPropertyBytes(ID) Method

public InputStream getPropertyBytes(ID propertyId)
throws AuthorizationException, NoSuchPropertyException
Returns the bytes for the given property. This is a convenience method to NodeOps.getPropertyBytes() and does not keep the retrieved values in memory as part of this instance.

WARNING: If using this interface to retrieve binary content from a BEA Repository, please read the javadoc for RepositoryConfig.

Exceptions

AuthorizationException
- if the user attempting the operation is not authrorized.
NoSuchPropertyException
- if the propertyId is not a valid one.

getType() Method

public int getType()
The type of the Node. Either Node.HIERARCHY or Node.CONTENT.


hasChildren() Method

public boolean hasChildren()
True if this node has children. If the node does have children they may be retrieved through the NodeOps.


hasChildren(boolean) Method

public void hasChildren(boolean hasChildren)
Set true if the node has children, false if not. This does not indicate if it currently has them as part of the instance (in memory), or if they will be lazy loaded, but rather simply that they exist.


isPropertiesNull() Method

public boolean isPropertiesNull()
Returns true if the properties have not been set in memory.


isRetired() Method

public boolean isRetired()

isRetired(boolean) Method

public void isRetired(boolean isRetired)

setCreatedBy(String) Method

public void setCreatedBy(String createdBy)
Sets the user who created this node.


setCreatedDate(Calendar) Method

public void setCreatedDate(Calendar createdDate)
Sets the date this node was created on.


setLifeCycleStataus(int) Method

public void setLifeCycleStataus(int lifeCycleStatus)
Sets the lifecycle status. The Node lifeCycleStatus does not follow the LifeCycle status changes. It may only be set to PUBLISHED or NOT_PUBLISHED. TODO: REmove


setModifiedBy(String) Method

public void setModifiedBy(String modifiedBy)
Sets the user who last modified this Node.


setModifiedDate(Calendar) Method

public void setModifiedDate(Calendar modifiedDate)
Sets the Date when this Node was last modified.


setNodeOps(NodeOps) Method

public void setNodeOps(NodeOps nodeOps)
Sets the NodeOps to perform operations on the repository. This NodeOps may be used internally to lazy load attributes such as Properties.


setObjectClass(ObjectClass) Method

public void setObjectClass(ObjectClass objectClass)
Sets the ObjectClass to which this Node is associated.


setParentId(ID) Method

public void setParentId(ID parentId)
Sets this Node's parent id.


setPath(String) Method

public void setPath(String path)
Sets the path of this Node. This is unique to the repository.


setProperties(Property[]) Method

public void setProperties(Property[] properties)
Sets the Properties for this node. Each property must have a corresponding PropertyDefinition defined in the Node's ObjectClass.


setType(int) Method

public void setType(int type)
Gets the Node type. Either Node.HIERARCHY or Node.CONTENT.


toString() Method

public String toString()
Returns the attributes of this Node in a String.

Overrides
ContentEntity.toString()