0

Context

In CMIS, a ChangeEvent tells me that an object has been deleted on the remote server, and that the objectId of this object is for instance workspace://SpacesStore/3aca9034-3f53-4946-a0d9-ebcf054912a2;1.0 (real example of ChangeEvent.Properties[cmis:objectId]).

I locally kept the various identifiers of all objects, but none of the identifiers match exactly the identifier in the ChangeEvent:

  • Document.Properties[cmis:objectId] is
    3aca9034-3f53-4946-a0d9-ebcf054912a2;1.0
  • Document.Properties[alfcmis:nodeRef] is
    workspace://SpacesStore/3aca9034-3f53-4946-a0d9-ebcf054912a2.

Question

How should I translate from ChangeEvent.Properties[cmis:objectId] to Document.Properties[cmis:objectId]?

(eg. from workspace://SpacesStore/3aca9034-3f53-4946-a0d9-ebcf054912a2;1.0 to 3aca9034-3f53-4946-a0d9-ebcf054912a2;1.0

I could just remove the first 24 characters, but I guess it would only work for Alfresco, and not with other CMIS servers.

Environment

Alfresco Community 4.2.e accessed by DotCMIS via
http://server/alfresco/api/-default-/public/cmis/versions/1.0/atom

Nicolas Raoul
  • 58,567
  • 58
  • 222
  • 373
  • Just to check - are you seeing this with the new Alfresco CMIS 1.1 endpoint? (IIRC some of the older endpoints did different things WRT noderef <-> objectID mapping) – Gagravarr Mar 10 '14 at 09:37
  • @Gagravarr I am using this URL: `http://192.168.0.142:8080/alfresco/api/-default-/public/cmis/versions/1.0/atom` – Nicolas Raoul Mar 10 '14 at 15:31
  • Does it change if you swap `1.0` for `1.1` in the endpoint? (So picking the CMIS 1.1 version rather than 1.1) – Gagravarr Mar 10 '14 at 16:14
  • @Gagravarr: Unfortunately I use DotCMIS which is not compatible with 1.1 :-/ https://issues.apache.org/jira/browse/CMIS-742 – Nicolas Raoul Mar 10 '14 at 16:21
  • Yes, your hunch is correct. You cannot simply truncate the Alfresco node reference. That logic won't work with other servers and it might break between versions of Alfresco. I'm not sure what the problem is. Is it that you saved off the Alfresco node reference when you should have saved the CMIS object ID? – Jeff Potts Mar 17 '14 at 18:51
  • @JeffPotts: In debug mode I deeply inspected all properties of both the ChangeEvent and Document objects. There is no exact match of any kind of identifier between the two. – Nicolas Raoul Mar 18 '14 at 02:39
  • Yes, that is true, I am just wondering why that is a problem for you. – Jeff Potts Mar 18 '14 at 18:01
  • @JeffPotts: Sorry, I should have explained that. CmisSync keeps a local SQLite database of synced files with {local path, `Document.Properties[cmis:objectId]`} couples. When a ChangeEvent arrives, we read the `ChangeEvent.Properties[cmis:objectId]` and try to find any matching `Document.Properties[cmis:objectId]` in the SQLite database. Is that not how ChangeLog is supposed to be used? By the way, thanks for your great insight always! – Nicolas Raoul Mar 19 '14 at 03:44
  • You are using cmis:objectId everywhere. Therefore you should not need the Alfresco node reference for anything. – Jeff Potts Apr 10 '14 at 17:43

1 Answers1

0

Need to assign from DotCMIS from Alfresco apache chemeistry support please go through below code for access object id from file name using c#..

 IFolder selectedFolder1 = session1.GetObject(ObjectID) as IFolder;
   foreach (ICmisObject cmisObject in selectedFolder1.GetChildren())
     {
       if (cmisObject.GetType() != typeof(DotCMIS.Client.Impl.Folder))
         {
           if (cmisObject.Name.Contains(Uid))
              {
                        return false;

               }

          }
    }