public class CloneComponent extends AbstractLogEnabled implements Component, ThreadSafe
Constructor and Description |
---|
CloneComponent() |
Modifier and Type | Method and Description |
---|---|
private String |
_getAvailableNodeName(Node destCollectionNode,
Node srcNode) |
private String[] |
_getHashedPath(String name) |
private static Node |
_getOrAddNode(Node parent,
String name,
String type) |
private boolean |
_inCollection(Node node) |
private boolean |
_nodeExistsInCollection(Node collectionNode,
String nodeName) |
Node |
addNodeWithUUID(Node srcNode,
Node parentNode,
String nodeName)
Adds a node to a parent node using a source node for name, type
and potential UUID.
|
void |
cloneAllProperties(Node srcNode,
Node clonedNode,
Predicate propertyPredicate)
Clones all the properties of a node.
|
Node |
cloneAncestorsAndPreserveUUID(Node srcNode,
Session destSession)
Clones ancestors of a node by preserving the source node UUID.
|
Node |
cloneContentNodeWithWorkflow(Session destSession,
Node node)
Clone a content node, cloning its workflow along.
|
Node |
cloneContentNodeWithWorkflow(Session destSession,
Node node,
Predicate propertyPredicate,
Predicate nodePredicate)
Clone a content node, cloning its workflow along.
|
Node |
cloneContentNodeWithWorkflow(Session destSession,
Node node,
Predicate propertyPredicate,
Predicate nodePredicate,
String version)
Clone a content node, cloning its workflow along.
|
void |
cloneNodeAndPreserveUUID(Node srcNode,
Node clonedNode,
Predicate propertyPredicate,
Predicate nodePredicate)
Clones a node by preserving the source node UUID.
|
protected void |
cloneProperty(Node clonedNode,
Property property)
Clone a property.
|
protected Node |
createNodeClone(Node srcNode,
Node parentNode,
String desiredNodeName)
Create a clone of the specified node.
|
Node |
getOrCloneNode(Session destSession,
Node node)
Get or clone a node.
|
Node |
getOrCloneNode(Session destSession,
Node node,
String version)
Get or clone a node in a specified version.
|
void |
orderNode(Node parentNode,
String nodeName,
Node node)
Reorder a node, mirroring the order in the default workspace.
|
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
public CloneComponent()
public Node addNodeWithUUID(Node srcNode, Node parentNode, String nodeName) throws RepositoryException
srcNode
- the source node.parentNode
- the parent node for the newly created node.nodeName
- the node name to use.RepositoryException
- if an error occurs.public void cloneAllProperties(Node srcNode, Node clonedNode, Predicate propertyPredicate) throws RepositoryException
srcNode
- the source node.clonedNode
- the cloned node.propertyPredicate
- the property selector.RepositoryException
- if an error occurs.protected void cloneProperty(Node clonedNode, Property property) throws RepositoryException
clonedNode
- the node to copy the property to.property
- the property to clone.RepositoryException
- if an error occurs.public void cloneNodeAndPreserveUUID(Node srcNode, Node clonedNode, Predicate propertyPredicate, Predicate nodePredicate) throws RepositoryException
srcNode
- the source node.clonedNode
- the cloned node.propertyPredicate
- the property selector.nodePredicate
- the node selector.RepositoryException
- if an error occurs.public Node getOrCloneNode(Session destSession, Node node) throws RepositoryException
destSession
- the destination session.node
- the node in the source workspace.RepositoryException
- if an error occurs.public Node getOrCloneNode(Session destSession, Node node, String version) throws RepositoryException
destSession
- the destination session.node
- the node in the source workspace.version
- the node version to clone, null to get the current version.RepositoryException
- if an error occurs.public Node cloneAncestorsAndPreserveUUID(Node srcNode, Session destSession) throws RepositoryException
srcNode
- the source node.destSession
- the destination session.RepositoryException
- if an error occurs.public Node cloneContentNodeWithWorkflow(Session destSession, Node node) throws RepositoryException
destSession
- the destination session.node
- the node to clone.RepositoryException
- if an error occurs.public Node cloneContentNodeWithWorkflow(Session destSession, Node node, Predicate propertyPredicate, Predicate nodePredicate) throws RepositoryException
destSession
- the destination session.node
- the node to clone.propertyPredicate
- a test on the properties.nodePredicate
- a test on the nodes.RepositoryException
- if an error occurs.public Node cloneContentNodeWithWorkflow(Session destSession, Node node, Predicate propertyPredicate, Predicate nodePredicate, String version) throws RepositoryException
destSession
- the destination session.node
- the node to clone.propertyPredicate
- a test on the properties.nodePredicate
- a test on the nodes.version
- the version of the node to clone.RepositoryException
- if an error occurs.private boolean _inCollection(Node node) throws RepositoryException
RepositoryException
private String _getAvailableNodeName(Node destCollectionNode, Node srcNode) throws RepositoryException
RepositoryException
private boolean _nodeExistsInCollection(Node collectionNode, String nodeName) throws RepositoryException
RepositoryException
private String[] _getHashedPath(String name)
private static Node _getOrAddNode(Node parent, String name, String type) throws RepositoryException
RepositoryException
protected Node createNodeClone(Node srcNode, Node parentNode, String desiredNodeName) throws RepositoryException
srcNode
- the node to clone.parentNode
- the node under which to create the clonde.desiredNodeName
- the wanted node name.RepositoryException
- if an error occurs.public void orderNode(Node parentNode, String nodeName, Node node) throws RepositoryException
parentNode
- the parent of the source Node in the default workspace.nodeName
- the node name.node
- the node in the destination workspace to be reordered.RepositoryException
- if an error occurs.