/** * Add a request to clone a branch to another. * * @param from the location of the top node in the existing branch that is to be cloned * @param fromWorkspace the name of the workspace where the <code>from</code> node exists * @param into the location of the existing node into which the clone should be placed * @param intoWorkspace the name of the workspace where the <code>into</code> node is to be cloned * @param nameForClone the desired name for the node that results from the clone, or null if the name of the original should * be used * @param exactSegmentForClone the exact {@link Path.Segment segment} at which the cloned tree should be rooted. * @param removeExisting whether any nodes in the intoWorkspace with the same UUIDs as a node in the source branch should be * removed (if true) or a {@link UuidAlreadyExistsException} should be thrown. * @return the request; never null * @throws IllegalArgumentException if any of the parameters are null except for {@code nameForClone} or * {@code exactSegmentForClone}. Exactly one of {@code nameForClone} and {@code exactSegmentForClone} must be null. */ public CloneBranchRequest cloneBranch( Location from, String fromWorkspace, Location into, String intoWorkspace, Name nameForClone, Path.Segment exactSegmentForClone, boolean removeExisting ) { return process(new CloneBranchRequest(from, fromWorkspace, into, intoWorkspace, nameForClone, exactSegmentForClone, removeExisting)); }
/** * Add a request to clone a branch to another. * * @param from the location of the top node in the existing branch that is to be cloned * @param fromWorkspace the name of the workspace where the <code>from</code> node exists * @param into the location of the existing node into which the clone should be placed * @param intoWorkspace the name of the workspace where the <code>into</code> node is to be cloned * @param nameForClone the desired name for the node that results from the clone, or null if the name of the original should * be used * @param exactSegmentForClone the exact {@link Path.Segment segment} at which the cloned tree should be rooted. * @param removeExisting whether any nodes in the intoWorkspace with the same UUIDs as a node in the source branch should be * removed (if true) or a {@link UuidAlreadyExistsException} should be thrown. * @return this builder for method chaining; never null * @throws IllegalArgumentException if any of the parameters are null except for {@code nameForClone} or * {@code exactSegmentForClone}. Exactly one of {@code nameForClone} and {@code exactSegmentForClone} must be null. */ public BatchRequestBuilder cloneBranch( Location from, String fromWorkspace, Location into, String intoWorkspace, Name nameForClone, Path.Segment exactSegmentForClone, boolean removeExisting ) { return add(new CloneBranchRequest(from, fromWorkspace, into, intoWorkspace, nameForClone, exactSegmentForClone, removeExisting)); }
/** * {@inheritDoc} * <p> * This method does not clone the results. * </p> * * @see org.modeshape.graph.request.ChangeRequest#clone() */ @Override public CloneBranchRequest clone() { CloneBranchRequest result = new CloneBranchRequest(actualFromLocation != null ? actualFromLocation : from, fromWorkspace, actualIntoLocation != null ? actualIntoLocation : into, intoWorkspace, desiredName, desiredSegment, removeExisting); result.setRemovedNodes(removedExistingNodes); result.setActualLocations(actualFromLocation, actualIntoLocation); return result; }
CloneBranchRequest pushDown = new CloneBranchRequest(fromProxy.location(), fromProxy.workspaceName(), intoProxy.location(), intoProxy.workspaceName(), request.desiredName(), request.desiredSegment(),