Search code examples
alfrescocmisopencmis

How to create custom content type in ECM / alfresco using CMIS?


CMIS 1.1 allows us to create custom document type. I have tried with [https://chemistry.apache.org/java/examples/example-create-type.html]session.createType(). But I am not able figured out. Is there any other tutorial or example code to create type in Alfresco using CMIS 1.1


Solution

  • I think this is a good example to create a custom type: http://ecmarchitect.com/alfresco-developer-series-tutorials/content/tutorial/tutorial.html#creating-content-with-opencmis

    I guess you haven't really read the tutorials.

    -- UPDATE --

    I guess it isn't clearly written in the tutorial. So basically there are 2 major types in CMIS:

    • Document Types which inherit their properties from cmis:document
    • Folder Types which inherit their properties from cmis:folder

    So let's say our model is called cntz as prefix and our inherited cm:content type is called cntz:document and the folder equivalent is called cntz:folder

    Document Types are written in this case "D:cntz:document" Folder Types are written in this case "F:cntz:folder"

    So your CMIS code will look like the following:

    Map<String, Object> properties = new HashMap<String, Object>();
    properties.put(PropertyIds.OBJECT_TYPE_ID, "F:cntz:folder");
    properties.put(PropertyIds.NAME, "Chackde");
    Folder folder = session.getRootFolder().createFolder(properties);