Package org.jboss.dna.graph.property

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


                // Create a composite request ...
                Request composite = CompositeRequest.with(requests);
                Graph.this.execute(composite);
                Map<Location, Property> results = new HashMap<Location, Property>();
                for (ReadPropertyRequest request : requests) {
                    Property property = request.getProperty();
                    Location location = request.getActualLocationOfNode();
                    results.put(location, property);
                }
                return results;
            }
View Full Code Here


                // Create a composite request ...
                Request composite = CompositeRequest.with(requests);
                Graph.this.execute(composite);
                Map<Name, Property> results = new HashMap<Name, Property>();
                for (ReadPropertyRequest request : requests) {
                    Property property = request.getProperty();
                    results.put(property.getName(), property);
                }
                return results;
            }

            public Map<Location, Map<Name, Property>> on( Collection<Location> locations ) {
                CheckArg.isNotNull(locations, "locations");
                final List<ReadPropertyRequest> requests = new LinkedList<ReadPropertyRequest>();
                String workspace = getCurrentWorkspaceName();
                for (Location location : locations) {
                    if (location == null) continue;
                    for (Name propertyName : names) {
                        if (propertyName == null) continue;
                        requests.add(new ReadPropertyRequest(location, workspace, propertyName));
                    }
                }
                return execute(requests);
            }

            /**
             * {@inheritDoc}
             *
             * @see org.jboss.dna.graph.Graph.OnMultiple#on(org.jboss.dna.graph.Location, org.jboss.dna.graph.Location[])
             */
            public Map<Location, Map<Name, Property>> on( Location first,
                                                          Location... additional ) {
                CheckArg.isNotNull(first, "first");
                final List<ReadPropertyRequest> requests = new LinkedList<ReadPropertyRequest>();
                String workspace = getCurrentWorkspaceName();
                for (Location location : additional) {
                    if (location == null) continue;
                    for (Name propertyName : names) {
                        if (propertyName == null) continue;
                        requests.add(new ReadPropertyRequest(first, workspace, propertyName));
                        requests.add(new ReadPropertyRequest(location, workspace, propertyName));
                    }
                }
                return execute(requests);
            }

            /**
             * {@inheritDoc}
             *
             * @see org.jboss.dna.graph.Graph.OnMultiple#on(org.jboss.dna.graph.property.Path,
             *      org.jboss.dna.graph.property.Path[])
             */
            public Map<Location, Map<Name, Property>> on( Path first,
                                                          Path... additional ) {
                CheckArg.isNotNull(first, "first");
                List<Location> locations = new LinkedList<Location>();
                locations.add(Location.create(first));
                for (Path path : additional) {
                    if (path != null) locations.add(Location.create(path));
                }
                return on(locations);
            }

            /**
             * {@inheritDoc}
             *
             * @see org.jboss.dna.graph.Graph.OnMultiple#on(java.lang.String, java.lang.String[])
             */
            public Map<Location, Map<Name, Property>> on( String first,
                                                          String... additional ) {
                CheckArg.isNotNull(first, "first");
                List<Location> locations = new LinkedList<Location>();
                locations.add(Location.create(createPath(first)));
                for (String path : additional) {
                    if (path != null) locations.add(Location.create(createPath(path)));
                }
                return on(locations);
            }

            /**
             * {@inheritDoc}
             *
             * @see org.jboss.dna.graph.Graph.OnMultiple#on(java.util.UUID, java.util.UUID[])
             */
            public Map<Location, Map<Name, Property>> on( UUID first,
                                                          UUID... additional ) {
                CheckArg.isNotNull(first, "first");
                List<Location> locations = new LinkedList<Location>();
                locations.add(Location.create(first));
                for (UUID uuid : additional) {
                    if (uuid != null) locations.add(Location.create(uuid));
                }
                return on(locations);
            }

            protected Map<Location, Map<Name, Property>> execute( List<ReadPropertyRequest> requests ) {
                // Create a composite request ...
                Request composite = CompositeRequest.with(requests);
                Graph.this.execute(composite);
                Map<Location, Map<Name, Property>> results = new HashMap<Location, Map<Name, Property>>();
                for (ReadPropertyRequest request : requests) {
                    Property property = request.getProperty();

                    // property was requested but doesn't exist
                    if (property == null) continue;

                    Location location = request.getActualLocationOfNode();
                    Map<Name, Property> properties = results.get(location);
                    if (properties == null) {
                        properties = new HashMap<Name, Property>();
                        results.put(location, properties);
                    }
                    properties.put(property.getName(), property);
                }
                return results;
            }
        };
    }
View Full Code Here

        if (value instanceof Node) {
            Node node = (Node)value;
            UUID uuid = node.getLocation().getUuid();
            if (uuid == null) {
                // Look for a property ...
                Property uuidProperty = node.getProperty(DnaLexicon.UUID);
                if (uuidProperty != null) {
                    uuid = context.getValueFactories().getUuidFactory().create(uuidProperty.getFirstValue());
                } else {
                    uuidProperty = node.getProperty(JcrLexicon.UUID);
                    if (uuidProperty != null) {
                        uuid = context.getValueFactories().getUuidFactory().create(uuidProperty.getFirstValue());
                    }
                }
            }
            if (uuid == null) {
                String nodeString = node.getLocation().getString(getContext().getNamespaceRegistry());
View Full Code Here

                isQueryOrderable = false;
            } else if (tokens.canConsumeAnyOf("QUERYOPS", "QOP")) {
                parseQueryOperators(tokens, properties);
            } else if (jcr170 && tokens.canConsumeAnyOf("PRIMARY", "PRI", "!")) {
                // Then this child node is considered the primary item ...
                Property primaryItem = propertyFactory.create(JcrLexicon.PRIMARY_ITEM_NAME, propDefnName);
                destination.setProperties(propDefnPath.getParent(), primaryItem);
            } else {
                break;
            }
        }
View Full Code Here

                // variant on-parent-version
                onParentVersion = tokens.consume();
                tokens.canConsume('?');
            } else if (jcr170 && tokens.canConsumeAnyOf("PRIMARY", "PRI", "!")) {
                // Then this child node is considered the primary item ...
                Property primaryItem = propertyFactory.create(JcrLexicon.PRIMARY_ITEM_NAME, childNodeDefnName);
                destination.setProperties(childNodeDefnPath.getParent(), primaryItem);
            } else {
                break;
            }
        }
View Full Code Here

                try {
                    // Just get the UUID ...
                    Location location = request.on();
                    ActualLocation actual = getActualLocation(workspaceId, location); // verifies the UUID
                    UUID uuid = actual.location.getUuid();
                    Property uuidProperty = getExecutionContext().getPropertyFactory().create(propertyName, uuid);
                    request.setProperty(uuidProperty);
                    request.setActualLocationOfNode(actual.location);
                    setCacheableInfo(request);
                } catch (Throwable e) { // Includes PathNotFoundException
                    request.setError(e);
View Full Code Here

    protected ActualLocation getActualLocation( Long workspaceId,
                                                Location original ) throws PathNotFoundException {
        assert original != null;

        // Look for the UUID in the original ...
        Property uuidProperty = original.getIdProperty(DnaLexicon.UUID);
        String uuidString = uuidProperty != null && !uuidProperty.isEmpty() ? stringFactory.create(uuidProperty.getFirstValue()) : null;

        Path path = original.getPath();
        if (path != null) {
            // See if the location is already in the cache ...
            Location cached = cache.getLocationFor(workspaceId, path);
View Full Code Here

                deserializePropertyValues(input, name, true, largeValues, removedLargeValues, references);
            } else {
                // Now read the property values ...
                Object[] values = deserializePropertyValues(input, name, false, largeValues, removedLargeValues, references);
                // Add the property to the collection ...
                Property property = propertyFactory.create(name, values);
                assert property != null;
                allProperties.put(name, property);
            }
        }

        // Add all the updated properties ...
        for (Map.Entry<Name, Property> entry : updatedProperties.entrySet()) {
            Property updated = entry.getValue();
            if (updated == null) {
                allProperties.remove(entry.getKey());
            } else {
                allProperties.put(updated.getName(), updated);
            }
        }

        // Serialize properties ...
        int numProperties = allProperties.size();
View Full Code Here

        assert stream != null;
        assert properties != null;
        // Read the number of properties ...
        int count = stream.readInt();
        for (int i = 0; i != count; ++i) {
            Property property = deserializeProperty(stream, largeValues);
            assert property != null;
            properties.add(property);
        }
    }
View Full Code Here

            read = name.equals(nameToRead) || (namesToRead != null && namesToRead.contains(namesToRead));
            if (read) {
                // Now read the property values ...
                Object[] values = deserializePropertyValues(stream, name, false, largeValues, skippedLargeValues, null);
                // Add the property to the collection ...
                Property property = propertyFactory.create(name, values);
                assert property != null;
                properties.add(property);
            } else {
                // Skip the property ...
                deserializePropertyValues(stream, name, true, largeValues, skippedLargeValues, null);
View Full Code Here

TOP

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

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.