[ 
https://issues.apache.org/jira/browse/OCM-42?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12850059#action_12850059
 ] 

Dhrubojyoti Kayal commented on OCM-42:
--------------------------------------

This is very much possible
I have added that code below and results

Listing 3 - 
private void showAllVersions(ObjectContentManager ocm) throws VersionException {
                VersionIterator versionIterator = ocm.getAllVersions("/page");
                Page page = null;
                while (versionIterator.hasNext())
                {
                    Version version = (Version) versionIterator.next();
                    System.out.println("version found : "+ version.getName() + 
" - " +
                                          version.getPath() + " - " +  
version.getCreated().getTime());
                    
                                    
                    if(!JcrConstants.JCR_ROOTVERSION.equals(version.getName())) 
{
                        //get each version object
                            page = (Page) ocm.getObject( "/page", 
version.getName());
                            
                            System.out.println("Content : " + 
page.getDocContent());
                    }
                    
                    
                }

        }
        
Results
-----------
version found : jcr:rootVersion - 
/jcr:system/jcr:versionStorage/2e/31/85/2e3185a6-2780-4c1b-b532-d9306b8fe2be/jcr:rootVersion
 - Fri Mar 26 15:06:48 IST 2010

version found : 1.0 - 
/jcr:system/jcr:versionStorage/2e/31/85/2e3185a6-2780-4c1b-b532-d9306b8fe2be/1.0
 - Fri Mar 26 15:06:49 IST 2010

Content : dc1
version found : 1.1 - 
/jcr:system/jcr:versionStorage/2e/31/85/2e3185a6-2780-4c1b-b532-d9306b8fe2be/1.1
 - Fri Mar 26 15:06:49 IST 2010

Content : dc2
version found : 1.2 - 
/jcr:system/jcr:versionStorage/2e/31/85/2e3185a6-2780-4c1b-b532-d9306b8fe2be/1.2
 - Fri Mar 26 15:06:49 IST 2010

Content : dc3


Let me know if you have further issues.

> OCM Versioning is not working as expected
> -----------------------------------------
>
>                 Key: OCM-42
>                 URL: https://issues.apache.org/jira/browse/OCM-42
>             Project: Jackrabbit OCM
>          Issue Type: Bug
>            Reporter: Sreekanth S Nair
>         Attachments: sreekanth_nair.vcf
>
>
> I have an OCM class as given belwo
> @Node(jcrMixinTypes =JcrConstants.MIX_VERSIONABLE)
> public class XYZ  {
> @Field(path=true)
> private String path;
> @Field
> private String docContent;
> // and their closure methods
> }
> Then  i have created a root node as /domainName/moduleName 
> and set XYZ's  path value as /domainName/moduleName/documents.
> I can able to insert and update the XYZ  Objects successfully (i'm doing ocm  
> checkout and checkin at object update time)
> but when try to get the version i'm always getting  root version (means the 
> XYZ object value on update  time). 
> I'm unable to get the base version (means the XYZ object value on insert 
> time).
> If its not a bug...Please direct me how to extract version history. 
> fyi : i used
> ocm.getObject("/domainName/moduleName/documents","1.0") to get the value.
> i've worked based on apache jackrabbit OCM version mgmt site example but 
> didn't work for me.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to