Package org.apache.jackrabbit.oak.api

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


            throws CommitFailedException {
        if (property.count() == 0) {
            return;
        }

        PropertyState constraints =
                definition.getProperty(JCR_VALUECONSTRAINTS);
        if (constraints == null || constraints.count() == 0) {
            return;
        }

        PropertyState required = definition.getProperty(JCR_REQUIREDTYPE);
        if (required == null) {
            return;
        }

        int type;
        String value = required.getValue(STRING);
        if ("BINARY".equals(value)) {
            type = PropertyType.BINARY;
        } else if ("BOOLEAN".equals(value)) {
            type = PropertyType.BOOLEAN;
        } else if ("DATE".equals(value)) {
View Full Code Here


    @Override
    public boolean definesLocation(TreeLocation location) {
        Tree tree = location.getTree();
        if (tree != null && location.exists()) {
            PropertyState p = location.getProperty();
            return (p == null) ? definesTree(tree) : definesProperty(tree, p);
        } else {
            String path = location.getPath();
            String name = Text.getName(location.getPath());
            return POLICY_NODE_NAMES.contains(name) || ACE_PROPERTY_NAMES.contains(name) || path.startsWith(PERMISSIONS_STORE_PATH);
View Full Code Here

        boolean manyChildNodes = (head & (1 << 28)) != 0;
        int mixinCount = (head >> 18) & ((1 << 10) - 1);
        int propertyCount = head & ((1 << 18) - 1);
        offset += 4;

        PropertyState primaryType = null;
        if (hasPrimaryType) {
            RecordId primaryId = readRecordId(offset);
            primaryType = PropertyStates.createProperty(
                    "jcr:primaryType", readString(primaryId), Type.NAME);
            offset += Segment.RECORD_ID_BYTES;
        }

        PropertyState mixinTypes = null;
        if (hasMixinTypes) {
            String[] mixins = new String[mixinCount];
            for (int i = 0; i < mixins.length; i++) {
                RecordId mixinId = readRecordId(offset);
                mixins[i] =  readString(mixinId);
View Full Code Here

     */
    protected abstract void deleteChangedNode(NodeBuilder builder, String name, NodeState before);

    @Override
    public boolean propertyAdded(PropertyState after) {
        PropertyState other = builder.getProperty(after.getName());
        if (other == null) {
            builder.setProperty(after);
        } else if (!other.equals(after)) {
            addExistingProperty(builder, other, after);
        }
        return true;
    }
View Full Code Here

        return true;
    }

    @Override
    public boolean propertyChanged(PropertyState before, PropertyState after) {
        PropertyState other = builder.getProperty(before.getName());
        if (other == null) {
            changeDeletedProperty(builder, after);
        } else if (other.equals(before)) {
            builder.setProperty(after);
        } else if (!other.equals(after)) {
            changeChangedProperty(builder, before, after);
        }
        return true;
    }
View Full Code Here

        return true;
    }

    @Override
    public boolean propertyDeleted(PropertyState before) {
        PropertyState other = builder.getProperty(before.getName());
        if (other == null) {
            deleteDeletedProperty(builder, before);
        } else if (other.equals(before)) {
            builder.removeProperty(before.getName());
        } else {
            deleteChangedProperty(builder, before);
        }
        return true;
View Full Code Here

        TreeLocation location = TreeLocation.create(immutableRoot, oakPath);
        boolean isAcContent = acConfig.getContext().definesLocation(location);
        long permissions = Permissions.getPermissions(jcrActions, location, isAcContent);

        boolean isGranted = false;
        PropertyState property = location.getProperty();
        Tree tree = (property == null) ? location.getTree() : location.getParent().getTree();
        if (tree != null) {
            isGranted = isGranted(tree, property, permissions);
        } else if (!isVersionStorePath(oakPath)) {
            isGranted = compiledPermissions.isGranted(oakPath, permissions);
View Full Code Here

        // rough approximation for properties
        if (properties != null) {
            for (Map.Entry<String, PropertyState> entry : properties.entrySet()) {
                // name
                memory += 48 + entry.getKey().length() * 2;
                PropertyState propState = entry.getValue();
                if (propState.getType() != Type.BINARY
                        && propState.getType() != Type.BINARIES) {
                    // assume binaries go into blob store
                    for (int i = 0; i < propState.count(); i++) {
                        // size() returns length of string
                        // overhead:
                        // - 8 bytes per reference in values list
                        // - 48 bytes per string
                        memory += 56 + propState.size(i) * 2;
                    }
                }
            }
        }
        // rough approximation for child nodes
View Full Code Here

        this.properties = properties;
        this.childName = childName;
    }

    Template(NodeState state) {
        PropertyState primary = null;
        PropertyState mixins = null;
        List<PropertyTemplate> templates = Lists.newArrayList();

        for (PropertyState property : state.getProperties()) {
            String name = property.getName();
            Type<?> type = property.getType();
View Full Code Here

        checkNotNull(thisId);
        checkNotNull(thatId);

        // Compare properties
        for (int i = 0; i < properties.length; i++) {
            PropertyState thisProperty = getProperty(thisSegment, thisId, i);
            PropertyState thatProperty = getProperty(thatSegment, thatId, i);
            if (!thisProperty.equals(thatProperty)) {
                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.