NodeOpsImpl Class

com.bea.p13n.content.adapter
NodeOpsImpl Class

public class NodeOpsImpl

    extends BaseOps
    implements NodeOps

A WLP Content Repository-to-ContentManager node ops.

The uid of IDs for Nodes from this will be the Content identifier.

The uid of IDs for Propertys from Nodes from this will be contentidentifier/propname

.

Additionlly, Documents will have a magic Property "content" which will refer to the bytes of the Document, plus getMimeType(), getProperty("encoding"), getSize(), and getName().


Hierarchy
Object
  BaseOps
    NodeOpsImpl
All Implemented Interfaces

NodeOps, Serializable

Field Summary

protected ObjectClassOpsImpl
objectClassOps
ObjectClassOpsImpl
   
Fields from  com.bea.p13n.content.adapter.BaseOps
CONTENT_MANAGER_HOME, credentials, PATH_IS_ID, PATH_STARTS_WITH_SLASH, pathIsId, pathStartsWithSlash, properties
 

Constructor Summary

NodeOpsImpl(Credentials credentials, Properties properties, ObjectClassOpsImpl objectClassOps)

 

Method Summary

public Node
addNodeContent(ID nodeId, ID objectClassId, Property[] properties)
Updates the node with the given id to contain the given objectClass and properties.
public Node
convert(String reponame, Content content)
Convert a Content object to a Node.
public Node
copyNode(ID sourceId, ID destinationId)
This method copies a Node to a new location (Folder) in the hierarchy along with all its descendants.
public Property
createContentProperty(String reponame, String contentId, Document doc)
Create a Property for the magic "content" property for a Document.
public Node
createNode(ID parentId, String newNodeName, int type)
This method creates a new Node underneath the parent.
public Node
createNode(ID parentId, String newNodeName, int type, ID objectClassId, Property[] properties)
This method creates a new Node underneath the parent.
public Property
createProperty(String reponame, String contentId, String name, Object val)
Create a Property object.
public Value
createValue(Object val)
Create a Value object for the given object value.
public void
deleteNode(ID nodeId)
This method performs a full cascade delete on a Node.
public Node
getNode(ID nodeId)
This method gets a particular Node based on its id.
public Node
getNode(String path)
This method gets a particular Node based on its id.
public Node[]
getNodeChildren(ID parentId, int type)
This method returns an array of Nodes based on the parent Folder.
public Node[]
getNodes(ID[] nodeIds)
This method gets the Node for each node ID passed in.
public String
getPath(Content content)
Get the new CM API path for a Content object.
public Property[]
getProperties(ID nodeId)
Gets all Properties for a Node.
public Property[]
getProperties(String reponame, Content content)
Get Property objects representing (potentially) all of the metadata attributes of the Node.
public InputStream
getPropertyBytes(ID propertyId)
Gets the Binary data for the given Property Id.
public Node
moveNode(ID sourceId, ID destinationId)
This method moves a Node to a new location (Folder) in the hierarchy along with all its descendants.
public Node
removeNodeContent(ID nodeId)
Removes the ObjectClass from the given Node.
public Node
renameNode(ID nodeId, String newName)
This method renames a node and implicitly all of its descendants paths.
public Node
updateProperties(ID nodeId, Property[] properties)
Updates the node with the given id with the given properties.
 
Methods from  com.bea.p13n.content.adapter.BaseOps
getContentManager, unsupported
 
Methods from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
   
Methods from interface com.bea.content.spi.NodeOps
addNodeContent, copyNode, createNode, createNode, deleteNode, getNode, getNode, getNodeChildren, getNodes, getProperties, getPropertyBytes, moveNode, removeNodeContent, renameNode, updateProperties
 

Field Detail

objectClassOps

protected ObjectClassOpsImpl objectClassOps

 

Constructor Detail

NodeOpsImpl

public NodeOpsImpl(Credentials credentials, 
                   Properties properties, 
                   ObjectClassOpsImpl objectClassOps)
 

Method Detail

addNodeContent(ID, ID, Property[]) Method

public Node addNodeContent(ID nodeId, 
                           ID objectClassId, 
                           Property[] properties)
Updates the node with the given id to contain the given objectClass and properties. If the node already contains Properties they will be updated with the given properties. If the node does not already contain properties then the given properties will be created and added to the node.

Parameters

nodeId
the node to update.

Returns

Node- the updated Node.

convert(String, Content) Method

public Node convert(String reponame, 
                    Content content)
Convert a Content object to a Node.


copyNode(ID, ID) Method

public Node copyNode(ID sourceId, 
                     ID destinationId)
This method copies a Node to a new location (Folder) in the hierarchy along with all its descendants. Each Node will get a new Id, parent id and new Properties. A node may not be copied at or below itself in the hierarchy.s

Parameters

sourceId
the id of the Node to be copied
destinationId
the id of the Node under which the sourceId Node is copied

Returns

Node- the copied Node- with a new path

createContentProperty(String, String, Document) Method

public Property createContentProperty(String reponame, 
                                      String contentId, 
                                      Document doc)
Create a Property for the magic "content" property for a Document.


createNode(ID, String, int) Method

public Node createNode(ID parentId, 
                       String newNodeName, 
                       int type)
throws RepositoryException
This method creates a new Node underneath the parent. If the parent is null then the new Node is created under root.

Parameters

parentId
the id for the parent of the node. It is null if the parent is root.
newNodeName
the name of Node to create.
type
the type of node, either FOLDER or FILE.

Returns

Node- the newly created node.

Exceptions

RepositoryException

createNode(ID, String, int, ID, Property[]) Method

public Node createNode(ID parentId, 
                       String newNodeName, 
                       int type, 
                       ID objectClassId, 
                       Property[] properties)
throws RepositoryException
This method creates a new Node underneath the parent. If the parent is null then the new Node is created under root. It associates the ObjectClass with the given id to the new Node and adds the given properties (content and meta-content) to the Node. If there is a PropertyDefintion in the given ObjectClass with no corresponding Property in the properties array a Property will be created with a null value, unless the Property is required, in which case a validation exception will be thrown.

Parameters

parentId
- the id for the parent of the node. It is null if the parent is root.
newNodeName
- the name of Node to create.
type
- the type of node- either HIERARCHY or CONTENT.
objectClassId
- the ID for the ObjectClass to associate the new Node to.
properties
- the properties to add to the new Node.

Returns

Node - the newly created Node.

Exceptions

RepositoryException
- if a system error occurs.

createProperty(String, String, String, Object) Method

public Property createProperty(String reponame, 
                               String contentId, 
                               String name, 
                               Object val)
Create a Property object.


createValue(Object) Method

public Value createValue(Object val)
Create a Value object for the given object value.


deleteNode(ID) Method

public void deleteNode(ID nodeId)
This method performs a full cascade delete on a Node. As such, the node, all its descendant Nodes and each Nodes Properties are removed in the process.

Parameters

nodeId
the id of the Node to be deleted

getNode(ID) Method

public Node getNode(ID nodeId)
throws NoSuchNodeException
This method gets a particular Node based on its id. The node that is returned contains all Properties associated with the node and also its ObjectClass.

Parameters

nodeId
the id for the node to get.

Returns

Node- the retrieved Node.

Exceptions

NoSuchNodeException

getNode(String) Method

public Node getNode(String path)
throws NoSuchNodeException
This method gets a particular Node based on its id. The node that is returned contains all Properties associated with the node and also its ObjectClass.

Parameters

path
- the path for the node to get.

Returns

Node- the retrieved Node.

Exceptions

NoSuchNodeException

getNodeChildren(ID, int) Method

public Node[] getNodeChildren(ID parentId, 
                            int type)
This method returns an array of Nodes based on the parent Folder. Empty array in this case.

Parameters

parentId
the Folder Node which may have children (Files can't)
type
the type of children to return, either FOLDER or FILE

Returns

array- empty array since we don't expose hierarchy.

getNodes(ID[]) Method

public Node[] getNodes(ID[] nodeIds)
throws NoSuchNodeException
This method gets the Node for each node ID passed in. Each Node contains all Properties associated with it and also its ObjectClass.

Parameters

nodeIds
the Node IDs to retrieve the Nodes for.

Returns

Node[]- the retrieved Nodes.

Exceptions

NoSuchNodeException

getPath(Content) Method

public String getPath(Content content)
Get the new CM API path for a Content object.


getProperties(ID) Method

public Property[] getProperties(ID nodeId)
throws NoSuchNodeException
Gets all Properties for a Node.

Parameters

nodeId
the id for the node.

Returns

Property[]- array of Node Properties.

Exceptions

NoSuchNodeException

getProperties(String, Content) Method

public Property[] getProperties(String reponame, 
                              Content content)
Get Property objects representing (potentially) all of the metadata attributes of the Node.

This only fully supports Content object from the old SPI implementation. If someone reimplemented the ContentManager/DocumentManager interface instead, then this will only return Property object representing the known getter methods on Content and/or Document.


getPropertyBytes(ID) Method

public InputStream getPropertyBytes(ID propertyId)
throws NoSuchPropertyException
Gets the Binary data for the given Property Id.

Parameters

propertyId
the id for the Property that contains the binary data.

Returns

InputStream - the binary data.

Exceptions

NoSuchPropertyException

moveNode(ID, ID) Method

public Node moveNode(ID sourceId, 
                     ID destinationId)
This method moves a Node to a new location (Folder) in the hierarchy along with all its descendants. The parent id for the source node will be changed, but all descendants of the source node will keep their parent relationships intact. A Node may not be moved at or below itself in the hierarchy.

Parameters

sourceId
the id of the Node to be moved
destinationId
the id of the Node under which the sourceId Node is moved

Returns

Node- the moved Node- with a new path

removeNodeContent(ID) Method

public Node removeNodeContent(ID nodeId)
Removes the ObjectClass from the given Node. The Node's properties will also be removed for the node to be in a valid state.

Parameters

nodeId
the id for the Node to remove the ObjectClass from.

Returns

Node- the updated Node.

renameNode(ID, String) Method

public Node renameNode(ID nodeId, 
                       String newName)
This method renames a node and implicitly all of its descendants paths. A node may not be renamed to an existing name under the same parent node.

Parameters

nodeId
the id for the node to rename
newName
a String for the new node name

Returns

Node- the renamed Node

updateProperties(ID, Property[]) Method

public Node updateProperties(ID nodeId, 
                             Property[] properties)
Description copied from NodeOps.updateProperties(ID, Property[])
Updates the node with the given id with the given properties. The node must already have a ObjectClass and valid properties associated with it. All Properties are validated against their respective PropertyDefinition.

Parameters

nodeId
- the ID of the node to update. The ID must include the repositoryName.
properties
- the properties to update on the Node.

Returns

Node - the updated Node.