Hi Ugo,

I have seen that before.
Are you using an Alfresco server? There is a bug that has been fixed in 
Alfresco 3.3g.


Cheers,

Florian

-----Original Message-----
From: Ugo Cei [mailto:[email protected]] 
Sent: Montag, 10. Mai 2010 17:08
To: [email protected]
Subject: Creating a folder

Hi,

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(ObjectServiceImpl.java:745)
        at 
org.apache.chemistry.opencmis.client.bindings.spi.atompub.ObjectServiceImpl.createFolder(ObjectServiceImpl.java:167)
        at 
org.apache.chemistry.opencmis.client.runtime.PersistentSessionImpl.createFolder(PersistentSessionImpl.java:789)

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 by:

                objectFactory.convertProperties(properties, null, 
CREATE_UPDATABILITY),

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

        Ugo


-- 
Ugo Cei
Sourcesense - making sense of Open Source: http://www.sourcesense.com

Reply via email to