path = "'/" + childName + "'"; } else { path = printable(under(), childName);
/** * {@inheritDoc} * * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals( Object obj ) { if (obj == this) return true; if (this.getClass().isInstance(obj)) { CreateNodeRequest that = (CreateNodeRequest)obj; if (!this.under().isSame(that.under())) return false; if (!this.conflictBehavior().equals(that.conflictBehavior())) return false; if (!this.inWorkspace().equals(that.conflictBehavior())) return false; if (!this.properties().equals(that.properties())) return false; return true; } return false; }
protected void assertNextRequestIsCreate( Location parent, String child, Property... properties ) { Name name = context.getValueFactories().getNameFactory().create(child); Request request = executedRequests.poll(); assertThat(request, is(instanceOf(CreateNodeRequest.class))); CreateNodeRequest create = (CreateNodeRequest)request; assertThat(create.under(), is(parent)); assertThat(create.named(), is(name)); assertThat(create.properties(), hasItems(properties)); }
CreateNodeRequest createNode = (CreateNodeRequest)nextCommand; Path expectedPath = context.getValueFactories().getPathFactory().create(path); Path parentPath = createNode.under().getPath(); assertThat(parentPath, is(expectedPath.getParent())); assertThat(createNode.named(), is(expectedPath.getLastSegment().getName()));
/** * {@inheritDoc} * * @see org.modeshape.graph.request.processor.RequestProcessor#process(org.modeshape.graph.request.CreateNodeRequest) */ @Override public void process( CreateNodeRequest request ) { ProjectedRequest projected = federatedRequest.getFirstProjectedRequest(); // Check the projection first ... if (checkErrorOrCancel(request, federatedRequest)) return; Request projectedRequest = projected.getRequest(); // Check the error on the projected request ... if (checkErrorOrCancel(request, projectedRequest)) return; // No error, so project the results back to the federated repository ... Location sourceLocation = null; if (RequestType.CREATE_NODE == projectedRequest.getType()) { CreateNodeRequest source = (CreateNodeRequest)projectedRequest; sourceLocation = source.getActualLocationOfNode(); } else if (RequestType.READ_NODE == projectedRequest.getType()) { // In this case, the original request was to create the node only if it was missing, // but we knew it already exists because the parent was a placeholder and the child // mapped to an existing proxy node. Therefore, record the location... ReadNodeRequest source = (ReadNodeRequest)projectedRequest; sourceLocation = source.getActualLocationOfNode(); } request.setActualLocationOfNode(projectToFederated(request.under(), projected.getProjection(), sourceLocation, request)); }
@Override public void process( CreateNodeRequest request ) { // Just update the actual location ... Location parent = actualLocationOf(request.under()); // just make sure it has a path ... Name name = request.named(); Path childPath = context.getValueFactories().getPathFactory().create(parent.getPath(), name); request.setActualLocationOfNode(Location.create(childPath)); }
NodeType parentNode = txn.getNode(workspace, request.under());
Path parent = request.under().getPath(); CheckArg.isNotNull(parent, "request.under().getPath()"); MapNode node = null; if (parentNode == null) { Path lowestExisting = workspace.getLowestExistingPath(parent); request.setError(new PathNotFoundException(request.under(), lowestExisting, GraphI18n.nodeDoesNotExist.text(parent))); return;
Path parent = request.under().getPath(); CheckArg.isNotNull(parent, "request.under().getPath()"); PathNode node = null; if (parentNode == null) { Path lowestExisting = workspace.getLowestExistingPath(parent); request.setError(new PathNotFoundException(request.under(), lowestExisting, GraphI18n.nodeDoesNotExist.text(parent))); return;
public void process( CreateNodeRequest request ) { ProjectedNode projectedNode = project(request.under(), request.inWorkspace(), request, true); case DO_NOT_REPLACE: Location parent = request.under(); if (parent.hasPath()) { PathFactory pathFactory = getExecutionContext().getValueFactories().getPathFactory(); readable(request.under()), request.inWorkspace(), getSourceName());