Class CloneComponent

All Implemented Interfaces:
Component, LogEnabled, ThreadSafe

public class CloneComponent extends AbstractLogEnabled implements Component, ThreadSafe
Helper for common processing used while synchronizing.
  • Field Details

    • ROLE

      public static final String ROLE
      Avalon Role
  • Constructor Details

  • Method Details

    • addNodeWithUUID

      public javax.jcr.Node addNodeWithUUID(javax.jcr.Node srcNode, javax.jcr.Node parentNode, String nodeName) throws javax.jcr.RepositoryException
      Adds a node to a parent node using a source node for name, type and potential UUID.
      Parameters:
      srcNode - the source node.
      parentNode - the parent node for the newly created node.
      nodeName - the node name to use.
      Returns:
      the created node.
      Throws:
      javax.jcr.RepositoryException - if an error occurs.
    • cloneAllProperties

      public void cloneAllProperties(javax.jcr.Node srcNode, javax.jcr.Node clonedNode, Predicate propertyPredicate) throws javax.jcr.RepositoryException
      Clones all the properties of a node.
      Parameters:
      srcNode - the source node.
      clonedNode - the cloned node.
      propertyPredicate - the property selector.
      Throws:
      javax.jcr.RepositoryException - if an error occurs.
    • cloneProperty

      protected void cloneProperty(javax.jcr.Node clonedNode, javax.jcr.Property property) throws javax.jcr.RepositoryException
      Clone a property.
      Parameters:
      clonedNode - the node to copy the property to.
      property - the property to clone.
      Throws:
      javax.jcr.RepositoryException - if an error occurs.
    • cloneNodeAndPreserveUUID

      public void cloneNodeAndPreserveUUID(javax.jcr.Node srcNode, javax.jcr.Node clonedNode, Predicate propertyPredicate, Predicate nodePredicate) throws javax.jcr.RepositoryException
      Clones a node by preserving the source node UUID.
      Parameters:
      srcNode - the source node.
      clonedNode - the cloned node.
      propertyPredicate - the property selector.
      nodePredicate - the node selector.
      Throws:
      javax.jcr.RepositoryException - if an error occurs.
    • getOrCloneNode

      public javax.jcr.Node getOrCloneNode(javax.jcr.Session destSession, javax.jcr.Node node) throws javax.jcr.RepositoryException
      Get or clone a node.
      Parameters:
      destSession - the destination session.
      node - the node in the source workspace.
      Returns:
      the cloned Node in the destination session.
      Throws:
      javax.jcr.RepositoryException - if an error occurs.
    • getOrCloneNode

      public javax.jcr.Node getOrCloneNode(javax.jcr.Session destSession, javax.jcr.Node node, String version) throws javax.jcr.RepositoryException
      Get or clone a node in a specified version.
      Parameters:
      destSession - the destination session.
      node - the node in the source workspace.
      version - the node version to clone, null to get the current version.
      Returns:
      the cloned Node in the destination session.
      Throws:
      javax.jcr.RepositoryException - if an error occurs.
    • cloneAncestorsAndPreserveUUID

      public javax.jcr.Node cloneAncestorsAndPreserveUUID(javax.jcr.Node srcNode, javax.jcr.Session destSession) throws javax.jcr.RepositoryException
      Clones ancestors of a node by preserving the source node UUID.
      Parameters:
      srcNode - the source node.
      destSession - the destination session.
      Returns:
      the parent node the destination workspace.
      Throws:
      javax.jcr.RepositoryException - if an error occurs.
    • cloneContentNodeWithWorkflow

      public javax.jcr.Node cloneContentNodeWithWorkflow(javax.jcr.Session destSession, javax.jcr.Node node) throws javax.jcr.RepositoryException
      Clone a content node, cloning its workflow along.
      Parameters:
      destSession - the destination session.
      node - the node to clone.
      Returns:
      the cloned node.
      Throws:
      javax.jcr.RepositoryException - if an error occurs.
    • cloneContentNodeWithWorkflow

      public javax.jcr.Node cloneContentNodeWithWorkflow(javax.jcr.Session destSession, javax.jcr.Node node, Predicate propertyPredicate, Predicate nodePredicate) throws javax.jcr.RepositoryException
      Clone a content node, cloning its workflow along.
      Parameters:
      destSession - the destination session.
      node - the node to clone.
      propertyPredicate - a test on the properties.
      nodePredicate - a test on the nodes.
      Returns:
      the cloned node.
      Throws:
      javax.jcr.RepositoryException - if an error occurs.
    • cloneContentNodeWithWorkflow

      public javax.jcr.Node cloneContentNodeWithWorkflow(javax.jcr.Session destSession, javax.jcr.Node node, Predicate propertyPredicate, Predicate nodePredicate, String version) throws javax.jcr.RepositoryException
      Clone a content node, cloning its workflow along.
      Parameters:
      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.
      Returns:
      the cloned node.
      Throws:
      javax.jcr.RepositoryException - if an error occurs.
    • createNodeClone

      protected javax.jcr.Node createNodeClone(javax.jcr.Node srcNode, javax.jcr.Node parentNode, String desiredNodeName) throws javax.jcr.RepositoryException
      Create a clone of the specified node.
      Parameters:
      srcNode - the node to clone.
      parentNode - the node under which to create the clonde.
      desiredNodeName - the wanted node name.
      Returns:
      the cloned node.
      Throws:
      javax.jcr.RepositoryException - if an error occurs.
    • orderNode

      public void orderNode(javax.jcr.Node parentNode, String nodeName, javax.jcr.Node node) throws javax.jcr.RepositoryException
      Reorder a node, mirroring the order in the default workspace.
      Parameters:
      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.
      Throws:
      javax.jcr.RepositoryException - if an error occurs.