Home

CMIS Folder.addToFolder(target, true) fails?

You are here

4 posts / 0 new
Last post
CMIS Folder.addToFolder(target, true) fails?

I keep getting an exception thrown when trying to "link" an existing folder to another existing-folder-location (for multiple locations).

The exception says:

org.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException: Object is not a document!
at org.alfresco.opencmis.AlfrescoCmisServiceImpl.addObjectToFolder(AlfrescoCmisServiceImpl.java:2030)

Well, that's correct, the object is a Folder, which also is a FileableCmisObject, so has the addToFolder() method, and is what I'm trying to add to the target folder.

I will re-compile and re-test, but the only thing I can think of is that the error message is incorrect, and the complaint is in the second parameter to the addToFolder method (true = link all versions)? One would think that would be ignored if it's not used for Folder nodes, but maybe that's what the exception is trying to tell me?

Has anyone else tried using this method to link a folder to a second (or more) location in the repository successfully?

Thanks,
AJ

Re: CMIS Folder.addToFolder(target, true) fails?

According to the spec (page 35 of the PDF)...

Quote:
Every folder object, except for one which is called the Root Folder, MUST have one and only one parent folder.

Folder objects are not multi-fileable.

Jeff

Chief Community Officer
Alfresco Software
Blog: ecmarchitect.com | Twitter: jeffpotts01
CMIS APIs: Apache Chemistry | CMIS and Apache Chemistry in Action
Alfresco tutorials: Alfresco Developer Series

Re: CMIS Folder.addToFolder(target, true) fails?

Ah, RTFM, huh? ;)

I take it this is a CMIS limitation, not an Alfresco one?

Thanks,
AJ

Re: CMIS Folder.addToFolder(target, true) fails?

Yes, I believe the underlying Alfresco API supports multi-filing of folders.

Jeff

Chief Community Officer
Alfresco Software
Blog: ecmarchitect.com | Twitter: jeffpotts01
CMIS APIs: Apache Chemistry | CMIS and Apache Chemistry in Action
Alfresco tutorials: Alfresco Developer Series