【问题标题】:How to add aspects/extentions to Alfresco Folder and Documents using DotCMIS?如何使用 DotCMIS 向 Alfresco 文件夹和文档添加方面/扩展?
【发布时间】:2014-10-02 23:48:33
【问题描述】:

我有一个使用 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:foldercmis: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 应用程序。 Alfresco 版本是 4.2.3

【问题讨论】:

  • 我认为 dotcmis 不支持添加方面。
  • 但是我可以获取扩展/方面吗?

标签: c# alfresco opencmis dotcmis


【解决方案1】:

我们验证了 dotCmis

但是,我们成功地测试了中描述的方法 http://mail-archives.apache.org/mod_mbox/chemistry-dev/201202.mbox/%3C2D9094AD2E4FBE4B86B8B274D9DB9E081F7A754BF1@SSWPROD1001.synapps-solutions.com%3E

使用低级 CMIS API 并手动利用 Alfresco CMIS 扩展。

我们还验证了 session.Query("select * from nm:aspectName ") 结果确实包含方面属性。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-12-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-09-07
    • 1970-01-01
    相关资源
    最近更新 更多