chemistry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mano Swerts <m.swe...@aca-it.be>
Subject Re: Difference between document version accessed by VersioningService or session.getObject
Date Thu, 02 Feb 2012 07:46:12 GMT
Hi Florian,

Thanks for the quick reply.

It is definitely not a caching issue, stopping and starting the server is
does not resolve the issue.

I was not aware of the Document.getAllVersions() method. I tried it out,
but the result was the same:

Document cmisDocument = (Document)
cmisSession.getObject(newObjectIdImpl(documentId));

List<Document> documentVersions = cmisDocument.getAllVersions();

Document cmisDocument2 = documentVersions.get(0);


cmisDocument.getId(); //
output workspace://SpacesStore/dd3ddd5f-8205-426c-9002-9867804d3a25

cmisDocument.getVersionLabel(); // output 3.0

((GregorianCalendar) cmisDocument.getPropertyValue(
"park:documentCreationDate")).getTime(); // output 2nd of February 2012


cmisDocument2.getId(); // output
workspace://SpacesStore/dd3ddd5f-8205-426c-9002-9867804d3a25;3.0

cmisDocument2.getVersionLabel(); // output 3.0

((GregorianCalendar) cmisDocument2.getPropertyValue(
"park:documentCreationDate")).getTime(); // output 1th of February 2012

In the Workbench I can see the latest version as version 3.0 with the value
"2nd of February" as I expected. I can see that there are 3 versions for
this document, but I cannot see my custom properties for each version. I
attached screenshots of the workbench.

Met vriendelijke groeten,
Kind regards,
Bien à vous,

Mano Swerts
Solution Engineer

_______________________________________________________

ACA IT-Solutions

Ilgatlaan 5C                        Clovislaan 82
B-3500 Hasselt                   B-1000 Brussel
Belgium                              Belgium

T: +32 (0)11 26 50 10          E: m.swerts@aca-it.be
F: +32 (0)11 26 50 11          U: www.aca-it.be
M: +32 (0)484 80 81 45
______________________________________________________



On Wed, Feb 1, 2012 at 6:08 PM, Florian Müller <fmui@apache.org> wrote:

>
> Hi Mano,
>
> I can't tell you what's going wrong here. Probably a caching issue.
>
> But before I dig deeper, two questions:
> 1) Does the CMIS Workbench show the correct property values?
> 2) Is there any reason not to use Document.getAllVersions()?
>
>
> Cheers,
>
> Florian
>
>
> [1] http://chemistry.apache.org/**java/0.6.0/maven/apidocs/org/**
> apache/chemistry/opencmis/**client/api/Document.html#**
> getAllVersions%28%29<http://chemistry.apache.org/java/0.6.0/maven/apidocs/org/apache/chemistry/opencmis/client/api/Document.html#getAllVersions%28%29>
>
>
> Am Mittwoch, den 01.02.2012, 16:37 +0100 schrieb Mano Swerts <
> m.swerts@aca-it.be>:
>
>> Hi all,
>>
>> I seem to have a little problem with the display of all versions of a
>> particular document to users. I do not know if this is a bug in CMIS, in
>> Alfresco or if this is as designed.
>>
>> I fetch all versions of a particular document using the
>> VersioningService object.
>> Then I loop over these versions to get convert them to a CMIS Document to
>> be able to fetch all properties. In the my custom user interface I noticed
>> that the first version did not have any custom properties filled in. Then
>> I
>> also noticed that the last version in my listing (which is equal to the
>> current working version in the repository and therefore also in my app)
>> does not reflect the latest metadata as the current working document does
>> in the rest of the application. So it seems that when I list the metadata
>> of all versions, that they are 1 off. So this means metadata for version
>> 1.0 is not filled in (when it actually is), metadata for version 2.0 seems
>> to be the metadata for version 1.0, and so forth.
>>
>> When I look into node browser that comes with Alfresco, I can only see the
>> current version. The current version is *3.0* and contains a data property
>> called park:documentCreationDate. It is set to the *2nd of February*.
>>
>> However when I list versions using the VersioningService, it shows the
>> same
>> property with a value of the *1th of February*, also version *3.0*.
>>
>>
>> I confirmed the above behavior with the following code:
>>
>> String repositoryId = cmisSession.getRepositoryInfo(**).getId();
>>
>> String documentId =
>> "workspace://SpacesStore/**81b81e8c-ec20-4cdd-b650-**552cb9eb5e5b";
>>
>> List<ObjectData> versions =
>>
>> cmisSession.getBinding().**getVersioningService().**
>> getAllVersions(repositoryId,
>> documentId, null, null, null, null);
>>
>> ObjectFactoryImpl factory = new ObjectFactoryImpl();
>>
>> factory.initialize(**cmisSession, null);
>>
>>
>> Document cmisDocument = (Document) factory.convertObject(**
>> versions.get(0),
>> cmisSession.**createOperationContext());
>>
>>
>> cmisDocument.getPropertyValue(**"cmis:objectId"); //
>> output workspace://SpacesStore/**81b81e8c-ec20-4cdd-b650-**
>> 552cb9eb5e5b;3.0
>>
>> cmisDocument.getPropertyValue(**"cmis:versionLabel"); // output 3.0
>>
>> cmisDocument.getPropertyValue(**"park:documentCreationDate"); // output
>> GregorianCalendar with value of 1th of February 2012
>>
>>
>> Document cmisDocument2 = cmisSession.getObject(new ObjectIdImpl(documentId
>> ));
>>
>> cmisDocument2.**getPropertyValue("cmis:**versionLabel"); // output 3.0
>> cmisDocument2.**getPropertyValue("park:**documentCreationDate"); //
>> output
>> GregorianCalendar with value of 2th of February 2012
>>
>> So it seems that although they have the same version and should point to
>> the same document, it seems that putting the version number in the ID
>> directs to an other document. However then the second way to access it
>> should return 4.0 and not 3.0. I am very confused of what is going on
>> here,
>> because I request the versions for a specific ID and they can have
>> different values for the same version.
>>
>> Thanks.
>>
>> -- Mano
>>
>
>

Mime
  • Unnamed multipart/mixed (inline, None, 0 bytes)
View raw message