You are viewing a plain text version of this content. The canonical link for it is here.
Posted to graffito-dev@incubator.apache.org by Christophe Lombart <ch...@gmail.com> on 2005/10/20 19:20:38 UTC

Content Version support in Graffito

Hi all,

I'm still working on the JCR integration and I'm wondering what are our
needs in point of view content versionning ?
I would like to start with simple use cases but I want to know if someone
has specific requirements.

Furthermore, how do you see the versionning API in the JCR-mapping
subproject ?
Do we create a new component (like the QueryManager) or add new methods in
the PersistenceManager ?

All ideas, comments, thoughts are welcome.

kind regards,
Christophe

Re: Content Version support in Graffito

Posted by Martin Koci <ma...@aura.cz>.
Christophe Lombart wrote:
> On 10/26/05, Martin Koci <ma...@aura.cz> wrote:
>   
>>  Previous method getVersionLabels() was mistake, because there is no
>> 'latest' version in JCR. Because version are stored as direct acyclic
>> graph there is no information which version is the 'newest'.
>>     
>
> With simple tests, the newest is not the version provided by
> node.getBaseVersion()  or VersionHistory.getRootVersion()
>
> I'm reviewing your code and I have some questions and remarks :
>
> 1.In the methods checkout, checkin, getVersionLabels, addVersionLabel
> : why the object versionableEntity is defined as an argument, it is
> not used in the method impl.
>   
 versionableEntity can be used to some checks like "this object is not 
stored on path".
> I would like to  use one of the following solution:
> * either use only the path
> * or either use only the object (if this one contains the UUID or the
> path). This imply a small refactoring on the others persistenceManager
> methods (as you suggested a couple of days before).
>   
I think JCR is 'path-oriented' (or UUID-oriented) more then 
object-oriented. Operations are performed on paths not objects. So i 
think general API must always accept path or UUID but can contain method 
operating on mapped object:

/**
*@throws if object has no path or UUID mapping
*/
checkin(Object entity) throws NotIdentifiableObjectException


> 2.checkin : Why to split the version number into a String[]. I think a
> simple string arg is more open : checkin(String absPath, Object
> versionableEntity, String versionLabel)
>   
Because one version can have more labels. For example in my application 
one binary content of document has version labels '1.1' and 'B.1'
> 3. Following the jackrabbit mailing list, extra version properties
> (user, comments, ...) has to be added into the matching node.
>
>   
Yes, but not in my app. I solved it with domain object Version which 
stores additional information of each version.

> christophe
>
>
>   


Re: Content Version support in Graffito

Posted by Christophe Lombart <ch...@gmail.com>.
On 10/26/05, Martin Koci <ma...@aura.cz> wrote:
>  Previous method getVersionLabels() was mistake, because there is no
> 'latest' version in JCR. Because version are stored as direct acyclic
> graph there is no information which version is the 'newest'.

With simple tests, the newest is not the version provided by
node.getBaseVersion()  or VersionHistory.getRootVersion()

I'm reviewing your code and I have some questions and remarks :

1.In the methods checkout, checkin, getVersionLabels, addVersionLabel
: why the object versionableEntity is defined as an argument, it is
not used in the method impl.

I would like to  use one of the following solution:
* either use only the path
* or either use only the object (if this one contains the UUID or the
path). This imply a small refactoring on the others persistenceManager
methods (as you suggested a couple of days before).

2.checkin : Why to split the version number into a String[]. I think a
simple string arg is more open : checkin(String absPath, Object
versionableEntity, String versionLabel)

3. Following the jackrabbit mailing list, extra version properties
(user, comments, ...) has to be added into the matching node.


christophe

Re: Content Version support in Graffito

Posted by Martin Koci <ma...@aura.cz>.
Previous method getVersionLabels() was mistake, because there is no 
'latest' version in JCR. Because version are stored as direct acyclic 
graph there is no information which version is the 'newest'. I think 
application logic must decide with version labels, so if my application 
support two dimensional versioning (1.0, 1.1, 2.0, 3.0 ..), method:
public String[] getVersionLabels(final String absPath, final Object 
cmsObject) {
try {
Node node = getNode(absPath);
VersionHistory vh = node.getVersionHistory();
String[] versionLabels = vh.getVersionLabels();
return versionLabels;
} catch (UnsupportedRepositoryOperationException e) {
// node.getVersionHistory() throws 
UnsupportedRepositoryOperationException if this node is not versionable.
throw new 
org.apache.portals.graffito.jcr.exception.RepositoryException("Node is 
not versionable: " + absPath);
} catch (RepositoryException e) {
throw new 
org.apache.portals.graffito.jcr.exception.RepositoryException(e.getMessage(), 
e);
}
}

is more appropriate. It returns ALL version labels for persistent object 
on some path and util method getLatestVersionLabel(versinLabels) returns 
3.0 (from previous example). So then i know latest (newest) version.

Martin Koci wrote:
> Hi,
> suggested API:
> void checkin(String absPath, Object versionableEntity, String[] 
> newVersionNumbers) throws LockedException;
> void checkout(String absPath, Object versionableEntity) throws 
> LockedException;
> String[] getVersionLabels(String absPath, Object cmsObject);
> void addVersionLabel(String absPath, Object entity, String versionLabel);
>
> and (maybe) working implementation:
>
> public void checkin(final String absPath, final Object 
> versionableEntity, final String[] newVersionNumbers) throws 
> LockedException {
> try {
> Node node = getNode(absPath);
> checkIfNodeLocked(absPath);
> Version newVersion = node.checkin();
> VersionHistory versionHistory = node.getVersionHistory();
>
> if (newVersionNumbers != null) {
> for (int i = 0; i < newVersionNumbers.length; i++) {
> String versionLabel = newVersionNumbers[i];
> versionHistory.addVersionLabel(newVersion.getName(), versionLabel, 
> false);
> }
> }
> } catch (UnsupportedRepositoryOperationException e) {
> // This catch UnsupportedRepositoryOperationException potentionally 
> throwed with Node.checkout()
> // indicates that node is not versionable - it means coding bug in 
> jcrmapping.xml/custom_nodes_types.xml
> throw new 
> org.apache.portals.graffito.jcr.exception.RepositoryException("Node is 
> not mix:versionable. Path: " + absPath, e);
> } catch (RepositoryException e) {
> // This typically 'If another error occurs'.
> throw new 
> org.apache.portals.graffito.jcr.exception.RepositoryException("Unknown 
> error on checkin: ", e);
> }
>
> }
>
> public void checkout(final String absPath, final Object 
> versionableEntity) throws LockedException {
> Node node;
> try {
> checkIfNodeLocked(absPath);
> node = getNode(absPath);
> node.checkout();
> } catch (UnsupportedRepositoryOperationException e) {
> // This catch UnsupportedRepositoryOperationException potentionally 
> throwed with Node.checkout()
> // indicates that node is not versionable - it means coding bug in 
> jcrmapping.xml
> throw new 
> org.apache.portals.graffito.jcr.exception.RepositoryException("Node is 
> not mix:versionable. Path: " + absPath, e);
> } catch (RepositoryException e) {
> // This eventually catch LockException e, but
> // this colud never happen - see upper code
> throw new 
> org.apache.portals.graffito.jcr.exception.RepositoryException("Unknown 
> error on checkout: ", e);
> }
> }
>
>
> public String[] getVersionLabels(final String absPath, final Object 
> cmsObject) {
> try {
> Node node = getNode(absPath);
> VersionHistory vh = node.getVersionHistory();
> VersionIterator versionIterator = vh.getAllVersions();
> versionIterator.skip(1);
> vh.getBaseVersion();
> Version version = versionIterator.nextVersion();
> String[] versionLabels = vh.getVersionLabels(version);
> return versionLabels;
> } catch (UnsupportedRepositoryOperationException e) {
> // node.getVersionHistory() throws 
> UnsupportedRepositoryOperationException if this node is not versionable.
> throw new 
> org.apache.portals.graffito.jcr.exception.RepositoryException("Node is 
> not versionable: " + absPath);
> } catch (RepositoryException e) {
> throw new 
> org.apache.portals.graffito.jcr.exception.RepositoryException(e.getMessage(), 
> e);
> }
>
> }
>
> public void addVersionLabel(final String absPath, final Object entity, 
> final String versionLabel) {
> try {
> final Node node = getNode(absPath);
> final VersionHistory versionHistory = node.getVersionHistory();
> final boolean moveLabel = false;
> versionHistory.addVersionLabel(node.getBaseVersion().getName(), 
> versionLabel, moveLabel);
> } catch (UnsupportedRepositoryOperationException e) {
> // node.getVersionHistory() throws 
> UnsupportedRepositoryOperationException if this node is not versionable.
> throw new 
> org.apache.portals.graffito.jcr.exception.RepositoryException("Node is 
> not versionable: " + absPath);
> } catch (RepositoryException e) {
> throw new 
> org.apache.portals.graffito.jcr.exception.RepositoryException("Unknown 
> error on addVersionLabel: ", e);
> }
> }
>
>
> Christophe Lombart wrote:
>> Hi all,
>>
>> I'm still working on the JCR integration and I'm wondering what are our
>> needs in point of view content versionning ?
>> I would like to start with simple use cases but I want to know if 
>> someone
>> has specific requirements.
>>
>> Furthermore, how do you see the versionning API in the JCR-mapping
>> subproject ?
>> Do we create a new component (like the QueryManager) or add new 
>> methods in
>> the PersistenceManager ?
>>
>> All ideas, comments, thoughts are welcome.
>>
>> kind regards,
>> Christophe
>>
>
>
>


-- 
Mgr. Martin Kočí
---------------------------------
AURA, s.r.o.
Úvoz 499/56; 602 00 Brno
ISO 9001 certifikovaná společnost
tel./fax: +420 5 43 24 51 11
e-mail:  martin.koci@aura.cz
internet: http://www.aura.cz
         http://www.j2ee.cz
--------------------------------- 


Re: Content Version support in Graffito and design question

Posted by Christophe Lombart <ch...@gmail.com>.
Hi Martin,

Thanks for your contribution, it looks great.
I'm busy with other works but I promise to review and commit your code
tomorow.

I don't know how to extend version node type. I have to review the spec but
I think nt:version is readonly.
So, I'm not sure that is it possible to update the version node properties.
We can send the question the Jackrabbit mailing list.

kind regards,
Christophe



On 10/25/05, Martin Koci <ma...@aura.cz> wrote:
>
> Hi, how to extends base behaviour of versioning ?
> I need two more properties on Version :
>
> comment (String) - simple description of something interesting with
> version
> authorId (String) - id of user witch performed checkin.
>
> With normal Node it's simple - custom node type. Is there any way to do
> something like that:
>
> <nodeType name="type:version" isMixin="false"
> hasOrderableChildNodes="false" >
> <supertypes>
> <supertype>nt:version</supertype>
> </supertypes>
> <propertyDefinition name="ext:comment" requiredType="String"
> autoCreated="false" mandatory="false" onParentVersion="COPY"
> protected="false" multiple="false" />
> <propertyDefinition name="ext:authorId" requiredType="String"
> autoCreated="false" mandatory="false" onParentVersion="COPY"
> protected="false" multiple="false" />
> </nodeType>
>
> Thanks,
>
> Martin
>
> Martin Koci wrote:
> > Hi,
> > suggested API:
> > void checkin(String absPath, Object versionableEntity, String[]
> > newVersionNumbers) throws LockedException;
> > void checkout(String absPath, Object versionableEntity) throws
> > LockedException;
> > String[] getVersionLabels(String absPath, Object cmsObject);
> > void addVersionLabel(String absPath, Object entity, String
> versionLabel);
> >
> > and (maybe) working implementation:
> >
> > public void checkin(final String absPath, final Object
> > versionableEntity, final String[] newVersionNumbers) throws
> > LockedException {
> > try {
> > Node node = getNode(absPath);
> > checkIfNodeLocked(absPath);
> > Version newVersion = node.checkin();
> > VersionHistory versionHistory = node.getVersionHistory();
> >
> > if (newVersionNumbers != null) {
> > for (int i = 0; i < newVersionNumbers.length; i++) {
> > String versionLabel = newVersionNumbers[i];
> > versionHistory.addVersionLabel(newVersion.getName(), versionLabel,
> > false);
> > }
> > }
> > } catch (UnsupportedRepositoryOperationException e) {
> > // This catch UnsupportedRepositoryOperationException potentionally
> > throwed with Node.checkout()
> > // indicates that node is not versionable - it means coding bug in
> > jcrmapping.xml/custom_nodes_types.xml
> > throw new
> > org.apache.portals.graffito.jcr.exception.RepositoryException("Node is
> > not mix:versionable. Path: " + absPath, e);
> > } catch (RepositoryException e) {
> > // This typically 'If another error occurs'.
> > throw new
> > org.apache.portals.graffito.jcr.exception.RepositoryException("Unknown
> > error on checkin: ", e);
> > }
> >
> > }
> >
> > public void checkout(final String absPath, final Object
> > versionableEntity) throws LockedException {
> > Node node;
> > try {
> > checkIfNodeLocked(absPath);
> > node = getNode(absPath);
> > node.checkout();
> > } catch (UnsupportedRepositoryOperationException e) {
> > // This catch UnsupportedRepositoryOperationException potentionally
> > throwed with Node.checkout()
> > // indicates that node is not versionable - it means coding bug in
> > jcrmapping.xml
> > throw new
> > org.apache.portals.graffito.jcr.exception.RepositoryException("Node is
> > not mix:versionable. Path: " + absPath, e);
> > } catch (RepositoryException e) {
> > // This eventually catch LockException e, but
> > // this colud never happen - see upper code
> > throw new
> > org.apache.portals.graffito.jcr.exception.RepositoryException("Unknown
> > error on checkout: ", e);
> > }
> > }
> >
> >
> > public String[] getVersionLabels(final String absPath, final Object
> > cmsObject) {
> > try {
> > Node node = getNode(absPath);
> > VersionHistory vh = node.getVersionHistory();
> > VersionIterator versionIterator = vh.getAllVersions();
> > versionIterator.skip(1);
> > vh.getBaseVersion();
> > Version version = versionIterator.nextVersion();
> > String[] versionLabels = vh.getVersionLabels(version);
> > return versionLabels;
> > } catch (UnsupportedRepositoryOperationException e) {
> > // node.getVersionHistory() throws
> > UnsupportedRepositoryOperationException if this node is not versionable.
> > throw new
> > org.apache.portals.graffito.jcr.exception.RepositoryException("Node is
> > not versionable: " + absPath);
> > } catch (RepositoryException e) {
> > throw new
> > org.apache.portals.graffito.jcr.exception.RepositoryException(
> e.getMessage(),
> > e);
> > }
> >
> > }
> >
> > public void addVersionLabel(final String absPath, final Object entity,
> > final String versionLabel) {
> > try {
> > final Node node = getNode(absPath);
> > final VersionHistory versionHistory = node.getVersionHistory();
> > final boolean moveLabel = false;
> > versionHistory.addVersionLabel(node.getBaseVersion().getName(),
> > versionLabel, moveLabel);
> > } catch (UnsupportedRepositoryOperationException e) {
> > // node.getVersionHistory() throws
> > UnsupportedRepositoryOperationException if this node is not versionable.
> > throw new
> > org.apache.portals.graffito.jcr.exception.RepositoryException("Node is
> > not versionable: " + absPath);
> > } catch (RepositoryException e) {
> > throw new
> > org.apache.portals.graffito.jcr.exception.RepositoryException("Unknown
> > error on addVersionLabel: ", e);
> > }
> > }
> >
> >
> > Christophe Lombart wrote:
> >> Hi all,
> >>
> >> I'm still working on the JCR integration and I'm wondering what are our
> >> needs in point of view content versionning ?
> >> I would like to start with simple use cases but I want to know if
> >> someone
> >> has specific requirements.
> >>
> >> Furthermore, how do you see the versionning API in the JCR-mapping
> >> subproject ?
> >> Do we create a new component (like the QueryManager) or add new
> >> methods in
> >> the PersistenceManager ?
> >>
> >> All ideas, comments, thoughts are welcome.
> >>
> >> kind regards,
> >> Christophe
> >>
> >
> >
> >
>
>
> --
> Mgr. Martin Kočí
> ---------------------------------
> AURA, s.r.o.
> Úvoz 499/56; 602 00 Brno
> ISO 9001 certifikovaná společnost
> tel./fax: +420 5 43 24 51 11
> e-mail: martin.koci@aura.cz
> internet: http://www.aura.cz
> http://www.j2ee.cz
> ---------------------------------
>
>

Re: Content Version support in Graffito and design question

Posted by Martin Koci <ma...@aura.cz>.
Hi, how to extends base behaviour of versioning ?
I need two more properties on Version :

comment (String) - simple description of something interesting with version
authorId (String) - id of user witch performed checkin.

With normal Node it's simple - custom node type. Is there any way to do 
something like that:

<nodeType name="type:version" isMixin="false" 
hasOrderableChildNodes="false" >
<supertypes>
<supertype>nt:version</supertype>
</supertypes>
<propertyDefinition name="ext:comment" requiredType="String" 
autoCreated="false" mandatory="false" onParentVersion="COPY" 
protected="false" multiple="false" />
<propertyDefinition name="ext:authorId" requiredType="String" 
autoCreated="false" mandatory="false" onParentVersion="COPY" 
protected="false" multiple="false" />
</nodeType>

Thanks,

Martin

Martin Koci wrote:
> Hi,
> suggested API:
> void checkin(String absPath, Object versionableEntity, String[] 
> newVersionNumbers) throws LockedException;
> void checkout(String absPath, Object versionableEntity) throws 
> LockedException;
> String[] getVersionLabels(String absPath, Object cmsObject);
> void addVersionLabel(String absPath, Object entity, String versionLabel);
>
> and (maybe) working implementation:
>
> public void checkin(final String absPath, final Object 
> versionableEntity, final String[] newVersionNumbers) throws 
> LockedException {
> try {
> Node node = getNode(absPath);
> checkIfNodeLocked(absPath);
> Version newVersion = node.checkin();
> VersionHistory versionHistory = node.getVersionHistory();
>
> if (newVersionNumbers != null) {
> for (int i = 0; i < newVersionNumbers.length; i++) {
> String versionLabel = newVersionNumbers[i];
> versionHistory.addVersionLabel(newVersion.getName(), versionLabel, 
> false);
> }
> }
> } catch (UnsupportedRepositoryOperationException e) {
> // This catch UnsupportedRepositoryOperationException potentionally 
> throwed with Node.checkout()
> // indicates that node is not versionable - it means coding bug in 
> jcrmapping.xml/custom_nodes_types.xml
> throw new 
> org.apache.portals.graffito.jcr.exception.RepositoryException("Node is 
> not mix:versionable. Path: " + absPath, e);
> } catch (RepositoryException e) {
> // This typically 'If another error occurs'.
> throw new 
> org.apache.portals.graffito.jcr.exception.RepositoryException("Unknown 
> error on checkin: ", e);
> }
>
> }
>
> public void checkout(final String absPath, final Object 
> versionableEntity) throws LockedException {
> Node node;
> try {
> checkIfNodeLocked(absPath);
> node = getNode(absPath);
> node.checkout();
> } catch (UnsupportedRepositoryOperationException e) {
> // This catch UnsupportedRepositoryOperationException potentionally 
> throwed with Node.checkout()
> // indicates that node is not versionable - it means coding bug in 
> jcrmapping.xml
> throw new 
> org.apache.portals.graffito.jcr.exception.RepositoryException("Node is 
> not mix:versionable. Path: " + absPath, e);
> } catch (RepositoryException e) {
> // This eventually catch LockException e, but
> // this colud never happen - see upper code
> throw new 
> org.apache.portals.graffito.jcr.exception.RepositoryException("Unknown 
> error on checkout: ", e);
> }
> }
>
>
> public String[] getVersionLabels(final String absPath, final Object 
> cmsObject) {
> try {
> Node node = getNode(absPath);
> VersionHistory vh = node.getVersionHistory();
> VersionIterator versionIterator = vh.getAllVersions();
> versionIterator.skip(1);
> vh.getBaseVersion();
> Version version = versionIterator.nextVersion();
> String[] versionLabels = vh.getVersionLabels(version);
> return versionLabels;
> } catch (UnsupportedRepositoryOperationException e) {
> // node.getVersionHistory() throws 
> UnsupportedRepositoryOperationException if this node is not versionable.
> throw new 
> org.apache.portals.graffito.jcr.exception.RepositoryException("Node is 
> not versionable: " + absPath);
> } catch (RepositoryException e) {
> throw new 
> org.apache.portals.graffito.jcr.exception.RepositoryException(e.getMessage(), 
> e);
> }
>
> }
>
> public void addVersionLabel(final String absPath, final Object entity, 
> final String versionLabel) {
> try {
> final Node node = getNode(absPath);
> final VersionHistory versionHistory = node.getVersionHistory();
> final boolean moveLabel = false;
> versionHistory.addVersionLabel(node.getBaseVersion().getName(), 
> versionLabel, moveLabel);
> } catch (UnsupportedRepositoryOperationException e) {
> // node.getVersionHistory() throws 
> UnsupportedRepositoryOperationException if this node is not versionable.
> throw new 
> org.apache.portals.graffito.jcr.exception.RepositoryException("Node is 
> not versionable: " + absPath);
> } catch (RepositoryException e) {
> throw new 
> org.apache.portals.graffito.jcr.exception.RepositoryException("Unknown 
> error on addVersionLabel: ", e);
> }
> }
>
>
> Christophe Lombart wrote:
>> Hi all,
>>
>> I'm still working on the JCR integration and I'm wondering what are our
>> needs in point of view content versionning ?
>> I would like to start with simple use cases but I want to know if 
>> someone
>> has specific requirements.
>>
>> Furthermore, how do you see the versionning API in the JCR-mapping
>> subproject ?
>> Do we create a new component (like the QueryManager) or add new 
>> methods in
>> the PersistenceManager ?
>>
>> All ideas, comments, thoughts are welcome.
>>
>> kind regards,
>> Christophe
>>
>
>
>


-- 
Mgr. Martin Kočí
---------------------------------
AURA, s.r.o.
Úvoz 499/56; 602 00 Brno
ISO 9001 certifikovaná společnost
tel./fax: +420 5 43 24 51 11
e-mail:  martin.koci@aura.cz
internet: http://www.aura.cz
         http://www.j2ee.cz
--------------------------------- 


Re: Content Version support in Graffito

Posted by Martin Koci <ma...@aura.cz>.
Hi,
 suggested API:
    void checkin(String absPath, Object versionableEntity, String[] 
newVersionNumbers) throws LockedException;
    void checkout(String absPath, Object versionableEntity) throws 
LockedException;
    String[] getVersionLabels(String absPath, Object cmsObject);
    void addVersionLabel(String absPath, Object entity, String 
versionLabel);

and (maybe) working implementation:

 public void checkin(final String absPath, final Object 
versionableEntity, final  String[] newVersionNumbers) throws 
LockedException {
        try {
            Node node = getNode(absPath);
            checkIfNodeLocked(absPath);
            Version newVersion = node.checkin();
            VersionHistory versionHistory = node.getVersionHistory();

            if (newVersionNumbers != null) {
                for (int i = 0; i < newVersionNumbers.length; i++) {
                    String versionLabel = newVersionNumbers[i];
                    versionHistory.addVersionLabel(newVersion.getName(), 
versionLabel, false);
                }
            }
        } catch (UnsupportedRepositoryOperationException e) {
            // This catch UnsupportedRepositoryOperationException 
potentionally throwed with Node.checkout()
            // indicates that node is not versionable - it means coding 
bug in jcrmapping.xml/custom_nodes_types.xml
            throw new 
org.apache.portals.graffito.jcr.exception.RepositoryException("Node is 
not mix:versionable. Path: " + absPath, e);
        } catch (RepositoryException e) {
            // This typically 'If another error occurs'.
            throw new 
org.apache.portals.graffito.jcr.exception.RepositoryException("Unknown 
error on checkin: ", e);
        }

    }

    public void checkout(final String absPath, final Object 
versionableEntity) throws LockedException {
        Node node;
        try {
            checkIfNodeLocked(absPath);
            node = getNode(absPath);
            node.checkout();
        } catch (UnsupportedRepositoryOperationException e) {
            // This catch UnsupportedRepositoryOperationException 
potentionally throwed with Node.checkout()
            // indicates that node is not versionable - it means coding 
bug in jcrmapping.xml
            throw new 
org.apache.portals.graffito.jcr.exception.RepositoryException("Node is 
not mix:versionable. Path: " + absPath, e);
        } catch (RepositoryException e) {
            // This eventually catch LockException e, but
            // this colud never happen - see upper code
            throw new 
org.apache.portals.graffito.jcr.exception.RepositoryException("Unknown 
error on checkout: ", e);
        }
    }

 
    public String[] getVersionLabels(final String absPath, final Object 
cmsObject) {
        try {
            Node node = getNode(absPath);
            VersionHistory vh = node.getVersionHistory();
            VersionIterator versionIterator = vh.getAllVersions();
            versionIterator.skip(1);
            vh.getBaseVersion();
            Version version = versionIterator.nextVersion();
            String[] versionLabels = vh.getVersionLabels(version);
            return versionLabels;
        } catch (UnsupportedRepositoryOperationException e) {
            // node.getVersionHistory() throws 
UnsupportedRepositoryOperationException if this node is not versionable.
            throw new 
org.apache.portals.graffito.jcr.exception.RepositoryException("Node is 
not versionable: " + absPath);
        } catch (RepositoryException e) {
            throw new 
org.apache.portals.graffito.jcr.exception.RepositoryException(e.getMessage(), 
e);
        }

    }

    public void addVersionLabel(final String absPath, final Object 
entity, final String versionLabel) {
        try {
            final Node node = getNode(absPath);
            final VersionHistory versionHistory = node.getVersionHistory();
            final boolean moveLabel = false;
            
versionHistory.addVersionLabel(node.getBaseVersion().getName(), 
versionLabel, moveLabel);
        } catch (UnsupportedRepositoryOperationException e) {
            // node.getVersionHistory() throws 
UnsupportedRepositoryOperationException if this node is not versionable.
            throw new 
org.apache.portals.graffito.jcr.exception.RepositoryException("Node is 
not versionable: " + absPath);
        } catch (RepositoryException e) {
            throw new 
org.apache.portals.graffito.jcr.exception.RepositoryException("Unknown 
error on addVersionLabel: ", e);
        }
    }


Christophe Lombart wrote:
> Hi all,
>
> I'm still working on the JCR integration and I'm wondering what are our
> needs in point of view content versionning ?
> I would like to start with simple use cases but I want to know if someone
> has specific requirements.
>
> Furthermore, how do you see the versionning API in the JCR-mapping
> subproject ?
> Do we create a new component (like the QueryManager) or add new methods in
> the PersistenceManager ?
>
> All ideas, comments, thoughts are welcome.
>
> kind regards,
> Christophe
>
>