Package org.apache.jackrabbit.core.id

Examples of org.apache.jackrabbit.core.id.PropertyId


                    // root reached or out of hierarchy
                    return true;
                }
                state = (NodeState) session.getItemStateManager().getItemState(parentId);
            }
            PropertyState ps = (PropertyState) session.getItemStateManager().getItemState(new PropertyId(state.getNodeId(), NameConstants.JCR_ISCHECKEDOUT));
            return ps.getValues()[0].getBoolean();
        } catch (ItemStateException e) {
            throw new RepositoryException(e.getMessage());
        }
    }
View Full Code Here


        HashSet<Name> set = new HashSet<Name>(thisState.getPropertyNames());
        for (Name propName : set) {
            try {
                PropertyState propState =
                        (PropertyState) stateMgr.getItemState(
                                new PropertyId(thisState.getNodeId(), propName));
                if (!allDefs.contains(ntReg.getPropDef(propState.getDefinitionId()))) {
                    // try to find new applicable definition first and
                    // redefine property if possible
                    try {
                        PropertyImpl prop = (PropertyImpl) itemMgr.getItem(propState.getId());
View Full Code Here

        try {
            NodeState nodeState = (NodeState) ism.getItemState(id);
            String separator = "";
            Iterator it = nodeState.getPropertyNames().iterator();
            while (it.hasNext() && text.length() < maxFragmentSize) {
                PropertyId propId = new PropertyId(id, (Name) it.next());
                PropertyState propState = (PropertyState) ism.getItemState(propId);
                if (propState.getType() == PropertyType.STRING) {
                    text.append(separator);
                    separator = " ... ";
                    InternalValue[] values = propState.getValues();
View Full Code Here

                    }
                    modified.put(nodeId, bundle);
                }
                bundle.update((NodeState) state);
            } else {
                PropertyId id = (PropertyId) state.getId();
                // skip redundant primaryType, mixinTypes and uuid properties
                if (id.getName().equals(NameConstants.JCR_PRIMARYTYPE)
                    || id.getName().equals(NameConstants.JCR_MIXINTYPES)
                    || id.getName().equals(NameConstants.JCR_UUID)) {
                    continue;
                }
                NodeId nodeId = id.getParentId();
                NodePropBundle bundle = (NodePropBundle) modified.get(nodeId);
                if (bundle == null) {
                    bundle = getBundle(nodeId);
                    if (bundle == null) {
                        throw new NoSuchItemStateException(nodeId.toString());
                    }
                    modified.put(nodeId, bundle);
                }
                bundle.addProperty((PropertyState) state);
            }
        }
        // add removed properties
        iter = changeLog.deletedStates();
        while (iter.hasNext()) {
            ItemState state = (ItemState) iter.next();
            if (state.isNode()) {
                // check consistency
                NodeId parentId = state.getParentId();
                if (!modified.containsKey(parentId) && !deleted.contains(parentId)) {
                    log.warn("Deleted node state's parent is not modified or deleted: " + parentId + "/" + state.getId());
                }
            } else {
                PropertyId id = (PropertyId) state.getId();
                NodeId nodeId = id.getParentId();
                if (!deleted.contains(nodeId)) {
                    NodePropBundle bundle = (NodePropBundle) modified.get(nodeId);
                    if (bundle == null) {
                        // should actually not happen
                        log.warn("deleted property state's parent not modified!");
                        bundle = getBundle(nodeId);
                        if (bundle == null) {
                            throw new NoSuchItemStateException(nodeId.toString());
                        }
                        modified.put(nodeId, bundle);
                    }
                    bundle.removeProperty(id.getName());
                }
            }
        }
        // add added properties
        iter = changeLog.addedStates();
        while (iter.hasNext()) {
            ItemState state = (ItemState) iter.next();
            if (!state.isNode()) {
                PropertyId id = (PropertyId) state.getId();
                // skip primaryType pr mixinTypes properties
                if (id.getName().equals(NameConstants.JCR_PRIMARYTYPE)
                    || id.getName().equals(NameConstants.JCR_MIXINTYPES)
                    || id.getName().equals(NameConstants.JCR_UUID)) {
                    continue;
                }
                NodeId nodeId = id.getParentId();
                NodePropBundle bundle = (NodePropBundle) modified.get(nodeId);
                if (bundle == null) {
                    // should actually not happen
                    log.warn("added property state's parent not modified!");
                    bundle = getBundle(nodeId);
View Full Code Here

            resolve(nodeState, nodeStates, 0);
            List propStates = new ArrayList();
            for (Iterator it = nodeStates.iterator(); it.hasNext(); ) {
                NodeState state = (NodeState) it.next();
                if (state.hasPropertyName(propertyName)) {
                    PropertyId propId = new PropertyId(state.getNodeId(), propertyName);
                    propStates.add(ism.getItemState(propId));
                }
            }
            return (PropertyState[]) propStates.toArray(
                    new PropertyState[propStates.size()]);
View Full Code Here

                        continue;
                    }
                    if (!current.hasPropertyName(propertyName)) {
                        continue;
                    }
                    PropertyId propId = new PropertyId(
                            current.getNodeId(), propertyName);
                    PropertyState propState =
                            (PropertyState) ism.getItemState(propId);
                    InternalValue[] values = propState.getValues();
                    for (int i = 0; i < values.length; i++) {
View Full Code Here

                }
                try {
                    NodeState state = pm.load(id);
                    Set<Name> propertyNames = state.getPropertyNames();
                    for (Name name : propertyNames) {
                        PropertyId pid = new PropertyId(id, name);
                        PropertyState ps = pm.load(pid);
                        if (ps.getType() == PropertyType.BINARY) {
                            for (InternalValue v : ps.getValues()) {
                                // getLength will update the last modified date
                                // if the persistence manager scan is running
View Full Code Here

                                             PropDef def)
            throws ItemExistsException, RepositoryException {

        // check for name collisions with existing properties
        if (parent.hasPropertyName(propName)) {
            PropertyId errorId = new PropertyId(parent.getNodeId(), propName);
            throw new ItemExistsException(safeGetJCRPath(errorId));
        }

        // create property
        PropertyState prop = stateMgr.createNew(propName, parent.getNodeId());
View Full Code Here

                return;
            }
            nodePath = nodePath.getAncestor(1);
            nodeState = getNodeState(nodePath);
        }
        PropertyId propId =
                new PropertyId(nodeState.getNodeId(), NameConstants.JCR_ISCHECKEDOUT);
        PropertyState propState;
        try {
            propState = (PropertyState) stateMgr.getItemState(propId);
        } catch (ItemStateException ise) {
            String msg = "internal error: failed to retrieve state of "
View Full Code Here

        // remove properties
        // use temp set to avoid ConcurrentModificationException
        HashSet<Name> tmp = new HashSet<Name>(targetState.getPropertyNames());
        for (Name propName : tmp) {
            PropertyId propId =
                    new PropertyId(targetState.getNodeId(), propName);
            try {
                PropertyState propState =
                        (PropertyState) stateMgr.getItemState(propId);
                // remove property entry
                targetState.removePropertyName(propId.getName());
                // destroy property state
                stateMgr.destroy(propState);
            } catch (ItemStateException ise) {
                String msg = "internal error: failed to retrieve state of "
                        + propId;
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.core.id.PropertyId

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.