Sachin
Sachin

Reputation: 1715

How to convert cmis event object id to cmis document object id or vice versa

I was trying out alfresco with openCMIS and ran into this issue. When am retrieving id of a CMISObject I'm getting object id like workspace://SpacesStore/3a2bcd68-aabc-42ed-8229-bf8237aa59b7;1.0. And when am accessing changes in alfresco am getting object id of event as 3a2bcd68-aabc-42ed-8229-bf8237aa59b7;1.0. How do I get rid of workspace://SpaceStore ?

Code snippets :-

private void getAllFilesInPath(String folderId, ArrayList<String> filesList) {
   ItemIterable<CmisObject> children = FileUtils.getFolder(folderId, sessionObject).getChildren();

          for (CmisObject object : children) {
              if (object instanceof Folder) {
               getAllFilesInPath(object.getId(), filesList);
               } else if (object instanceof Document) {
                                filesList.add(object.getId());
              }
            }
         System.out.println(filesList.get(0));
    }

Output : workspace://SpacesStore/3a2bcd68-aabc-42ed-8229-bf8237aa59b7;1.0

 ItemIterable<ChangeEvent> events = sessionObject.
                              getContentChanges(currentChangeToken, true);
    for (ChangeEvent changeEvent : events) {
    objectId = changeEvent.getObjectId();
    System.out.println(objectId);

Output : 3a2bcd68-aabc-42ed-8229-bf8237aa59b7;1.0

Is there any way to do this.Please help.

Upvotes: 0

Views: 962

Answers (1)

Sachin
Sachin

Reputation: 1715

From the comments posted by Gagravarr I came to know that I'm talking to the wrong alfresco endpoint. I've changed my AtomPub URL parameter to

http://localhost:6080/alfresco/api/-default-/public/cmis/versions/1.1/atom

Now it works fine. I used repository id as -default- obtained by calling getRepositories method first time.

Reference : 1. CMIS REST AtomPub URL reference 2.CMIS Request URL format(On premise)

Thanks to Gagravarr :)

Upvotes: 1

Related Questions