chemistry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Denis Andreev" <andr...@elilink.com>
Subject RE: Alfresco - DotCmis - GetAcl issue
Date Thu, 26 Dec 2013 15:01:50 GMT
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:fmui@apache.org] 
Sent: Thursday, December 26, 2013 2:02 PM
To: dev@chemistry.apache.org
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
> 
>  
> 
> 


Mime
View raw message