Package org.apache.jackrabbit.core.version

Examples of org.apache.jackrabbit.core.version.VersionManager


                NodeState nodeState = (NodeState) itemState;
                EffectiveNodeType nt = validator.getEffectiveNodeType(nodeState);
                if (nt.includesNodeType(NameConstants.MIX_VERSIONABLE)) {
                    if (!nodeState.hasPropertyName(NameConstants.JCR_VERSIONHISTORY)) {
                        NodeImpl node = (NodeImpl) itemMgr.getItem(itemState.getId());
                        VersionManager vMgr = session.getVersionManager();
                        /**
                         * check if there's already a version history for that
                         * node; this would e.g. be the case if a versionable
                         * node had been exported, removed and re-imported with
                         * either IMPORT_UUID_COLLISION_REMOVE_EXISTING or
                         * IMPORT_UUID_COLLISION_REPLACE_EXISTING;
                         * otherwise create a new version history
                         */
                        VersionHistory vh = vMgr.getVersionHistory(session, nodeState);
                        if (vh == null) {
                            vh = vMgr.createVersionHistory(session, nodeState);
                        }
                        node.internalSetProperty(NameConstants.JCR_VERSIONHISTORY, InternalValue.create(new UUID(vh.getUUID())));
                        node.internalSetProperty(NameConstants.JCR_BASEVERSION, InternalValue.create(new UUID(vh.getRootVersion().getUUID())));
                        node.internalSetProperty(NameConstants.JCR_ISCHECKEDOUT, InternalValue.create(true));
                        node.internalSetProperty(NameConstants.JCR_PREDECESSORS,
View Full Code Here


                NodeState nodeState = (NodeState) itemState;
                EffectiveNodeType nt = validator.getEffectiveNodeType(nodeState);
                if (nt.includesNodeType(NameConstants.MIX_VERSIONABLE)) {
                    if (!nodeState.hasPropertyName(NameConstants.JCR_VERSIONHISTORY)) {
                        NodeImpl node = (NodeImpl) itemMgr.getItem(itemState.getId());
                        VersionManager vMgr = session.getVersionManager();
                        /**
                         * check if there's already a version history for that
                         * node; this would e.g. be the case if a versionable
                         * node had been exported, removed and re-imported with
                         * either IMPORT_UUID_COLLISION_REMOVE_EXISTING or
                         * IMPORT_UUID_COLLISION_REPLACE_EXISTING;
                         * otherwise create a new version history
                         */
                        VersionHistory vh = vMgr.getVersionHistory(session, nodeState);
                        if (vh == null) {
                            vh = vMgr.createVersionHistory(session, nodeState);
                        }
                        node.internalSetProperty(NameConstants.JCR_VERSIONHISTORY, InternalValue.create(new UUID(vh.getUUID())));
                        node.internalSetProperty(NameConstants.JCR_BASEVERSION, InternalValue.create(new UUID(vh.getRootVersion().getUUID())));
                        node.internalSetProperty(NameConstants.JCR_ISCHECKEDOUT, InternalValue.create(true));
                        node.internalSetProperty(NameConstants.JCR_PREDECESSORS,
View Full Code Here

                NodeState nodeState = (NodeState) itemState;
                EffectiveNodeType nt = validator.getEffectiveNodeType(nodeState);
                if (nt.includesNodeType(QName.MIX_VERSIONABLE)) {
                    if (!nodeState.hasPropertyName(QName.JCR_VERSIONHISTORY)) {
                        NodeImpl node = (NodeImpl) itemMgr.getItem(itemState.getId());
                        VersionManager vMgr = session.getVersionManager();
                        /**
                         * check if there's already a version history for that
                         * node; this would e.g. be the case if a versionable
                         * node had been exported, removed and re-imported with
                         * either IMPORT_UUID_COLLISION_REMOVE_EXISTING or
                         * IMPORT_UUID_COLLISION_REPLACE_EXISTING;
                         * otherwise create a new version history
                         */
                        VersionHistory vh = vMgr.getVersionHistory(session, nodeState);
                        if (vh == null) {
                            vh = vMgr.createVersionHistory(session, nodeState);
                        }
                        node.internalSetProperty(QName.JCR_VERSIONHISTORY, InternalValue.create(new UUID(vh.getUUID())));
                        node.internalSetProperty(QName.JCR_BASEVERSION, InternalValue.create(new UUID(vh.getRootVersion().getUUID())));
                        node.internalSetProperty(QName.JCR_ISCHECKEDOUT, InternalValue.create(true));
                        node.internalSetProperty(QName.JCR_PREDECESSORS,
View Full Code Here

                    /**
                     * a versionable node is being copied:
                     * copied properties declared by mix:versionable need to be
                     * adjusted accordingly.
                     */
                    VersionManager manager = session.getVersionManager();
                    if (fullVersionable) {
                        if (propName.equals(NameConstants.JCR_VERSIONHISTORY)) {
                            // jcr:versionHistory
                            VersionHistoryInfo history =
                                manager.getVersionHistory(session, newState);
                            InternalValue value = InternalValue.create(
                                    history.getVersionHistoryId().getUUID());
                            newChildState.setValues(new InternalValue[] { value });
                        } else if (propName.equals(NameConstants.JCR_BASEVERSION)
                                || propName.equals(NameConstants.JCR_PREDECESSORS)) {
                            // jcr:baseVersion or jcr:predecessors
                            VersionHistoryInfo history =
                                manager.getVersionHistory(session, newState);
                            InternalValue value = InternalValue.create(
                                    history.getRootVersionId().getUUID());
                            newChildState.setValues(new InternalValue[] { value });
                        } else if (propName.equals(NameConstants.JCR_ISCHECKEDOUT)) {
                            // jcr:isCheckedOut
                            newChildState.setValues(new InternalValue[]{InternalValue.create(true)});
                        }
                    } else {
                        // for simple versionable, we just initialize the
                        // version history when we see the jcr:isCheckedOut
                        if (propName.equals(NameConstants.JCR_ISCHECKEDOUT)) {
                            // jcr:isCheckedOut
                            newChildState.setValues(new InternalValue[]{InternalValue.create(true)});
                            manager.getVersionHistory(session, newState);
                        }
                    }
                }

                if (newChildState.getType() == PropertyType.REFERENCE) {
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.core.version.VersionManager

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.