Package org.modeshape.jcr.value

Examples of org.modeshape.jcr.value.Property


                        if (change instanceof AbstractNodeChange) {
                            AbstractNodeChange nodeChange = (AbstractNodeChange)change;
                            if (acceptableNodeType(nodeChange)) {
                                if (nodeChange instanceof AbstractPropertyChange) {
                                    AbstractPropertyChange propChange = (AbstractPropertyChange)nodeChange;
                                    Property property = propChange.getProperty();
                                    if (indexedPropertyName.equals(property.getName())) {
                                        if (nodeChange instanceof PropertyAdded) {
                                            ops.add(propChange.getKey(), property);
                                        } else if (nodeChange instanceof PropertyChanged) {
                                            PropertyChanged changedProperty = (PropertyChanged)nodeChange;
                                            ops.change(propChange.getKey(), property, changedProperty.getOldProperty());
                                        } else if (nodeChange instanceof PropertyRemoved) {
                                            ops.remove(propChange.getKey());
                                        }
                                    }
                                } else if (nodeChange instanceof NodeAdded) {
                                    NodeAdded added = (NodeAdded)nodeChange;
                                    Property addedProperty = added.getProperties().get(indexedPropertyName);
                                    if (addedProperty != null) {
                                        ops.add(nodeChange.getKey(), addedProperty);
                                    }
                                } else if (nodeChange instanceof NodeRemoved) {
                                    ops.remove(nodeChange.getKey());
View Full Code Here


                        nodeKey = nodeChange.getKey();
                    }
                    // We know we care about this node type, so figure out if there are any properties we care about ...
                    if (nodeChange instanceof AbstractPropertyChange) {
                        AbstractPropertyChange propChange = (AbstractPropertyChange)nodeChange;
                        Property property = propChange.getProperty();
                        for (int i = 0; i != numberOfProperties; ++i) {
                            if (indexedPropertyNames[i].equals(property.getName())) {
                                if (nodeChange instanceof PropertyAdded) {
                                    newProps[i] = property;
                                    hasNewProps = true;
                                } else if (nodeChange instanceof PropertyChanged) {
                                    PropertyChanged changedProperty = (PropertyChanged)nodeChange;
View Full Code Here

        SchematicEntry entry = documentStore.get(systemMetadataKeyStr);

        if (!update && entry != null) {
            // We just need to read the metadata from the document, and we don't need a transaction for it ...
            Document doc = entry.getContent();
            Property accessProp = translator.getProperty(doc, name("accessControl"));
            boolean enabled = false;
            if (accessProp != null) {
                enabled = context.getValueFactories().getBooleanFactory().create(accessProp.getFirstValue());
            }
            this.accessControlEnabled.set(enabled);

            Property prop = translator.getProperty(doc, name("workspaces"));
            final Set<String> persistedWorkspaceNames = new HashSet<String>();
            ValueFactory<String> strings = context.getValueFactories().getStringFactory();
            boolean workspaceNotYetPersisted = false;
            for (Object value : prop) {
                String workspaceName = strings.create(value);
View Full Code Here

            // the presence of the repository node indicates that the operation has been run on this repository
            return;
        }

        initOperation.call();
        Property primaryType = context.getPropertyFactory().create(JcrLexicon.PRIMARY_TYPE, ModeShapeLexicon.REPOSITORY);
        systemNode.createChild(systemSession, systemNode.getKey().withId("mode:repository"), ModeShapeLexicon.REPOSITORY,
                               primaryType);
        systemSession.save();
    }
View Full Code Here

        }

        public Property property( NodeKey key,
                                  Property expectedProperty ) {
            CachedNode node = node(key);
            Property actual = node.getProperty(expectedProperty.getName(), cache);
            assertThat(actual, is(notNullValue()));
            assertThat(actual, is(expectedProperty));
            return actual;
        }
View Full Code Here

        }

        public void noProperty( NodeKey key,
                                Name propertyName ) {
            CachedNode node = node(key);
            Property actual = node.getProperty(propertyName, cache);
            assertThat(actual, is(nullValue()));
        }
View Full Code Here

            Name name = property.name();
            if (JcrLexicon.PRIMARY_TYPE.equals(name)) continue;
            if (JcrLexicon.MIXIN_TYPES.equals(name)) continue;
            if (JcrLexicon.UUID.equals(name)) continue;

            Property prop = property.property();
            if (forceCopy) {
                props.add(prop);
            } else {
                JcrPropertyDefinition propDefn = property.propertyDefinition();
View Full Code Here

                // Need to link to the existing node with the identifier ...
                parentNode.mutable().linkChild(cache, desiredKey, name);
                existingNode = session.node(desiredKey, (Type)null, parentNode.key());
            } else {
                // Otherwise recreate/restore the new child ...
                Property primaryType = propFactory.create(JcrLexicon.PRIMARY_TYPE, primaryTypeName);
                MutableCachedNode newChild = parentNode.mutable().createChild(cache, desiredKey, name, primaryType);
                existingNode = session.node(newChild, (Type)null, parentNode.key());
            }
            nodeToCheckLock = parentNode;
        }
View Full Code Here

    }

    @Override
    public Name getPrimaryType( NodeCache cache ) {
        AbstractSessionCache session = session(cache);
        Property prop = getProperty(JcrLexicon.PRIMARY_TYPE, session);
        NameFactory nameFactory = session.nameFactory();
        return prop != null ? nameFactory.create(prop.getFirstValue()) : nameFactory.create((Object)null);
    }
View Full Code Here

    }

    @Override
    public Set<Name> getMixinTypes( NodeCache cache ) {
        AbstractSessionCache session = session(cache);
        Property prop = getProperty(JcrLexicon.MIXIN_TYPES, session);
        MixinChanges changes = mixinChanges(false);
        if (prop == null || prop.size() == 0) {
            return changes != null ? changes.getAdded() : Collections.<Name>emptySet();
        }

        final NameFactory nameFactory = session.nameFactory();
        if (prop.size() == 1) {
            Name name = nameFactory.create(prop.getFirstValue());
            if (changes == null) return Collections.singleton(name);
            Set<Name> all = new HashSet<Name>(changes.getAdded());
            all.add(name);
            all.removeAll(changes.getRemoved());
            return all;
View Full Code Here

TOP

Related Classes of org.modeshape.jcr.value.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.