Search in sources :

Example 21 with VersionManager

use of javax.jcr.version.VersionManager in project jackrabbit by apache.

the class FrozenNodeTest method testFrozenNodeUUUID.

/**
     * @throws RepositoryException
     */
public void testFrozenNodeUUUID() throws RepositoryException {
    VersionManager versionManager = versionableNode.getSession().getWorkspace().getVersionManager();
    String path = versionableNode.getPath();
    Version v = versionManager.checkin(path);
    Node n = v.getFrozenNode();
    String puuid = n.getProperty(jcrUUID).getValue().getString();
    String nuuid = n.getIdentifier();
    assertEquals("jcr:uuid needs to be equal to the getIdentifier() return value.", nuuid, puuid);
}
Also used : Version(javax.jcr.version.Version) Node(javax.jcr.Node) VersionManager(javax.jcr.version.VersionManager)

Example 22 with VersionManager

use of javax.jcr.version.VersionManager in project jackrabbit by apache.

the class FrozenNodeTest method testFrozenChildNodeNodeType.

/**
     * @throws RepositoryException
     */
public void testFrozenChildNodeNodeType() throws RepositoryException {
    versionableNode.addNode("child");
    versionableNode.getSession().save();
    VersionManager versionManager = versionableNode.getSession().getWorkspace().getVersionManager();
    String path = versionableNode.getPath();
    Version v = versionManager.checkin(path);
    Node n = v.getFrozenNode().getNode("child");
    String puuid = n.getProperty(jcrPrimaryType).getValue().getString();
    String nuuid = n.getPrimaryNodeType().getName();
    assertEquals("jcr:primaryType needs to be equal to the getPrimaryNodeType() return value.", nuuid, puuid);
}
Also used : Version(javax.jcr.version.Version) Node(javax.jcr.Node) VersionManager(javax.jcr.version.VersionManager)

Example 23 with VersionManager

use of javax.jcr.version.VersionManager in project jackrabbit by apache.

the class FrozenNodeTest method testFrozenUUUID.

/**
     * @throws RepositoryException
     */
public void testFrozenUUUID() throws RepositoryException, NotExecutableException {
    // make versionable node referenceable
    ensureMixinType(versionableNode, mixReferenceable);
    versionableNode.getSession().save();
    VersionManager versionManager = versionableNode.getSession().getWorkspace().getVersionManager();
    String path = versionableNode.getPath();
    Version v = versionManager.checkin(path);
    Node n = v.getFrozenNode();
    String fuuid = n.getProperty(jcrFrozenUuid).getValue().getString();
    String ruuid = versionableNode.getIdentifier();
    assertEquals("jcr:frozenUuid needs to be equal to the getIdentifier() return value.", ruuid, fuuid);
}
Also used : Version(javax.jcr.version.Version) Node(javax.jcr.Node) VersionManager(javax.jcr.version.VersionManager)

Example 24 with VersionManager

use of javax.jcr.version.VersionManager in project jackrabbit by apache.

the class FrozenNodeTest method testFrozenNodeType.

/**
     * @throws RepositoryException
     */
public void testFrozenNodeType() throws RepositoryException {
    VersionManager versionManager = versionableNode.getSession().getWorkspace().getVersionManager();
    String path = versionableNode.getPath();
    Version v = versionManager.checkin(path);
    Node n = v.getFrozenNode();
    String fuuid = n.getProperty("jcr:frozenPrimaryType").getValue().getString();
    String ruuid = versionableNode.getPrimaryNodeType().getName();
    assertEquals("jcr:frozenPrimaryType needs to be equal to the getPrimaryNodeType() return value.", ruuid, fuuid);
}
Also used : Version(javax.jcr.version.Version) Node(javax.jcr.Node) VersionManager(javax.jcr.version.VersionManager)

Example 25 with VersionManager

use of javax.jcr.version.VersionManager in project jackrabbit by apache.

the class RepositoryServiceImpl method createConfiguration.

/**
     * {@inheritDoc}
     */
public NodeId createConfiguration(SessionInfo sessionInfo, final NodeId nodeId) throws UnsupportedRepositoryOperationException, RepositoryException {
    final SessionInfoImpl sInfo = getSessionInfoImpl(sessionInfo);
    final VersionManager vMgr = getVersionManager(sInfo);
    Node configuration = (Node) executeWithLocalEvents(new Callable() {

        public Object run() throws RepositoryException {
            return vMgr.createConfiguration(getNodePath(nodeId, sInfo));
        }
    }, getSessionInfoImpl(sessionInfo));
    return idFactory.createNodeId(configuration);
}
Also used : Node(javax.jcr.Node) VersionManager(javax.jcr.version.VersionManager)

Aggregations

VersionManager (javax.jcr.version.VersionManager)154 Node (javax.jcr.Node)97 Version (javax.jcr.version.Version)65 VersionHistory (javax.jcr.version.VersionHistory)17 RepositoryException (javax.jcr.RepositoryException)11 Value (javax.jcr.Value)10 Test (org.junit.Test)9 Property (javax.jcr.Property)8 Session (javax.jcr.Session)8 NodeIterator (javax.jcr.NodeIterator)7 VersionException (javax.jcr.version.VersionException)5 ItemNotFoundException (javax.jcr.ItemNotFoundException)4 MergeException (javax.jcr.MergeException)4 UnsupportedRepositoryOperationException (javax.jcr.UnsupportedRepositoryOperationException)4 VersionIterator (javax.jcr.version.VersionIterator)4 JackrabbitSession (org.apache.jackrabbit.api.JackrabbitSession)4 ArrayList (java.util.ArrayList)3 HashSet (java.util.HashSet)3 NodeDefinitionTemplate (javax.jcr.nodetype.NodeDefinitionTemplate)3 InvalidItemStateException (javax.jcr.InvalidItemStateException)2