如何使用 CMIS 在 Alfresco 中进行批量更新

编程入门 行业动态 更新时间:2024-10-28 16:17:19
本文介绍了如何使用 CMIS 在 Alfresco 中进行批量更新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

是否可以在 alfresco 中使用 CMIS 进行批量更新.

Is it possible to do mass update using CMIS in alfresco.

我有不同的文档类型,并且每个文档类型在 alfresco 存储库中都有多个文档.

I have Different Documents Types and Every Document type is having multiple documents in alfresco repository.

现在我的要求是,如果我要更新任何文档的任何单个属性,那么它应该反映所有相同类型的文档.

Now my requirement is, If i will Update any single property of any document, then it should reflect with all the documents of same type.

我可以使用 CMIS 执行此操作吗?

Can i do this USING CMIS?

如果是,请提供执行此操作的步骤和示例代码.

If yes, please provide the steps and sample code to do this.

提前致谢

推荐答案

困难的方法(和健谈的方法)是查询您的文档,然后设置每个文档的属性.但 CMIS 规范实际上提供了更好的方法:批量更新.

The hard way (and chatty way) is to query for your documents and then set the properties on each one. But the CMIS spec actually provides a better way: Bulk updates.

代码如下:

ArrayList<CmisObject> docList = new ArrayList<CmisObject>(); Document doc1 = (Document) getSession().getObjectByPath("/bulk/bulktest1.txt"); docList.add(doc1); Document doc2 = (Document) getSession().getObjectByPath("/bulk/bulktest2.txt"); docList.add(doc2); Document doc3 = (Document) getSession().getObjectByPath("/bulk/bulktest3.txt"); docList.add(doc3); HashMap<String, Object> props = new HashMap<String, Object>(); props.put("cmis:description", "description set in bulk"); List<BulkUpdateObjectIdAndChangeToken> updatedIds = getSession().bulkUpdateProperties(docList, props, null, null); System.out.println("Updated " + updatedIds.size() + " docs.");

在我的示例中,我按路径抓取每个文档,但当然您也可以运行查询并以这种方式构建您的列表.

In my example I am grabbing each document by path, but of course you could run a query and build your list that way as well.

要在 Alfresco 中使用它,您必须使用 CMIS 1.1 和浏览器绑定,因此请确保您的服务 URL 为 localhost:8080/alfresco/api/-default-/public/cmis/versions/1.1/browser.

To use this with Alfresco you must use CMIS 1.1 and the browser binding so make sure your service URL is localhost:8080/alfresco/api/-default-/public/cmis/versions/1.1/browser.

更多推荐

如何使用 CMIS 在 Alfresco 中进行批量更新

本文发布于:2023-10-23 22:20:23,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1522161.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何使用   批量   CMIS   Alfresco

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!