0

I had a working code using Java using this method for creating document and folders in alfresco using CMIS.

    Folder.createFolder(
        Map<string, ?> properties, 
        List<Policy> policies, List<Ace> addAce, List<Ace> removeAce,
        OperationContext context);        

And I used Folder.createDocument for creating document (they have the same parameter) and used it as follow:

AlfrescoFolder.java

   parentFolder.createFolder(
      AlfrescoUtilities.mapAlfrescoObjectProperties("cmis:folder",
          folderName, title, description, tags), 
      null, null, null, 
      AlfrescoSession.getSession().getDefaultContext()
   );

  // AlfrescoSession.getSession() a custom method that we created to 
  //   create a Session variable



AlfrescoUtilities.java

    public static Map<String, Object> mapAlfrescoObjectProperties(
         String objectType, String name, String title, String description, 
         List<String> tags) 
    {
         Map<String, Object> properties = new HashMap<>();

         properties.put(PropertyIds.OBJECT_TYPE_ID, 
              objectType + ",P:cm:titled,P:cm:taggable");
         properties.put(PropertyIds.NAME, name); 

         if (title != null) properties.put("cm:title", title);
         if (description != null) properties.put("cm:description", description);
         if (tags != null) properties.put("cm:taggable", tags);

         return properties;
    }
}

In the code above, the objectType parameter there will be either cmis:folder or cmis:document and we discovered that to add aspects for adding description is to add P:cm:titled to add description and title and P:cm:taggable to attach tags.

Now, I'm working on a .NET application using C#. When I translated it and used the same methods, the only problem is it is only working when I removed the P:cm:tittled; P:cm:taggable

Here is the current code for creating the properties:

AlfrescoUtilities.cs

    public static Dictionary<string, object> mapAlfrescoObjectProperties(
        string objectType, string name, string title, string description, 
        List<string> tags) 
    {
        Dictionary<string, object> properties = new Dictionary<string, object>();

        properties[PropertyIds.ObjectTypeId] = objectType; 
             // +",P:cm:titled,P:cm:taggable";
        properties[PropertyIds.Name] = name; /*            
        if (title != null) properties["cm:title"] = title;
        if (description != null) properties["cm:description"] = description;
        if (tags != null) properties["cm:taggable"] = tags;
        */
        return properties;
    }

And as you noticed, I commented the other codes.
The only once that work is the objecttypeid (whether cmis:folder or cmis:document)
and the name.


Kindly help me regarding this. This is a windows application using .NET 3.5 and C#. Alfresco Version is 4.2.3

Jin Ginusuke
  • 67
  • 1
  • 1
  • 11

1 Answers1

0

We verified that dotCmis <= 0.6.0 does not support CMIS 1.1 (and thus has no native support for aspect properties).

However, we successfully tested the approach described in http://mail-archives.apache.org/mod_mbox/chemistry-dev/201202.mbox/%3C2D9094AD2E4FBE4B86B8B274D9DB9E081F7A754BF1@SSWPROD1001.synapps-solutions.com%3E

to work with the low-level CMIS API and manually take advantage of Alfresco CMIS extensions.

We also verified that in session.Query("select * from nm:aspectName ") result do contain the aspect properties.