/** * {@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)) { ReadNodeRequest that = (ReadNodeRequest)obj; if (!this.at().isSame(that.at())) return false; if (!this.inWorkspace().equals(that.inWorkspace())) return false; return true; } return false; }
@Test public void shouldCreateValidRequestWithValidLocation() { request = new ReadNodeRequest(validPathLocation1, workspace1); assertThat(request.at(), is(sameInstance(validPathLocation1))); assertThat(request.inWorkspace(), is(sameInstance(workspace1))); assertThat(request.hasError(), is(false)); assertThat(request.getError(), is(nullValue())); }
@Test public void shouldRecordErrorOnRequestIfFederatedWorkspaceCouldNotBeFoundByName() { ReadNodeRequest request = new ReadNodeRequest(location("/some"), nonExistantWorkspaceName); FederatedWorkspace workspace = processor.getWorkspace(request, request.inWorkspace()); assertThat(workspace, is(nullValue())); assertThat(request.hasError(), is(true)); assertThat(request.getError(), is(instanceOf(InvalidWorkspaceException.class))); }
@Test public void shouldFindFederatedWorkspaceByName() { ReadNodeRequest request = new ReadNodeRequest(location("/some"), this.workspace.getName()); FederatedWorkspace workspace = processor.getWorkspace(request, request.inWorkspace()); assertThat(workspace, is(sameInstance(this.workspace))); }
public void process( ReadNodeRequest request ) { ProjectedNode projectedNode = project(request.at(), request.inWorkspace(), request, false); request.inWorkspace()); placeholderRequest.addChildren(children); if (firstRequest) { ReadNodeRequest placeholderRequest = new ReadNodeRequest(placeholder.location(), request.inWorkspace()); placeholderRequest.addChildren(children); if (firstRequest) {
if (request == null) return; ReadAllPropertiesRequest readProperties = new ReadAllPropertiesRequest(request.at(), request.inWorkspace()); process(readProperties); if (readProperties.hasError()) { ReadAllChildrenRequest readChildren = new ReadAllChildrenRequest(request.at(), request.inWorkspace()); process(readChildren); if (readChildren.hasError()) {
/** * {@inheritDoc} * * @see org.modeshape.graph.request.processor.RequestProcessor#process(org.modeshape.graph.request.ReadNodeRequest) */ @Override public void process( ReadNodeRequest request ) { WorkspaceType workspace = getWorkspace(request, request.inWorkspace()); NodeType node = getTargetNode(workspace, request, request.at()); if (node == null) { assert request.hasError(); return; } Location actualLocation = getActualLocation(workspace, request.at(), node); assert actualLocation != null; // Get the locations of the children ... List<Location> childLocations = txn.getChildrenLocations(workspace, node); request.addChildren(childLocations); // Get the properties of the node ... request.addProperty(propertyFactory.create(ModeShapeLexicon.UUID, node.getUuid())); request.addProperties(node.getProperties().values()); request.setActualLocationOfNode(actualLocation); setCacheableInfo(request); }
@Override public void process( ReadNodeRequest request ) { PathWorkspace workspace = getWorkspace(request, request.inWorkspace()); if (workspace == null) return; PathNode node = getTargetNode(workspace, request, request.at()); if (node == null) { request.setError(new PathNotFoundException(request.at(), workspace.getLowestExistingPath(request.at().getPath()))); return; } // Get the names of the children ... for (Path.Segment childSegment : node.getChildSegments()) { request.addChild(Location.create(pathFactory.create(node.getPath(), childSegment))); } // Get the properties of the node ... request.addProperties(node.getProperties().values()); request.setActualLocationOfNode(Location.create(node.getPath(), node.getUuid())); setCacheableInfo(request); }