/** * Sets the actual and complete location of the node being read. This method must be called when processing the request, and * the actual location must have a {@link Location#getPath() path}. * * @param actual the actual location of the node being read, or null if the {@link #at() current location} should be used * @throws IllegalArgumentException if the actual location is null or does not have a path */ public void setActualLocationOfNode( Location actual ) { checkNotFrozen(); CheckArg.isNotNull(actual, "actual"); if (!actual.hasPath()) { throw new IllegalArgumentException(GraphI18n.actualLocationMustHavePath.text(actual)); } this.actualLocation = actual; }
/** * Record the children for a parent node in the branch. * * @param parent the location of the parent; must {@link Location#hasPath() have a path} * @param children the location of each child, in the order they appear in the parent * @throws IllegalStateException if the request is frozen */ public void setChildren( Location parent, Location... children ) { checkNotFrozen(); CheckArg.isNotNull(parent, "parent"); CheckArg.isNotNull(children, "children"); assert parent.hasPath(); Node nodeObj = nodes.get(parent.getPath()); if (nodeObj == null) { nodeObj = new Node(parent); nodes.put(parent.getPath(), nodeObj); } nodeObj.setChildren(Arrays.asList(children)); }
/** * Add a node that was read from the {@link RepositoryConnection}. This method does not verify or check that the node is * indeed on the branch and that it is at a level prescribed by the request. * * @param node the location of the node that appears on this branch; must {@link Location#hasPath() have a path} * @param properties the properties on the node * @throws IllegalArgumentException if the node is null * @throws IllegalStateException if the request is frozen */ public void setProperties( Location node, Property... properties ) { checkNotFrozen(); CheckArg.isNotNull(node, "node"); assert node.hasPath(); Node nodeObj = nodes.get(node.getPath()); if (nodeObj == null) { nodeObj = new Node(node); nodes.put(node.getPath(), nodeObj); } Map<Name, Property> propertiesMap = nodeObj.getProperties(); for (Property property : properties) { propertiesMap.put(property.getName(), property); } }
/** * Add a node that was read from the {@link RepositoryConnection}. This method does not verify or check that the node is * indeed on the branch and that it is at a level prescribed by the request. * * @param node the location of the node that appears on this branch; must {@link Location#hasPath() have a path} * @param properties the properties on the node * @throws IllegalArgumentException if the node is null * @throws IllegalStateException if the request is frozen */ public void setProperties( Location node, Iterable<Property> properties ) { checkNotFrozen(); CheckArg.isNotNull(node, "node"); assert node.hasPath(); Node nodeObj = nodes.get(node.getPath()); if (nodeObj == null) { nodeObj = new Node(node); nodes.put(node.getPath(), nodeObj); } Map<Name, Property> propertiesMap = nodeObj.getProperties(); for (Property property : properties) { propertiesMap.put(property.getName(), property); } }
/** * Record the children for a parent node in the branch. * * @param parent the location of the parent; must {@link Location#hasPath() have a path} * @param children the location of each child, in the order they appear in the parent * @throws IllegalStateException if the request is frozen */ public void setChildren( Location parent, List<Location> children ) { checkNotFrozen(); CheckArg.isNotNull(parent, "parent"); CheckArg.isNotNull(children, "children"); assert parent.hasPath(); Node nodeObj = nodes.get(parent.getPath()); if (nodeObj == null) { nodeObj = new Node(parent); nodes.put(parent.getPath(), nodeObj); } nodeObj.setChildren(children); }