0
votes

Current running repository to move old files to archive repository.

Able to copy document nodes. The problem is with version nodes copy.

Trying to iterate, not quite sure on how to copy all properties of versions:

 VersionManager versionManager1 =    
     oldChildNode.getSession().getWorkspace().getVersionManager();
    versionManager1.checkout(oldChildNode.getPath());
    VersionHistory versionHistory1 = versionManager1.getVersionHistory(oldChildNode.getPath());
VersionIterator versions = versionHistory1.getAllVersions();
 while (versions.hasNext()) {
  try {
       Version versionedNode = versions.nextVersion();
        NodeIterator nodeIterator = versionedNode.getNodes();
        System.out.println(" Version is :: " + versionedNode.getName());
        while (nodeIterator.hasNext()) {
            Node currentNode = nodeIterator.nextNode();
            System.out.println(" JCR Title :: " + currentNode.getName());
        }
        }catch(UnsupportedRepositoryOperationException jcrexce){
       logger.info("Exception while accessing versioned nodes >> ");
       jcrexce.printStackTrace();
   } catch(PathNotFoundException pexec){
      pexec.printStackTrace();
     }
 }

Document node --> nt:resource is added

Structure:
/**
 * Document node
 */
[et:document] > nt:file, mix:title, mix:versionable, mix:shareable
+ * (nt:file) VERSION
- et:tags multiple
- et:role multiple
- et:docUserList multiple
- et:id (LONG)
- et:favourites (BOOLEAN)
- et:lastAccessed (STRING)
- et:lastAccessedOn (DATE)
- et:documentSize (LONG)
- et:fileOwnerName (STRING)
- et:fileOwnerId (STRING)
- * (undefined)

Any pointers on how to move versioned nodes(From repository to another repository and not workspace copy)?

Running on Java 1.6 with Jackrabbit 2.8.0

1

1 Answers

0
votes

You may use RepositoryCopier API for that. Basically, it allows you to move data across different repositories. For more information please have a look at: https://jackrabbit.apache.org/api/1.6/org/apache/jackrabbit/core/RepositoryCopier.html