You are viewing a plain text version of this content. The canonical link for it is here.
Posted to graffito-commits@incubator.apache.org by cl...@apache.org on 2006/10/19 20:23:46 UTC
svn commit: r465763 - in /incubator/graffito/trunk/jcr/jcr-mapping/xdocs:
api/versionning.xml navigation.xml
Author: clombart
Date: Thu Oct 19 13:23:45 2006
New Revision: 465763
URL: http://svn.apache.org/viewvc?view=rev&rev=465763
Log:
add xdoc on versionning
Modified:
incubator/graffito/trunk/jcr/jcr-mapping/xdocs/api/versionning.xml
incubator/graffito/trunk/jcr/jcr-mapping/xdocs/navigation.xml
Modified: incubator/graffito/trunk/jcr/jcr-mapping/xdocs/api/versionning.xml
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/jcr/jcr-mapping/xdocs/api/versionning.xml?view=diff&rev=465763&r1=465762&r2=465763
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/xdocs/api/versionning.xml (original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/xdocs/api/versionning.xml Thu Oct 19 13:23:45 2006
@@ -1,32 +1,139 @@
<?xml version="1.0"?>
<!--
- Copyright 2004 The Apache Software Foundation
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied.
-
- See the License for the specific language governing permissions and
- limitations under the License.
- -->
+ Copyright 2004 The Apache Software Foundation
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied.
+
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
<document>
<properties>
- <author email="christophe.lombart@gmail.com">Christophe Lombart</author>
+ <author email="christophe.lombart@gmail.com">
+ Christophe Lombart
+ </author>
<title>The Persistence Manager API</title>
</properties>
<body>
-
- <section name="">
- <subsection name="Managing versions">
- <p> TO DO</p>
-
+
+ <section name="Managing versions">
+ <subsection name="Overview">
+ <p>
+ Right now, the OCM tools provides basic versionning features :
+ <ul>
+ <li>Check in, check out.</li>
+ <li>Retrieve version history (first version, last version, the complete history, ...).</li>
+ <li>Apply labels.</li>
+ </ul>
+ </p>
+ <p>
+ Later, we would like to add more advanced versionning support like version compare, replace, revert, ...
+ </p>
+ <p>
+ Each versionned object has to be mapped to a
+ mix:versionable JCR node. Later, it will be possible
+ to add versioning support to any kind of objects.
+ </p>
</subsection>
+ <subsection name="Check in - Check out">
+ <source>
+// Create a new page - first version
+Page page = new Page();
+page.setPath("/page");
+page.setTitle("Page Title");
+page.addParagraph(new Paragraph("para1"));
+page.addParagraph(new Paragraph("para2"));
+persistenceManager.insert(page);
+persistenceManager.save();
+
+// Update the page object and create a new version
+page.addParagraph(new Paragraph("para3"));
+persistenceManager.checkout("/page");
+persistenceManager.update(page);
+persistenceManager.save();
+persistenceManager.checkin("/page");
+
+// Update the page object and create a new version
+page.addParagraph(new Paragraph("para4"));
+persistenceManager.checkout("/page");
+persistenceManager.update(page);
+persistenceManager.save();
+persistenceManager.checkin("/page");
+ </source>
+ </subsection>
+ <subsection name="Retrieve the version history">
+<source>
+VersionIterator versionIterator = persistenceManager.getAllVersions("/page");
+while (versionIterator.hasNext())
+{
+ Version version = (Version) versionIterator.next();
+ System.out.println("version found : "+ version.getName() + " - " +
+ version.getPath() + " - " + version.getCreated().getTime());
+}
+</source>
+ </subsection>
+ <subsection name="Retrieve version description">
+<source>
+// Retrieve the first version description
+Version baseVersion = persistenceManager.getBaseVersion("/page");
+System.out.println("Base version : " + baseVersion.getName());
+
+// Retrieve the latest version description
+Version rootVersion = persistenceManager.getRootVersion("/page");
+System.out.println("Root version : " + rootVersion.getName());
+</source>
+ </subsection>
+ <subsection name="Retrieve the object state matching to a specific version">
+<source>
+//Get the object matching to the first version
+Page page = (Page) persistenceManager.getObject( "/page", "1.0");
+</source>
+ </subsection>
+ <subsection name="Using version labels">
+<source>
+Page page = new Page();
+page.setPath("/page");
+page.setTitle("Page Title");
+page.addParagraph(new Paragraph("para1"));
+page.addParagraph(new Paragraph("para2"));
+persistenceManager.insert(page);
+persistenceManager.save();
+
+// Checkin with some labels
+page.addParagraph(new Paragraph("para3"));
+persistenceManager.checkout("/page");
+persistenceManager.update(page);
+persistenceManager.save();
+persistenceManager.checkin("/page", new String[] {"A", "B"});
+
+// Checkin with some labels
+page.addParagraph(new Paragraph("para4"));
+persistenceManager.checkout("/page");
+persistenceManager.update(page);
+persistenceManager.save();
+persistenceManager.checkin("/page", new String[] {"C", "D"});
+
+// Retrieve all labels
+String[] allLabels = persistenceManager.getAllVersionLabels("/page");
+assertTrue("Incorrect number of labels", allLabels.length == 4);
+
+// Retrieve labels assigned to the version 1.1
+String[] versionLabels = persistenceManager.getVersionLabels("/page", "1.1");
+assertTrue("Incorrect number of labels", versionLabels.length == 2);
+assertTrue("Incorrect label", versionLabels[0].equals("C") || versionLabels[0].equals("D"));
+assertTrue("Incorrect label", versionLabels[1].equals("C") || versionLabels[0].equals("D"));
+
+</source>
+ </subsection>
+
</section>
</body>
</document>
Modified: incubator/graffito/trunk/jcr/jcr-mapping/xdocs/navigation.xml
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/jcr/jcr-mapping/xdocs/navigation.xml?view=diff&rev=465763&r1=465762&r2=465763
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/xdocs/navigation.xml (original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/xdocs/navigation.xml Thu Oct 19 13:23:45 2006
@@ -43,7 +43,7 @@
<item name="Overview" href = "api/api-intro.html" collapse="true" />
<item name="Basic operations" href="api/basic-operations.html" collapse="true"/>
<item name="Search" href="api/search.html" collapse="true"/>
- <item name="Managing Version" href="api/versionning.html" collapse="true"/>
+ <item name="Managing Versions" href="api/versionning.html" collapse="true"/>
<item name="Locking" href="api/locking.html" collapse="true"/>
</menu>