How to know if a document is a version with Java Client 3.5.0


I am trying to know if a document is a version, but Java Client doesn't retrieve that information about a document. When I use the “fetchDocumentById” method, I get a “Document” object, but I have no properties to know if it is a version or not. I have included the “properties” header with the “*” value in order to retrieve all propoerties, but “ecm” properties are not retrieved.

I have used the REST API and I can see two properties that can tell me if the document is a version or not: versionableId and isVersion. However, none of them are present in the “Document” object retrieved by the fetchDocumentById method.

Then, how can I know if a document is a version? I have also seen a facet called “Immutable” present in versions, but I am not sure if it is possible there are other documents with that facet without being a version.

Thank you.

0 votes

2 answers




I've just created JAVACLIENT-197 ticket to add missing fields to Document class.

In the meantime, you should be able to extend the Document class in order to add missing fields + register this new class during client construction. You can find more information in the documentation, in your case you should have something like below:

NuxeoClient client = new NuxeoClient.Builder()
                            .authentication("Administrator", "Administrator")
                            .registerEntity(EntityTypes.DOCUMENT, YourDocument.class);
1 votes


We've released today the 3.6.0 version which contains JAVACLIENT-197.



Amazing! I will update my Nuxeo Java Client version to 3.6.0. Thank you!


The property which differentiate a live document from a version is ecm:isVersion.


0 votes

Hello. I knew about that property, and it is retrieved with the REST API. However, that property it is not retrieved with Java Client when doing a "fetchDocumentById" (and I am including the "properties" header with an "*" to see all properties). The "Document" object retrieved doesn't have such property, nor any of "ecm". So, how can I know if the document is a version in this situation? Is it a Java Client bug?

Hi, I'm not an expert of the .NET client but you should retrieve any document property no?

Hello. I am using Java Client, not .NET Client. However, I think they work similar. All SDKs work over the nuxeo REST API. If you retrieve a document and all its properties using the REST API, properties from "ecm" schema are not retrieved (as "ecm" is not a "real" schema). With the REST API you can get the "isVersion" property, but not in the "properties" array ( However, this is not available in Java Client; the object "Document" in Java Client doesn't have a "isVersion" property, so I think this value is lost in object mapping. Thank you.