使用cmis 1.1为文档设置辅助属性时出现的问题

时间:2017-11-09 14:21:21

标签: alfresco cmis

我正在尝试使用CMIS 1.1以编程方式将辅助属性(标题,描述)添加到Alfresco中的文档。

代码段:

properties.put(PropertyIds.NAME, fileName);
properties.put(PropertyIds.OBJECT_TYPE_ID, "cmis:document,P:cm:titled"); 
properties.put(PropertyIds.SECONDARY_OBJECT_TYPE_IDS, "P:cm:titled");
properties.put("cm:title", "test title");
properties.put("cm:description", "description of document");

代码导致文档成功上传到Alfresco网站,没有任何问题,但Alfresco UI中的标题和描述为空。

我也尝试过将标签设置为文档。露天网站上的标签也是空的。

代码段

document = parentFolder.createDocument(properties, contentStream, null);
AlfrescoDocument alfDoc = (AlfrescoDocument) document;
Map<String, Object> properties1 = new HashMap<String, Object>();
List<String> tags = new ArrayList<String>();
tags.add("cmisTag");
tags.add("testTag");
properties1.put("cm:taggable",tags);
alfDoc.updateProperties(properties1);

1 个答案:

答案 0 :(得分:0)

首先看,我认为你可能是将你的辅助对象类型ID属性设置为单个值而不是数组,但后来我查看了my gist并且我也使用了String一串字符串。

现在我注意到您正在使用AlfrescoDocument,这意味着您正在使用OpenCMIS扩展。如果您使用的是CMIS 1.1,则不要使用OpenCMIS扩展。只需使用没有它的常规OpenCMIS库。使用Document而不是AlfrescoDocument。