cancel
Showing results for 
Search instead for 
Did you mean: 

How to set the title property on folders with CMIS ?

bparis
Champ in-the-making
Champ in-the-making
Hi there;
I use java APi to create folders in alfresco.
Folders are created in alfresco repository but I can't see the title neither the description on the created folders


            Folder destinationFolder = (Folder) session.getObjectByPath("/path/to/parent/folder");
            Map<String, Object>  properties = new HashMap<String, Object>();     
            properties.put(PropertyIds.BASE_TYPE_ID, BaseTypeId.CMIS_FOLDER.value());
            properties.put(PropertyIds.NAME, "folder name");
            properties.put(PropertyIds.OBJECT_TYPE_ID, "cmis:folder,P:cm:titled");           
            properties.put("cm:title", "My empty foldert");
            properties.put("cm:description", "My folder description";
           
            try {
                newFolder = destinationFolder.createFolder(properties);



The description is correctly set if I use
properties.put("cmis:description", "My folder description";


But now way for the title. Any help should be appreciated.
bernard
1 REPLY 1

bparis
Champ in-the-making
Champ in-the-making
the previous code was preceded with this line :
<java>
// set the alfresco object factory
parameter.put(SessionParameter.OBJECT_FACTORY_CLASS, "org.alfresco.cmis.client.impl.AlfrescoObjectFactoryImpl");
</java>

and it seems that was a bad idea.   I have deleted this line and here is the good working code for me:
<java>
            List<Object> aspects = new ArrayList<Object>();
            aspects.add("P:cm:titled");
            Map<String, Object>  properties = new HashMap<String, Object>();     
            properties.put(PropertyIds.BASE_TYPE_ID, BaseTypeId.CMIS_FOLDER.value());
            properties.put(PropertyIds.NAME, folderName);
            properties.put(PropertyIds.OBJECT_TYPE_ID, "cmis:folder");   
            properties.put(PropertyIds.SECONDARY_OBJECT_TYPE_IDS, aspects);
            properties.put("cm:title", folderTitle);
            properties.put("cm:description", folderDescritpion);
</java>

Thanks to Martin Bergljung's book: "Alfresco CMIS"

Bernard