Package org.apache.jackrabbit.core.state

Examples of org.apache.jackrabbit.core.state.NodeReferences


                if (!rs.next()) {
                    throw new NoSuchItemStateException(targetId.toString());
                }

                in = rs.getBinaryStream(1);
                NodeReferences refs = new NodeReferences(targetId);
                Serializer.deserialize(refs, in);

                return refs;
            } catch (Exception e) {
                if (e instanceof NoSuchItemStateException) {
View Full Code Here


            InputStream in = itemStateFS.getInputStream(refsFilePath);

            try {
                DOMWalker walker = new DOMWalker(in);
                NodeReferences refs = new NodeReferences(id);
                readState(walker, refs);
                return refs;
            } finally {
                in.close();
            }
View Full Code Here

            // workspaces are recorded.
            NodeId nodeId = activity.getNodeId();
            NodeReferencesId refId = new NodeReferencesId(nodeId);
            if (stateMgr.hasNodeReferences(refId)) {
                try {
                    NodeReferences refs = stateMgr.getNodeReferences(refId);
                    if (refs.hasReferences()) {
                        throw new ActivityViolationException("Unable to checkout. " +
                                "Activity is already used for the same node in " +
                                "another workspace.");
                    }
                } catch (ItemStateException e) {
View Full Code Here

            ChangeLog log = new ChangeLog();

            Iterator iterator = references.modifiedRefs();
            while (iterator.hasNext()) {
                // filter out version storage intern ones
                NodeReferences source = (NodeReferences) iterator.next();
                NodeReferences target = new NodeReferences(source.getId());
                Iterator iter = source.getReferences().iterator();
                while (iter.hasNext()) {
                    PropertyId id = (PropertyId) iter.next();
                    if (!hasNonVirtualItemState(id.getParentId())) {
                        target.addReference(id);
                    }
                }
                log.modified(target);
            }
View Full Code Here

            throws ReferentialIntegrityException, ItemStateException {
        // only store VV-type references and NV-type references

        // check whether targets of modified node references exist
        for (Iterator iter = changes.modifiedRefs(); iter.hasNext();) {
            NodeReferences refs = (NodeReferences) iter.next();
            NodeId id = refs.getTargetId();
            // no need to check existence of target if there are no references
            if (refs.hasReferences()) {
                if (!changes.has(id) && !hasNonVirtualItemState(id)) {
                    // remove references
                    iter.remove();
                }
            }
View Full Code Here

        // check state of this instance
        sanityCheck();

        try {
            if (stateMgr.hasNodeReferences(getNodeId())) {
                NodeReferences refs = stateMgr.getNodeReferences(getNodeId());
                // refs.getReferences() returns a list of PropertyId's
                List<PropertyId> idList = refs.getReferences();
                if (name != null) {
                    Name qName;
                    try {
                        qName = session.getQName(name);
                    } catch (NameException e) {
View Full Code Here

            EffectiveNodeType ent = getEffectiveNodeType(targetState);
            if (ent.includesNodeType(NameConstants.MIX_REFERENCEABLE)) {
                NodeId targetId = targetState.getNodeId();
                if (stateMgr.hasNodeReferences(targetId)) {
                    try {
                        NodeReferences refs = stateMgr.getNodeReferences(targetId);
                        if (refs.hasReferences()) {
                            throw new ReferentialIntegrityException(safeGetJCRPath(targetPath)
                                    + ": cannot remove node with references");
                        }
                    } catch (ItemStateException ise) {
                        String msg = "internal error: failed to check references on "
View Full Code Here

        // check state of this instance
        sanityCheck();

        try {
            if (stateMgr.hasNodeReferences(getNodeId())) {
                NodeReferences refs = stateMgr.getNodeReferences(getNodeId());
                // refs.getReferences() returns a list of PropertyId's
                List<PropertyId> idList = refs.getReferences();
                if (name != null) {
                    Name qName;
                    try {
                        qName = session.getQName(name);
                    } catch (NameException e) {
View Full Code Here

            // we're currently leverage the fact, that only references to "real"
            // workspaces are recorded. so check all references if their sources
            // exist in 'this' workspace
            if (stateMgr.hasNodeReferences(activityId)) {
                try {
                    NodeReferences refs = stateMgr.getNodeReferences(activityId);
                    for (PropertyId id: refs.getReferences()) {
                        if (!state.hasNode(id.getParentId())) {
                            throw new ActivityViolationException("Unable to checkout. " +
                                    "Activity is already used for the same node in " +
                                    "another workspace.");
                        }
View Full Code Here

            new PropertyState(PROPERTY_ID, ItemState.STATUS_NEW, true);
        property.setType(PropertyType.REFERENCE);
        property.setValues(
                new InternalValue[] { InternalValue.create(CHILD_ID) });

        NodeReferences references = new NodeReferences(CHILD_ID);
        references.addReference(PROPERTY_ID);

        ChangeLog create = new ChangeLog();
        create.added(node);
        create.added(child);
        create.added(property);
        create.modified(references);
        manager.store(create);

        assertTrue(manager.exists(NODE_ID));
        assertTrue(manager.exists(CHILD_ID));
        assertTrue(manager.exists(PROPERTY_ID));
        assertTrue(manager.existsReferencesTo(CHILD_ID));

        assertEquals(node, manager.load(NODE_ID));
        assertEquals(child, manager.load(CHILD_ID));
        assertEquals(property, manager.load(PROPERTY_ID));
        assertEquals(references, manager.loadReferencesTo(CHILD_ID));

        references.removeReference(PROPERTY_ID);
        node.setStatus(ItemState.STATUS_EXISTING);
        ChangeLog update = new ChangeLog();
        update.modified(references);
        node.removePropertyName(TEST);
        update.deleted(property);
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.core.state.NodeReferences

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.