/** * {@inheritDoc} * * @see java.lang.Object#toString() */ @Override public String toString() { String workspaceName = this.workspaceName != null ? "'" + this.workspaceName + "'" : "default"; return "read " + printable(at()) + " (in " + workspaceName + " workspace) all properties"; }
/** * {@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)) { ReadAllPropertiesRequest that = (ReadAllPropertiesRequest)obj; if (!this.at().isSame(that.at())) return false; if (!this.inWorkspace().equals(that.inWorkspace())) return false; return true; } return false; }
@Override public void process( ReadAllPropertiesRequest request ) { // Read the properties from the map ... if (properties.containsKey(request.at())) { for (Property property : properties.get(request.at())) { request.addProperty(property); } } // Set the actual location request.setActualLocationOfNode(actualLocationOf(request.at())); }
@Override public void process( ReadAllPropertiesRequest 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 properties of the node ... request.addProperties(node.getProperties().values()); request.setActualLocationOfNode(Location.create(node.getPath(), node.getUuid())); setCacheableInfo(request); }
protected void assertNextRequestReadProperties( Location at, Property... properties ) { Request request = executedRequests.poll(); assertThat(request, is(instanceOf(ReadAllPropertiesRequest.class))); ReadAllPropertiesRequest readAll = (ReadAllPropertiesRequest)request; assertThat(readAll.at(), is(at)); Map<Name, Property> propsByName = new HashMap<Name, Property>(readAll.getPropertiesByName()); for (Property prop : properties) { assertThat(propsByName.remove(prop.getName()), is(prop)); } assertThat(propsByName.isEmpty(), is(true)); }
@Override public void process( ReadAllPropertiesRequest request ) { WorkspaceType workspace = getWorkspace(request, request.inWorkspace()); NodeType node = getTargetNode(workspace, request, request.at()); if (node == null) { assert request.hasError(); return; } // Get the properties of the node ... Location actualLocation = getActualLocation(workspace, request.at(), node); request.addProperty(propertyFactory.create(ModeShapeLexicon.UUID, node.getUuid())); request.addProperties(node.getProperties().values()); assert actualLocation != null; request.setActualLocationOfNode(actualLocation); setCacheableInfo(request); }
@Override public void process( ReadAllPropertiesRequest request ) { MapWorkspace workspace = getWorkspace(request, request.inWorkspace()); MapNode node = getTargetNode(workspace, request, request.at()); if (node == null) { assert request.hasError(); return; } // Get the properties of the node ... Location actualLocation = getActualLocation(request.at(), node); request.addProperty(propertyFactory.create(ModeShapeLexicon.UUID, node.getUuid())); for (Property property : node.getProperties().values()) { request.addProperty(property); } assert actualLocation != null; request.setActualLocationOfNode(actualLocation); setCacheableInfo(request); }
@Test public void shouldCreateValidRequestWithValidLocation() { request = new ReadAllPropertiesRequest(validPathLocation1, workspace1); assertThat(request.at(), is(sameInstance(validPathLocation1))); assertThat(request.hasError(), is(false)); assertThat(request.getError(), is(nullValue())); }
public void process( ReadAllPropertiesRequest request ) { ProjectedNode projectedNode = project(request.at(), request.inWorkspace(), request, false);