Package org.jboss.dna.graph.properties.Path

Examples of org.jboss.dna.graph.properties.Path.Segment


            // If the contribution is a placeholder contribution, then the children should be merged into other children ...
            if (contribution.isPlaceholder()) {
                // Iterate over the children and add only if there is not already one ...
                Iterator<Segment> childIterator = contribution.getChildren();
                while (childIterator.hasNext()) {
                    Segment child = childIterator.next();
                    if (!childNames.containsKey(child.getName())) {
                        childNames.put(child.getName(), 1);
                        children.add(pathFactory.createSegment(child.getName()));
                    }
                }

            } else {
                // Copy the children ...
                Iterator<Segment> childIterator = contribution.getChildren();
                while (childIterator.hasNext()) {
                    Segment child = childIterator.next();
                    int index = Path.NO_INDEX;
                    Integer previous = childNames.put(child.getName(), 1);
                    if (previous != null) {
                        int previousValue = previous.intValue();
                        // Correct the index in the child name map ...
                        childNames.put(child.getName(), ++previousValue);
                        index = previousValue;
                    }
                    children.add(pathFactory.createSegment(child.getName(), index));
                }

                // Copy the properties ...
                Iterator<Property> propertyIterator = contribution.getProperties();
                while (propertyIterator.hasNext()) {
View Full Code Here


        // Copy the children ...
        List<Segment> children = federatedNode.getChildren();
        children.clear();
        Iterator<Segment> childIterator = contribution.getChildren();
        while (childIterator.hasNext()) {
            Segment child = childIterator.next();
            children.add(child);
        }
        // Copy the properties ...
        Map<Name, Property> properties = federatedNode.getPropertiesByName();
        properties.clear();
View Full Code Here

            boolean first = true;
            Iterator<Segment> childIter = getChildren();
            while (childIter.hasNext()) {
                if (!first) sb.append(", ");
                else first = false;
                Segment child = childIter.next();
                sb.append(child);
            }
            sb.append(" >");
        }
        return sb.toString();
View Full Code Here

        // Since we don't know whether path refers to a node or property, get the parent contents, which must refer to a node
        Path parentPath = path.getParent();
        BasicGetNodeCommand getNodeCommand = new BasicGetNodeCommand(parentPath);
        execute(getNodeCommand);
        // First search for a child with the last name in the path
        Segment lastSeg = path.getLastSegment();
        Name name = lastSeg.getName();
        for (Segment seg : getNodeCommand.getChildren()) {
            if (seg.getName().equals(name)) {
                return getNode(path);
            }
        }
        // If a node isn't found & last segment contains no index, get parent node & search for a property with the last name in
        // the path
        if (!lastSeg.hasIndex()) {
            return getNode(parentPath).getProperty(lastSeg.getString(executionContext.getNamespaceRegistry()));
        }
        // If a property isn't found, throw a PathNotFoundException
        throw new PathNotFoundException(JcrI18n.pathNotFound.text(path));
    }
View Full Code Here

TOP

Related Classes of org.jboss.dna.graph.properties.Path.Segment

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.