gpt4 book ai didi

java - 如何在 Alfresco 社区中设置标题和描述?

转载 作者:塔克拉玛干 更新时间:2023-11-02 07:49:25 26 4
gpt4 key购买 nike

我有一个存储库,通过 alfresco 网站,我可以在存储库中创建文件夹时设置名称、标题和描述。

但是,如果我尝试通过 opencmis java 创建相同的内容,我会收到错误消息“属性‘cmis:title’对此类型或其中一种辅助类型无效!”

这是我的代码:

Map<String, String> newFolderProps = new HashMap<String, String>();
newFolderProps.put(PropertyIds.NAME, "this is my new folder");
newFolderProps.put("cmis:description", "this is my description"); //this doesn't work.
newFolderProps.put("cmis:title", "this is my title"); //this doesn't work.

//I also tried this too:

newFolderProps.put(PropertyIds.DESCRIPTION, "this is my description"); //this doesn't work either.
newFolderProps.put(PropertyIds.OBJECT_TYPE_ID, "cmis:folder"); //this works!
Folder newFolderObject=rootfolder.createFolder(newFolderProps);

我也试过“cm:description”,但这也不起作用。

在 Alfresco 中创建新文件夹时如何设置标题和描述?

最佳答案

这两个特定属性在称为 cm:titled 的方面中定义。 CMIS 本身不支持方面。为了使用方面和方面中定义的属性,您必须使用 Alfresco OpenCMIS Extension .

我创建了一个 gist这是一个你可以编译和运行的工作类,它将创建一个文件夹(如果它不存在),设置描述和标题,然后在该文件夹中创建一个文档并在其上设置描述和标题。

关键位是使用 Alfresco 对象工厂建立 session 的地方:

parameter.put(SessionParameter.OBJECT_FACTORY_CLASS, "org.alfresco.cmis.client.impl.AlfrescoObjectFactoryImpl");

然后当你指定类型的时候,你还必须指定方面:

properties.put(PropertyIds.OBJECT_TYPE_ID, "cmis:folder, P:cm:titled");

其余的属性与您拥有的一样,但要注意属性名称 cm:description 和 cm:title:

properties.put(PropertyIds.NAME, folderName);
properties.put("cm:description", TEST_DESCRIPTION);
properties.put("cm:title", TEST_TITLE);

关于java - 如何在 Alfresco 社区中设置标题和描述?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17890858/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com