Package org.apache.jackrabbit.core

Examples of org.apache.jackrabbit.core.PropertyId


    public boolean removeProperty(QName name) throws RepositoryException {
        try {
            if (!nodeState.hasPropertyName(name)) {
                return false;
            } else {
                PropertyId propId = new PropertyId(nodeState.getNodeId(), name);
                ItemState state = stateMgr.getItemState(propId);
                stateMgr.destroy(state);
                nodeState.removePropertyName(name);
                nodeState.setStatus(ItemState.STATUS_EXISTING_MODIFIED);
                return true;
View Full Code Here


            // first store all transient properties
            Set props = state.getPropertyNames();
            for (Iterator iter = props.iterator(); iter.hasNext();) {
                QName propName = (QName) iter.next();
                PropertyState pstate = (PropertyState) stateMgr.getItemState(
                        new PropertyId(state.getNodeId(), propName));
                if (pstate.getStatus() != ItemState.STATUS_EXISTING) {
                    stateMgr.store(pstate);
                }
            }
            // now store all child node entries
View Full Code Here

            // first discard all all transient properties
            Set props = state.getPropertyNames();
            for (Iterator iter = props.iterator(); iter.hasNext();) {
                QName propName = (QName) iter.next();
                PropertyState pstate = (PropertyState) stateMgr.getItemState(
                        new PropertyId(state.getNodeId(), propName));
                if (pstate.getStatus() != ItemState.STATUS_EXISTING) {
                    pstate.discard();
                }
            }
            // now reload all child node entries
View Full Code Here

                NodeState root = pMgr.createNew(rootId);
                root.setParentId(rootParentId);
                root.setDefinitionId(ntReg.getEffectiveNodeType(QName.REP_SYSTEM).getApplicableChildNodeDef(
                        QName.JCR_VERSIONSTORAGE, QName.REP_VERSIONSTORAGE, ntReg).getId());
                root.setNodeTypeName(QName.REP_VERSIONSTORAGE);
                PropertyState pt = pMgr.createNew(new PropertyId(rootId, QName.JCR_PRIMARYTYPE));
                pt.setDefinitionId(ntReg.getEffectiveNodeType(QName.REP_SYSTEM).getApplicablePropertyDef(
                        QName.JCR_PRIMARYTYPE, PropertyType.NAME, false).getId());
                pt.setMultiValued(false);
                pt.setType(PropertyType.NAME);
                pt.setValues(new InternalValue[]{InternalValue.create(QName.REP_VERSIONSTORAGE)});
View Full Code Here

        try {
            // filter out version storage intern ones
            NodeReferences refs = new NodeReferences(references.getId());
            Iterator iter = references.getReferences().iterator();
            while (iter.hasNext()) {
                PropertyId id = (PropertyId) iter.next();
                if (!hasItem(id.getParentId())) {
                    refs.addReference(id);
                }
            }

            ChangeLog log = new ChangeLog();
View Full Code Here

     * @return the <code>ItemId</code>.
     */
    ItemId getTargetId() {
        if (childId == null) {
            // property event
            return new PropertyId(parentId, childRelPath.getName());
        } else {
            // node event
            return childId;
        }
    }
View Full Code Here

     * @throws ItemStateException
     */
    public PropertyState createTransientPropertyState(NodeId parentId, QName propName, int initialStatus)
            throws ItemStateException {

        PropertyId id = new PropertyId(parentId, propName);

        // check map; synchronized to ensure an entry is not created twice.
        synchronized (transientStore) {
            if (transientStore.contains(id)) {
                String msg = "there's already a property state instance with id " + id;
View Full Code Here

     * @throws ItemStateException
     */
    public PropertyState createTransientPropertyState(PropertyState overlayedState, int initialStatus)
            throws ItemStateException {

        PropertyId id = overlayedState.getPropertyId();

        // check map; synchronized to ensure an entry is not created twice.
        synchronized (transientStore) {
            if (transientStore.contains(id)) {
                String msg = "there's already a property state instance with id " + id;
View Full Code Here

            throws IllegalStateException {
        if (!editMode) {
            throw new IllegalStateException("Not in edit mode");
        }
        PropertyState state = new PropertyState(
                new PropertyId(parentId, propName), ItemState.STATUS_NEW, false);
        changeLog.added(state);
        state.setContainer(this);
        return state;
    }
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

TOP

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