0

我有一个使用 Java 的工作代码,使用这种方法在露天使用 CMIS 创建文档和文件夹。

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

我使用 Folder.createDocument 来创建文档(它们具有相同的参数)并按如下方式使用它:

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;
    }
}

在上面的代码中,objectType 参数会有cmis:folderor cmis:document,我们发现添加方面添加描述就是添加P:cm:titled添加描述和标题并P:cm:taggable附加标签。

现在,我正在使用 C# 开发一个 .NET 应用程序。当我翻译它并使用相同的方法时,唯一的问题是它只有在我删除时才有效P:cm:tittled; P:cm:taggable

这是创建属性的当前代码:

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;
    }

正如你所注意到的,我评论了其他代码。
唯一的工作是objecttypeid(无论是 cmis:folder 还是 cmis:document)
和名称。


请帮助我解决这个问题。这是一个使用 .NET 3.5 和 C# 的 Windows 应用程序。露天版本是 4.2.3

4

1 回答 1

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.

于 2014-10-02T15:48:33.470 回答