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

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

是否可以在露天使用CMIS进行批量更新。

Is it possible to do mass update using CMIS in 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是 HTTP://本地主机:8080 /露天/ API / - 默认/公共/ CMIS /版本/ 1.1 /浏览器。

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

发布评论

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

>www.elefans.com

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