Package org.apache.jackrabbit.oak.api

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


    public static boolean comparePropertiesAgainstBaseState(
            NodeState state, NodeState base, NodeStateDiff diff) {
        Set<String> baseProperties = new HashSet<String>();
        for (PropertyState beforeProperty : base.getProperties()) {
            String name = beforeProperty.getName();
            PropertyState afterProperty = state.getProperty(name);
            if (afterProperty == null) {
                if (!diff.propertyDeleted(beforeProperty)) {
                    return false;
                }
            } else {
                baseProperties.add(name);
                if (!beforeProperty.equals(afterProperty)) {
                    if (!diff.propertyChanged(beforeProperty, afterProperty)) {
                        return false;
                    }
                }
            }
        }

        for (PropertyState afterProperty : state.getProperties()) {
            if (!baseProperties.contains(afterProperty.getName())) {
                if (!diff.propertyAdded(afterProperty)) {
                    return false;
                }
            }
        }
View Full Code Here


        return treePermission.canRead();
    }

    @Override @CheckForNull
    public PropertyState getProperty(String name) {
        PropertyState property = state.getProperty(name);
        if (property != null && treePermission.canRead(property)) {
            return property;
        } else {
            return null;
        }
View Full Code Here

    private boolean evaluateTypeMatch() {
        Tree tree = getTree(currentRow.getPath());
        if (tree == null || !tree.exists()) {
            return false;
        }
        PropertyState primary = tree.getProperty(JCR_PRIMARYTYPE);
        if (primary != null && primary.getType() == NAME) {
            String name = primary.getValue(NAME);
            if (primaryTypes.contains(name)) {
                return true;
            }
        }

        PropertyState mixins = tree.getProperty(JCR_MIXINTYPES);
        if (mixins != null && mixins.getType() == NAMES) {
            for (String name : mixins.getValue(NAMES)) {
                if (mixinTypes.contains(name)) {
                    return true;
                }
            }
        }
View Full Code Here

    @Override
    public long getModCount(@Nonnull String principalName) {
        Tree principalRoot = getPrincipalRoot(principalName);
        if (principalRoot != null) {
            PropertyState ps = principalRoot.getProperty(PermissionConstants.REP_MOD_COUNT);
            if (ps != null) {
                return ps.getValue(Type.LONG);
            }
        }
        return 0;
    }
View Full Code Here

        Tree principalRoot = getPrincipalRoot(principalName);
        if (principalRoot != null) {
            for (Tree entryTree : principalRoot.getChildren()) {
                loadPermissionEntries(entryTree, ret.getEntries(), restrictionProvider);
            }
            PropertyState ps = principalRoot.getProperty(PermissionConstants.REP_MOD_COUNT);
            ret.setModCount(ps == null ? -1 : ps.getValue(Type.LONG));
        }
        return ret;
    }
View Full Code Here

     * @throws AccessDeniedException In case the new acl tree is not accessible.
     */
    @Nonnull
    private Tree createAclTree(@Nullable String oakPath, @Nonnull Tree tree) throws AccessDeniedException {
        if (!Util.isAccessControlled(oakPath, tree, ntMgr)) {
            PropertyState mixins = tree.getProperty(JcrConstants.JCR_MIXINTYPES);
            String mixinName = Util.getMixinName(oakPath);
            if (mixins == null) {
                tree.setProperty(JcrConstants.JCR_MIXINTYPES, Collections.singleton(mixinName), Type.NAMES);
            } else {
                PropertyBuilder pb = PropertyBuilder.copy(Type.NAME, mixins);
View Full Code Here

        @Override
        public boolean childNodeAdded(String name, NodeState after) {
            if (PRIVILEGES_PATH.equals(path) && !JCR_ALL.equals(name)) {
                // a new privilege was registered -> update the jcr:all privilege
                NodeBuilder jcrAll = nodeBuilder.child(JCR_ALL);
                PropertyState aggregates = jcrAll.getProperty(REP_AGGREGATES);

                PropertyBuilder<String> propertyBuilder;
                if (aggregates == null) {
                    propertyBuilder = PropertyBuilder.array(Type.NAME, REP_AGGREGATES);
                } else {
View Full Code Here

        while (t.exists() && !t.isRoot() && !VersionConstants.VERSION_STORE_ROOT_NAMES.contains(t.getName())) {
            String ntName = TreeUtil.getPrimaryTypeName(t);
            if (VersionConstants.JCR_FROZENNODE.equals(t.getName()) && t != versionStoreTree) {
                relPath = PathUtils.relativize(t.getPath(), versionStoreTree.getPath());
            } else if (JcrConstants.NT_VERSIONHISTORY.equals(ntName)) {
                PropertyState prop = t.getProperty(workspaceName);
                if (prop != null) {
                    versionablePath = PathUtils.concat(prop.getValue(Type.PATH), relPath);
                }
                return (versionablePath == null) ? null : root.getTree(versionablePath);
            } else if (VersionConstants.NT_CONFIGURATION.equals(ntName)) {
                String rootId = TreeUtil.getString(t, VersionConstants.JCR_ROOT);
                if (rootId != null) {
View Full Code Here

                .setProperty(JCR_PRIMARYTYPE, INDEX_DEFINITIONS_NODE_TYPE, NAME)
                .setProperty(TYPE_PROPERTY_NAME, NodeReferenceConstants.TYPE);
    }

    public static boolean isIndexNodeType(NodeState state) {
        PropertyState ps = state.getProperty(JCR_PRIMARYTYPE);
        return ps != null
                && ps.getValue(STRING).equals(INDEX_DEFINITIONS_NODE_TYPE);
    }
View Full Code Here

    public static boolean isIndexNodeType(NodeState state, String typeIn) {
        if (!isIndexNodeType(state)) {
            return false;
        }
        PropertyState type = state.getProperty(TYPE_PROPERTY_NAME);
        return type != null && !type.isArray()
                && type.getValue(Type.STRING).equals(typeIn);
    }
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.