You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by alartin <al...@gmail.com> on 2007/03/13 09:59:56 UTC
Question about Version Node
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.
Re: Question about Version Node
Posted by Tobias Bocanegra <to...@day.com>.
hi,
the versioned node is recorded as 'jcr:frozenNode' (having
'nt:frozenNode' as node type) below the 'nt:version' node.
regards, toby
On 3/13/07, alartin <al...@gmail.com> wrote:
>
> 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.
>
>
--
-----------------------------------------< tobias.bocanegra@day.com >---
Tobias Bocanegra, Day Management AG, Barfuesserplatz 6, CH - 4001 Basel
T +41 61 226 98 98, F +41 61 226 98 97
-----------------------------------------------< http://www.day.com >---