incubator-chemistry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ugo Cei <>
Subject Creating a folder
Date Mon, 10 May 2010 15:08:13 GMT

I am trying to write some code that creates a folder using OpenCMIS (AtomPub binding, in case
this is relevant) and here is the code that I came up with:

        Folder root = session.getRootFolder();
        ObjectId parentId = session.createObjectId(root.getId());
	Map<String, Object> properties = new HashMap<String, Object>();
	properties.put(PropertyIds.OBJECT_TYPE_ID, BaseTypeId.CMIS_FOLDER.value());
        String name = "New Folder (" + System.currentTimeMillis() + ")";
	properties.put(PropertyIds.NAME, name);
	List<Ace> addAces = new LinkedList<Ace>();
	List<Ace> removeAces = new LinkedList<Ace>();
	List<Policy> policies = new LinkedList<Policy>();
	session.createFolder(properties, parentId, policies, addAces, removeAces);

However, this code throws the following exception:

Exception in thread "main" org.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException:
Property cmis:objectTypeId must be set!
	at org.apache.chemistry.opencmis.client.bindings.spi.atompub.ObjectServiceImpl.checkCreateProperties(
	at org.apache.chemistry.opencmis.client.bindings.spi.atompub.ObjectServiceImpl.createFolder(
	at org.apache.chemistry.opencmis.client.runtime.PersistentSessionImpl.createFolder(

Apparently, it is complaining about the missing cmis:objectTypeId, which I did put in the
properties. It looks like, however, that the property does not survive the conversion performed

                objectFactory.convertProperties(properties, null, CREATE_UPDATABILITY),

(line 790 of Is this the right way to go about creating a folder
or am I missing something?


Ugo Cei
Sourcesense - making sense of Open Source:

View raw message