/** * {@inheritDoc} * <p> * This method does not clone the results. * </p> * * @see org.modeshape.graph.request.ChangeRequest#clone() */ @Override public MoveBranchRequest clone() { MoveBranchRequest request = new MoveBranchRequest(actualOldLocation != null ? actualOldLocation : from, into, before, workspaceName, desiredNameForNode, conflictBehavior); request.setActualLocations(actualOldLocation, actualNewLocation); return request; }
/** * {@inheritDoc} * * @see org.modeshape.graph.request.processor.RequestProcessor#process(org.modeshape.graph.request.MoveBranchRequest) */ @Override public void process( MoveBranchRequest request ) { MoveBranchRequest source = (MoveBranchRequest)federatedRequest.getFirstProjectedRequest().getRequest(); if (checkErrorOrCancel(request, source)) return; request.setActualLocations(source.getActualLocationBefore(), source.getActualLocationAfter()); }
/** * {@inheritDoc} * * @see org.modeshape.graph.request.processor.RequestProcessor#process(org.modeshape.graph.request.MoveBranchRequest) */ @Override public void process( MoveBranchRequest request ) { ProjectedRequest projected = federatedRequest.getFirstProjectedRequest(); // Check the projection first ... if (checkErrorOrCancel(request, federatedRequest)) return; MoveBranchRequest source = (MoveBranchRequest)projected.getRequest(); if (checkErrorOrCancel(request, source)) return; Location locationBefore = source.getActualLocationBefore(); Location locationAfter = source.getActualLocationAfter(); locationBefore = projectToFederated(request.from(), projected.getProjection(), locationBefore, request); Projection afterProjection = projected.getSecondProjection(); if (afterProjection == null) projected.getProjection(); locationAfter = projectToFederated(request.into(), afterProjection, locationAfter, request); request.setActualLocations(locationBefore, locationAfter); }
Location oldLocation = getActualLocation(request.from(), node); Location newLocation = Location.create(newPath, node.getUuid()); request.setActualLocations(oldLocation, newLocation); recordChange(request);
request.setActualLocations(oldLocation, newLocation); recordChange(request);
request.setActualLocations(oldLocation, newLocation); recordChange(request);
@Override public void process( MoveBranchRequest request ) { // Just update the actual location ... Name newName = request.desiredName(); if (newName == null && request.from().hasPath()) newName = request.from().getPath().getLastSegment().getName(); if (newName == null) newName = context.getValueFactories().getNameFactory().create("d"); // Figure out the new name and path (if needed)... Path newPath = null; if (request.into().hasPath()) { newPath = context.getValueFactories().getPathFactory().create(request.into().getPath(), newName); } else if (request.from().hasPath()) { newPath = context.getValueFactories().getPathFactory().create("/a/b/c"); newPath = context.getValueFactories().getPathFactory().create(newPath, newName); } else { newPath = context.getValueFactories().getPathFactory().create("/a/b/c"); newPath = context.getValueFactories().getPathFactory().create(newPath, newName); } // Figure out the old name and path ... Path oldPath = null; if (request.from().hasPath()) { oldPath = request.from().getPath(); } else { oldPath = context.getValueFactories().getPathFactory().create("/x/y/z"); oldPath = context.getValueFactories().getPathFactory().create(oldPath, newName); } Location fromLocation = request.from().hasIdProperties() ? Location.create(oldPath, request.from().getIdProperties()) : Location.create(oldPath); Location intoLocation = request.into().hasIdProperties() ? Location.create(newPath, request.into().getIdProperties()) : Location.create(newPath); request.setActualLocations(fromLocation, intoLocation); }