/** * {@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()); }
/** * Process a request to rename a node specified location into a different location. * <p> * This method does nothing if the request is null. Unless overridden, this method converts the rename into a * {@link MoveBranchRequest move}. However, this only works if the <code>request</code> has a {@link Location#hasPath() path} * for its {@link RenameNodeRequest#at() location}. (If not, this method throws an {@link UnsupportedOperationException} and * must be overridden.) * </p> * * @param request the rename request */ public void process( RenameNodeRequest request ) { if (request == null) return; Location from = request.at(); if (!from.hasPath()) { throw new UnsupportedOperationException(); } Path newPath = getExecutionContext().getValueFactories().getPathFactory().create(from.getPath(), request.toName()); Location to = Location.create(newPath); MoveBranchRequest move = new MoveBranchRequest(from, to, request.inWorkspace()); process(move); // Set the actual locations ... request.setActualLocations(move.getActualLocationBefore(), move.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 locationAfter = moveRequest.getActualLocationAfter();