AnsweredAssumed Answered

opencmis getParents only showing primary parent

Question asked by glaenen on Feb 21, 2011
Latest reply on Mar 7, 2011 by glaenen
Hello,

I trying write an application using the alfresco opencmis plugin and when using getParents on a document it only returns the primary parent.
Also because of this the method removeFromFolder doens't work.

example:
AlfrescoDocument alfDoc = (AlfrescoDocument) session.getObjectByPath("/usual-tux.jpg");
      System.out.println(alfDoc.getName());
      System.out.println(alfDoc.getId());
      
      System.out.println("—————");
      List<Folder> parents = alfDoc.getParents();
      for (Folder folder : parents) {
         System.out.println(folder.getName());
         System.out.println(folder.getId());
      }

      System.out.println("—————");
      AlfrescoFolder folder = (AlfrescoFolder) session.getObjectByPath("/cmcdata");
      ItemIterable<CmisObject> childeren = folder.getChildren();
      for (CmisObject cmisObject : childeren) {
         System.out.println(cmisObject.getName());
         System.out.println(cmisObject.getId());
      }

output:
usual-tux.jpg
workspace://SpacesStore/0bcde99a-a6e4-4d23-b834-93648a2b4c4c
—————
Company Home
workspace://SpacesStore/c2d05d8b-d2c5-49be-ad07-f3722cb64e7f
—————
productmaster
workspace://SpacesStore/d78f025f-1e4f-479a-b4ac-89c25d5edec2
usual-tux.jpg
workspace://SpacesStore/0bcde99a-a6e4-4d23-b834-93648a2b4c4c


As you can see asking the document for it's parents only returns Company Home.
But asking an other folder for it's children shows that this document has other parents.
I've added this document to multiple folders using the addToFolder method and the parents are visible in the node browser.

Does anybody know why I'm not able to see all the parents for a document?

Regrads,

Glenn

Outcomes