Package org.apache.jackrabbit.oak.api

Examples of org.apache.jackrabbit.oak.api.PropertyState


    static String encodeUri(String uri) {
        return Text.escapeIllegalJcrChars(uri);
    }

    static Set<String> safeGet(Tree tree, String name) {
        PropertyState ps = tree.getProperty(name);
        if (ps == null) {
            return Sets.newHashSet();
        }
        return Sets.newHashSet(ps.getValue(Type.STRINGS));
    }
View Full Code Here


    private void restoreVersionedChild(NodeBuilder versionedChild,
                                       NodeBuilder dest,
                                       VersionSelector selector)
            throws RepositoryException, CommitFailedException {
        // 15.7.5 Chained Versions on Restore
        PropertyState id = versionedChild.getProperty(JCR_CHILDVERSIONHISTORY);
        if (id == null) {
            throw new RepositoryException("Mandatory property " +
                    JCR_CHILDVERSIONHISTORY + " is missing.");
        }
        vMgr.restore(id.getValue(Type.REFERENCE), selector, dest);
    }
View Full Code Here

     * @param tree  a tree
     * @return  identifier of {@code tree}
     */
    @Nonnull
    public static String getIdentifier(Tree tree) {
        PropertyState property = tree.getProperty(JcrConstants.JCR_UUID);
        if (property != null) {
            return property.getValue(Type.STRING);
        } else if (tree.isRoot()) {
            return "/";
        } else {
            String parentId = getIdentifier(tree.getParent());
            return PathUtils.concat(parentId, tree.getName());
View Full Code Here

        this.name = null;
        this.path = "/";
        this.definition = definition;

        // get property names
        PropertyState names = definition.getProperty(PROPERTY_NAMES);
        if (names.count() == 1) { // OAK-1273: optimize for the common case
            this.propertyNames = singleton(names.getValue(NAME, 0));
        } else {
            this.propertyNames = newHashSet(names.getValue(NAMES));
        }

        // get declaring types, and all their subtypes
        // TODO: should we reindex when type definitions change?
        if (definition.hasProperty(DECLARING_NODE_TYPES)) {
View Full Code Here

    private static Set<String> getMatchingKeys(
            NodeState state, Iterable<String> propertyNames) {
        Set<String> keys = null;
        for (String propertyName : propertyNames) {
            PropertyState property = state.getProperty(propertyName);
            if (property != null) {
                keys = addValueKeys(keys, property);
            }
        }
        return keys;
View Full Code Here

    public long count(NodeState indexMeta, final String indexStorageNodeName,
            Set<String> values, int max) {
        NodeState index = indexMeta.getChildNode(indexStorageNodeName);
        int count = 0;
        if (values == null) {
            PropertyState ec = indexMeta.getProperty(ENTRY_COUNT_PROPERTY_NAME);
            if (ec != null) {
                return ec.getValue(Type.LONG);
            }
            CountingNodeVisitor v = new CountingNodeVisitor(max);
            v.visit(index);
            count = v.getEstimatedCount();
            // "is not null" queries typically read more data
View Full Code Here

            return false;
        }

        Tree types = getTypes();

        PropertyState primary = tree.getProperty(JcrConstants.JCR_PRIMARYTYPE);
        if (primary != null && primary.getType() == Type.NAME) {
            String name = primary.getValue(Type.NAME);
            if (isa(types, name, oakNtName)) {
                return true;
            }
        }

        PropertyState mixins = tree.getProperty(JcrConstants.JCR_MIXINTYPES);
        if (mixins != null && mixins.getType() == Type.NAMES) {
            for (String name : mixins.getValue(Type.NAMES)) {
                if (isa(types, name, oakNtName)) {
                    return true;
                }
            }
        }
View Full Code Here

        return hasMore;
    }
   
    private void loadValue(String v) {
        JsopReader reader = new JsopTokenizer(v);
        PropertyState p;
        if (reader.matches('[')) {
            p = MongoNodeState.readArrayProperty("x", nodeStore, reader);
            if (p.getType() == Type.BINARIES) {
                for (int i = 0; i < p.count(); i++) {
                    Blob b = p.getValue(Type.BINARY, i);
                    batch.add(b);
                }
            }
        } else {
            p = MongoNodeState.readProperty("x", nodeStore, reader);
            if (p.getType() == Type.BINARY) {
                Blob b = p.getValue(Type.BINARY);
                batch.add(b);
            }
        }
    }
View Full Code Here

                return false;
            }

            if (propertyName != null) {
                String pn = normalizePropertyName(propertyName);
                PropertyState p = tree.getProperty(pn);
                if (p == null) {
                    return false;
                }
                appendString(buff, PropertyValues.create(p));
            } else {
View Full Code Here

            }
        }

        // was a property added, removed or modified
        for (Entry<String, PropertyState> p : properties.entrySet()) {
            PropertyState pState = p.getValue();
            if (pState == null
                    || !pState.equals(before.getProperty(p.getKey()))) {
                return true;
            }
        }

        return false;
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.oak.api.PropertyState

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.