AnsweredAssumed Answered

Custom properties not set via CMIS createDocument

Question asked by vvstraet on Aug 28, 2012
Latest reply on Mar 8, 2013 by stevegreenbaum
I've noticed a couple of threads on this behavior, but I have yet to find a working solution. So here goes another try …

The requirements:
I need to use the CMIS webservices (URL: http://localhost:8080/alfresco/cmis) in order to update content in a repository.
Furthermore, a custom aspect has to be set upon creation which will then be used in searches in the repository.

The problem:
I can successfully create the document and the aspect is added, but the associated properties (which are also included in the request) are "null" after the operation. The document is also not retrieved when using the custom properties in searches. When manually updating the properties in Alfresco Share, the documents are successfully found when searching on the custom properties.

The environment:
Alfresco 4.0e CE on Windows 7 64-bit; 
apache-chemistry-opencmis-client 0.7.0 & alfresco-opencmis-extension 0.3

The custom model:
<?xml version="1.0" encoding="UTF-8"?>
<model name="dm:demoModel" xmlns="">
<!– File goes in shared/classes/alfresco/extension –>
    <!– Imports are required to allow references to definitions in other models –>
        <!– Import Alfresco Dictionary Definitions –>
        <import uri="" prefix="d" />
        <!– Import Alfresco Content Domain Model Definitions –>
        <import uri=""  prefix="cm" />
        <!– Import Alfresco Content Domain Model Definitions –>
        <import uri="" prefix="sys" />
        <import uri="" prefix="dl" />

    <!– Sites Namespace –>
        <namespace uri="" prefix="dm" />

   <!– Custom aspects –>
        <aspect name="dm:dossier">
                <property name="dm:dossiertype">
                <property name="dm:dossiernummer">

A print of the properties that are sent to the CMIS client (with Alfresco extension):
{dm:dossiernummer=54321, cmis:objectTypeId=cmis:document,P:dm:dossier, cmis:name=test4.txt, dm:dossiertype=AB}

The code for setting these properties:
Map<String, Object> cmisProperties = new HashMap<String, Object>();

      String documentType = null;
      String aspectType = null;
      for( DMSObjectEigenschap eigenschap : eigenschappen ) {
         if( eigenschap.getEigenschap().equals(EigenschapType.DOCUMENT_TYPE) ) {
            documentType = "D:" + eigenschap.getWaarde();
         } else if( eigenschap.getEigenschap().equals(EigenschapType.DOSSIER_TYPE) ) {
            aspectType ="P:dm:dossier";
            cmisProperties.put("dm:dossiertype", eigenschap.getWaarde());
         } else if( eigenschap.getEigenschap().equals(EigenschapType.DOSSIER_NUMMER) ) {
            cmisProperties.put("dm:dossiernummer", eigenschap.getWaarde());

            (documentType == null ? CMISConstants.CMIS_BASETYPE_DOC : documentType)
            + (aspectType == null ? "" : "," + aspectType));
      cmisProperties.put(PropertyIds.NAME, naam);

The code for the "createDocument" call itself:
ContentStream contentStream = …
            Document newDoc = ((Folder) destinationFolder)
                  .createDocument(cmisProperties, contentStream, VersioningState.MAJOR);

The problem is that I cannot find any exceptions in any logging, the call is successfully performed but the properties are NOT set.
Any thoughts?