Search code examples
apacherepositorycmis

Property cmis:parentId is only defined for folders


I'm writing a CMIS interface for my application. This interface returns a cmis:document object as a child of a cmis:folder object. Here is a part of xml output.

The cmis:document object has a cmis:parentId property. Now I'd like to validate the cmis:document object with the Apache Chemistry Workbench. The workbench tool tells me:

Property cmis:parentId is only defined for folders.

Why is this property not allowed for a document? How can a document reference its parent?


Solution

  • The property cmis:parentId is not defined for cmis:document objects because a document can have none, one or multiple parents.

    To get the parents of a document you have to call getObjectParents().

    You can, of course, deliver the parent id(s) in another property that doesn't use the reserved namespace cmis:, but that would be repository specific and generic CMIS clients would ignore it.