Package org.apache.jackrabbit.mk.model

Examples of org.apache.jackrabbit.mk.model.PropertyState


            NodeState before, NodeState after, NodeStateDiff diff) {
        Set<String> beforeProperties = new HashSet<String>();

        for (PropertyState beforeProperty : before.getProperties()) {
            String name = beforeProperty.getName();
            PropertyState afterProperty = after.getProperty(name);
            if (afterProperty == null) {
                diff.propertyDeleted(beforeProperty);
            } else {
                beforeProperties.add(name);
                if (!beforeProperty.equals(afterProperty)) {
                    diff.propertyChanged(beforeProperty, afterProperty);
                }
            }
        }

        for (PropertyState afterProperty : after.getProperties()) {
            if (!beforeProperties.contains(afterProperty.getName())) {
                diff.propertyAdded(afterProperty);
            }
        }
    }
View Full Code Here


     * @param name  name of the property
     * @return  state of the property named {@code name}.
     * @throws javax.jcr.ItemNotFoundException  if no such property exists.
     */
    public PropertyState getPropertyState(String name) throws ItemNotFoundException {
        PropertyState state = getPropertyStateOrNull(name);
        if (state == null) {
            throw new ItemNotFoundException(name);
        }

        return state;
View Full Code Here

    /**
     * @param name name of the property
     * @return {@code true} iff the property named {@code name} has been transiently added.
     */
    public boolean isPropertyNew(String name) {
        PropertyState state = getNodeDelta().getPropertyState(name);
        if (state == null) {
            return false;
        }

        if (state.isArray()) {
            return getPersistedPropertyState(name) == null;
        }
        else {
            Scalar value = state.getScalar();
            return !value.equals(ScalarImpl.nullScalar()) && getPersistedPropertyState(name) == null;
        }
    }
View Full Code Here

    private TransientNodeState getNodeState(NodeDelta nodeDelta) {
        return getNodeStateProvider().getNodeState(nodeDelta);
    }

    private PropertyState getPropertyStateOrNull(String name) {
        PropertyState state = getNodeDelta().getPropertyState(name);
        if (state == null) {
            return getPersistedPropertyState(name);
        }
        else {
            if (state.isArray()) {
                return state;
            }
            else {
                Scalar value = state.getScalar();
                return value.equals(ScalarImpl.nullScalar())
                    ? null
                    : state;
            }
        }
View Full Code Here

        /**
         * Remove the property with the given {@code name}
         * @param name
         */
        public void removeProperty(String name)  {
            PropertyState state = properties.get(name);
            if (state != null && !state.isArray() && !state.getScalar().equals(ScalarImpl.nullScalar())) {
                // remove transiently added property
                properties.remove(name);
            }
            else {
                // mark property as removed
View Full Code Here

        if (parentState == null) {
            throw new PathNotFoundException(path.toJcrPath());
        }

        String name = path.getName();
        PropertyState state = parentState.getPropertyState(name);
        return new PropertyImpl(sessionContext, parentState, state);
    }
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.mk.model.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.