Package org.jboss.dna.graph.property

Examples of org.jboss.dna.graph.property.Name


        if (skipFirstElement) {
            skipFirstElement = false;
            return;
        }
        assert localName != null;
        Name nodeName = null;

        ElementEntry element;
        if (!elementStack.isEmpty()) {
            // Add the parent
            elementStack.peek().addAsNode();
            element = new ElementEntry(elementStack.peek(), currentPath, null);
        } else {
            element = new ElementEntry(null, currentPath, null);
        }
        elementStack.addFirst(element);

        properties.clear();
        Object typePropertyValue = null;
        // Convert each of the attributes to a property ...
        for (int i = 0, len = attributes.getLength(); i != len; ++i) {
            String attributeLocalName = attributes.getLocalName(i);
            String attributeUri = attributes.getURI(i);
            Name attributeName = null;
            if ((attributeUri == null || attributeUri.length() == 0) && attributes.getQName(i).indexOf(':') == -1) {
                switch (this.attributeScoping) {
                    case INHERIT_ELEMENT_NAMESPACE:
                        attributeName = nameFactory.create(uri, attributeLocalName, decoder);
                        break;
                    case USE_DEFAULT_NAMESPACE:
                        attributeName = nameFactory.create(attributeLocalName, decoder);
                        break;
                }
            } else {
                attributeName = nameFactory.create(attributeUri, attributeLocalName, decoder);
            }
            assert attributeName != null;
            // Check to see if this is an attribute that represents the node name (which may be null) ...
            if (nodeName == null && attributeName.equals(nameAttribute)) {
                nodeName = nameFactory.create(attributes.getValue(i)); // don't use a decoder
                element.setName(nodeName);
                continue;
            }
            if (typePropertyValue == null && attributeName.equals(typeAttribute)) {
                typePropertyValue = nameFactory.create(attributes.getValue(i)); // don't use a decoder
                continue;
            }
            // Create a property for this attribute ...
            element.addProperty(attributeName, attributes.getValue(i));
View Full Code Here


                               Path destination ) throws AccessControlException, RepositorySourceException {
        CheckArg.isNotNull(nodeToMove, "nodeToMove");
        CheckArg.isNotNull(destination, "destination");

        Path newParentPath = destination.getParent();
        Name newName = destination.getLastSegment().getName();

        // Check authorization ...
        authorizer.checkPermissions(newParentPath, Action.ADD_NODE);
        authorizer.checkPermissions(nodeToMove.getParent(), Action.REMOVE);
View Full Code Here

                     .fromWorkspace(sourceWorkspace)
                     .as(destination.getLastSegment())
                     .into(destination.getParent())
                     .replacingExistingNodesWithSameUuids();
            } else {
                Name newNodeName = destination.getLastSegment().getName();
                batch.clone(source)
                     .fromWorkspace(sourceWorkspace)
                     .as(newNodeName)
                     .into(destination.getParent())
                     .replacingExistingNodesWithSameUuids();
            }
        } else {
            // Perform the copy operation, but use the "to" form (not the "into", which takes the parent) ...
            if (destPathIncludesSegment) {
                batch.clone(source)
                     .fromWorkspace(sourceWorkspace)
                     .as(destination.getLastSegment())
                     .into(destination.getParent())
                     .failingIfAnyUuidsMatch();
            } else {
                Name newNodeName = destination.getLastSegment().getName();
                batch.clone(source)
                     .fromWorkspace(sourceWorkspace)
                     .as(newNodeName)
                     .into(destination.getParent())
                     .failingIfAnyUuidsMatch();
View Full Code Here

                    details.addProperty(property);
                }
            } else if (change instanceof UpdatePropertiesRequest) {
                UpdatePropertiesRequest update = (UpdatePropertiesRequest)change;
                for (Map.Entry<Name, Property> entry : update.properties().entrySet()) {
                    Name propName = entry.getKey();
                    Property property = entry.getValue();

                    if (property != null) {
                        if (update.isNewProperty(propName)) {
                            details.addProperty(property);
View Full Code Here

                // Now, clear the children ...
                childrenByName.clear();

                // And add the persistent children ...
                for (Location location : persistentNode.getChildren()) {
                    Name childName = location.getPath().getLastSegment().getName();
                    List<Node<Payload, PropertyPayload>> currentChildren = childrenByName.get(childName);
                    // Find if there was an existing child that is supposed to stay ...
                    Node<Payload, PropertyPayload> existingChild = childrenToKeep.get(location);
                    if (existingChild != null) {
                        // The existing child is supposed to stay, since it has changes ...
View Full Code Here

                childrenByName = cache.NO_CHILDREN;
            } else {
                childrenByName = LinkedListMultimap.create();
                for (Location location : children) {
                    NodeId id = cache.idFactory.create();
                    Name childName = location.getPath().getLastSegment().getName();
                    Node<Payload, PropertyPayload> child = cache.createNode(this, id, location);
                    cache.nodes.put(child.getNodeId(), child);
                    List<Node<Payload, PropertyPayload>> currentChildren = childrenByName.get(childName);
                    currentChildren.add(child);
                    child.parent = this;
View Full Code Here

            }

            if (isLoaded() && childrenByName != cache.NO_CHILDREN) {
                // Update all of the children ...
                for (Map.Entry<Name, Collection<Node<Payload, PropertyPayload>>> entry : childrenByName.asMap().entrySet()) {
                    Name childName = entry.getKey();
                    int sns = 1;
                    for (Node<Payload, PropertyPayload> child : entry.getValue()) {
                        Path.Segment childSegment = cache.pathFactory.createSegment(childName, sns++);
                        child.updateLocation(childSegment);
                    }
View Full Code Here

         * @param newChild the new child that was added
         */
        protected void synchronizeWithNewlyPersistedNode( Location newChild ) {
            if (!this.isLoaded()) return;
            Path childPath = newChild.getPath();
            Name childName = childPath.getLastSegment().getName();
            if (this.childrenByName.isEmpty()) {
                // Just have to add the child ...
                this.childrenByName = LinkedListMultimap.create();
                if (childPath.getLastSegment().hasIndex()) {
                    // The child has a SNS index, but this is an only child ...
View Full Code Here

                parent.childrenByName = LinkedListMultimap.create();
            }

            cache.nodeOperations.preCopy(this, parent);

            Name childName = child.getName();
            // Figure out the name and SNS of the new copy ...
            List<Node<Payload, PropertyPayload>> currentChildren = parent.childrenByName.get(childName);
            Location copyLocation = Location.create(cache.pathFactory.create(parent.getPath(),
                                                                             childName,
                                                                             currentChildren.size() + 1));
View Full Code Here

            // Replace the children ...
            this.childrenByName = children;
            this.markAsChanged();

            // Adjust the SNS indexes for those children with the same name as 'childToBeMoved' ...
            Name movedName = nodeToBeMoved.getName();
            List<Node<Payload, PropertyPayload>> childrenWithName = childrenByName.get(movedName);
            int snsIndex = 1;
            for (Node<Payload, PropertyPayload> sns : childrenWithName) {
                if (sns.getSegment().getIndex() != snsIndex) {
                    // The SNS index is not correct, so fix it and update the location ...
View Full Code Here

TOP

Related Classes of org.jboss.dna.graph.property.Name

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.