Like Denis, I've found that the way identity is defined in CMIS is a constant 
source of confusion, so I raised this with the committee last year (see this 
CMIS mailing list discussion [1]).

The basic problem is that CMIS 1.0 and 1.1 don't have any general purpose way 
to identify an object in a version-independent way - if you're an Alfresco user 
this is particularly problematic as it's fundamentally different to how 
Alfresco natively identifies objects, and it's easy to make the (mistaken) 
assumption that CMIS identity and Alfresco identity are equivalent.  
cmis:versionSeriesId comes closest to Alfresco's notion of identity, but it has 
several limitations that make it less useful today than it could/should be - in 
a nutshell a client application can't rely on it (since it's an optional 
property), and most services (including GetACL) don't have "XXXOfLatestVersion" 
equivalents.

Apparently the Oracle representative on the TC is preparing a proposal that 
addresses this issue, but it hasn't been presented to the TC yet.  I'm sitting 
in on the TC calls specifically to see what's being proposed, as this is one of 
the most common issues I'm seeing in my work with CMIS client implementers.

And finally just to reinforce what Florian said about not parsing objectIds - 
in Alfresco we have substantially changed the representation of objectIds in 
Alfresco Cloud and Alfresco v4.2, and those changes will break any code that is 
parsing the old (<= v4.1) format.  While we knew this would break some 
non-spec-compliant client code, we needed to move away from using raw NodeRefs 
in CMIS objectIds for other reasons (mostly related exposing the Alfresco Cloud 
via CMIS).

Cheers,
Peter

[1] 
http://markmail.org/message/wuky4nvpazub74x5?q=list:org%2Eoasis-open%2Elists%2Ecmis+peter+monks




On Dec 26, 2013, at 7:29 AM, Florian Müller <[email protected]> wrote:

> Hi Denis,
> 
> there is no "normal logic" here. The CMIS specification defines that
> object IDs are opaque strings. Clients cannot and should not try to
> interpret these strings because they are repository specific. Other
> repositories use totally different formats.
> Therefore, DotCMIS treats object IDs just as strings. When you provide
> an invalid ID, its passes it to the repository and the repository
> returns an error message.
> 
> When you need the latest version, you have to call
> GetObjectOfLatestVersion or GetAllVerions. You don't have to call
> GetAcl, though. You can provide an operation context, that indicates
> that you want the object ACL with the object metadata. The repository
> then attaches the ACL to the IDocument object.
> 
> 
> Regards,
> 
> Florian
> 
> 
> 
>> Hi Florian
>> I consider it's normal logic - if document ID does not contain a version
>> number then the latest version should be returned by default. Otherwise to
>> get ACL three methods should be invoked instead of one.
>> Let's assume there is a document id -
>> workspace://SpacesStore/4d7f6e4f-692e-4adc-afc8-039d7604245a
>> The last version is 3.1. The problem is I don't know the last version
>> number. 
>> Thereby to get ACL I should do the following:
>> 1. Get the document for first version
>> doc =
>> Session.GetObject(workspace://SpacesStore/4d7f6e4f-692e-4adc-afc8-039d760424
>> 5a;1.0)
>> 
>> 2. Get the latest version
>> doc.GetObjectOfLatestVersion
>> 
>> 3. Get ACL for the latest version
>> Session.GetAcl(workspace://SpacesStore/4d7f6e4f-692e-4adc-afc8-039d7604245a;
>> 3.1)
>> 
>> It's not good logic. It's going to be a performance issue if these
>> operations are going to be repeated for hundreds of thousands documents.
>> There is really no way to not use version number?
>> 
>> I tried to add the following code into GetObjectInternal:
>>            if (idOrPath == IdentifierType.Id &&
>> !objectIdOrPath.Contains(";"))
>>            {
>>                int i = entry.Id.IndexOf(';');
>>                if (i != -1)
>>                    entry.Id = entry.Id.Substring(0, i);
>>            }
>> But I'm not sure it will work properly in all cases:)
>> 
>> Best regards,
>> Denis Andreev
>> 
>> 
>> -----Original Message-----
>> From: Florian Müller [mailto:[email protected]] 
>> Sent: Thursday, December 26, 2013 2:02 PM
>> To: [email protected]
>> Cc: Alfresco Team
>> Subject: Re: Alfresco - DotCmis - GetAcl issue
>> 
>> Hi Denis,
>> 
>> Alfresco document IDs without a version number are not valid CMIS object
>> IDs. Alfresco accepts them in some places for convenience but you shouldn't
>> rely on it. That is, DotCMIS behaves as excepted. (See also [1].)
>> 
>> 
>> Regards,
>> 
>> Florian
>> 
>> 
>> [1]
>> http://stackoverflow.com/questions/19364811/client-cache-enabled-but-ignored
>> -on-alfresco/19367870#19367870
>> 
>> 
>> Denis Andreev schrieb:
>>> Hi Everyone
>>> 
>>> There is an issue with getting ACL for a document. The method 
>>> Session.GetAcl throws DotCMIS.Exceptions.CmisObjectNotFoundException :
>> Unknown object!
>>> 
>>> 
>>> Exception stack:
>>> 
>>> at
>> DotCMIS.Binding.AtomPub.AbstractAtomPubService.ThrowLinkException(String
>>> repositoryId, String id, String rel, String type) in atompub.cs: line 394
>> 
>>> at 
>>> DotCMIS.Binding.AtomPub.AbstractAtomPubService.GetAclInternal(String
>>> repositoryId, String objectId, Nullable`1 onlyBasicPermissions,
>>> IExtensionsData extension) in atompub.cs: line 645   
>>> 
>>> at DotCMIS.Binding.AtomPub.AclService.GetAcl(String repositoryId, 
>>> String objectId, Nullable`1 onlyBasicPermissions, IExtensionsData
>> extension) in
>>> atompub.cs: line 2760   
>>> 
>>> at DotCMIS.Client.Impl.Session.GetAcl(IObjectId objectId, Boolean
>>> onlyBasicPermissions) in client-impl.cs: line 869
>>> 
>>> 
>>> 
>>> It happens when ObjectId passed to the Session.GetAcl does not have 
>>> document version.
>>> 
>>> For example
>>> 
>>> There is a document id -
>>> workspace://SpacesStore/96f5a5ae-aea2-497b-80db-d3f646adb293
>>> 
>>> 
>>> 
>>> If the ID is passed to Session.GetAcl() as 
>>> "workspace://SpacesStore/96f5a5ae-aea2-497b-80db-d3f646adb293;1.0" the 
>>> it works.
>>> 
>>> If workspace://SpacesStore/96f5a5ae-aea2-497b-80db-d3f646adb293 then 
>>> it doesn't work
>>> 
>>> 
>>> 
>>> I looked into the code and found out that the problem can be in the 
>>> method AbstractAtomPubService.GetObjectInternal
>>> 
>>> The object is requested from Alfresco
>>> 
>>> 
>>> 
>>> HttpUtils.Response resp = Read(url);
>>> 
>>> AtomEntry entry = Parse<AtomEntry>(resp.Stream);
>>> 
>>> 
>>> 
>>> That is the parameter "url" contains the object id without version 
>>> number but response contains ID with version.
>>> 
>>> In the issue further in GetObjectInternal
>>> 
>>> AddLink(repositoryId, entry.Id, (AtomLink)element.Object)
>>> 
>>> Adds the object link with version number but then in the method 
>>> LoadLink
>>> 
>>> GetObjectInternal(repositoryId, IdentifierType.Id, id, 
>>> ReturnVersion.This, null, null, null, null, null, null, null);
>>> 
>>>       link = GetLink(repositoryId, id, rel, type);
>>> 
>>> link is null
>>> 
>>> 
>>> 
>>> I think the method should work in spite of the version number is 
>>> available or not.
>>> 
>>> Would you please have a look at the code and do something with it.
>>> 
>>> 
>>> 
>>> Best regards,
>>> 
>>> Denis Andreev
>>> 
>>> 
>>> 
>>> 
>> 
>> 
> 

Reply via email to