jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alartin <alar...@gmail.com>
Subject Question about Version Node
Date Tue, 13 Mar 2007 08:59:56 GMT

Hi all,

  I am a newbie to jcr. I got an introduction of jackrabbit on ONJava.com,
it showed some example code, but I am little confused by some snippet. I
think versions are stored by version history and version iterator allow you
access all the versions. So, each version object should be a snapshot of 
versionable node. But in the example code(below). It seems that the
structure is:

VersionHistory --
                     |__ Version _
                     |                 |__Node _
                     |                 |             |__Versionable Node _
                     |                 |                                           
|__ Property
                     |                 |__Node ...
                     |__ Version

I am confused by the nodes under the version object(why use
version.getNodes() to access versionable node)??
Any help will be greatly appreciated!
--------------------------------------------------------------------
VersionHistory blogEntryVersionHistory = blogEntryNode.getVersionHistory();
VersionIterator blogEntryVersionIt =
blogEntryVersionHistory.getAllVersions();
			
blogEntryVersionIt.skip(1);
			
while(blogEntryVersionIt.hasNext()){
    Version version = blogEntryVersionIt.nextVersion();  --> Here get a
version of blog entry
    NodeIterator nodeIterator = version.getNodes();  --> what does this
mean??
				while(nodeIterator.hasNext()){
					Node node = nodeIterator.nextNode(); --> It seems that each node of one
version contains a versionable node??
					String title  = node.getProperty(PROP_TITLE).getString();
					String blogContent = node.getProperty(PROP_BLOGCONTENT).getString();
					String blogAuthor = node.getProperty(PROP_BLOGAUTHOR).getString();
					String versionName = version.getName();
					Calendar creationTime = node.getProperty(PROP_CREATIONTIME).getDate();
					VersionEntryDTO blogEntryDTO = new      
VersionEntryDTO(blogAuthor,title,blogContent,creationTime,versionName);
					versionList.add(blogEntryDTO);
				}
			}
------------------------------------------------------------------------------
-- 
View this message in context: http://www.nabble.com/Question-about-Version-Node-tf3394665.html#a9450511
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.


Mime
View raw message