如何使用 CMIS 删除文档

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

我已经使用连接到 alfresco 存储库的 Servlet 创建了一个外部 Web 应用程序.

I have Created a External web application using Servlets which is connected to alfresco repository.

我还可以将文档上传到存储库,从存储库下载文档.

I am also able to upload document in to the repository, download document from repository.

现在我的要求是,我必须根据用户角色删除文档.意味着我只想将删除文档的访问权限授予站点管理员.

now my requirement is, i have to delete document based on user role. means i want to give delete document access to only site manager.

如果有,请提供示例代码.

Please provide sample code if you have.

提前致谢

推荐答案

要删除文档,首先需要查看用户是否具有删除角色,这就是为什么答案将分为两部分

In order to delete a document you first need to see if the user have the role to delete this is why the answer will be split in two part

第 1 部分:搜索权威

这部分你会看到用户是否有删除权限

in this part you will see if the user have the authority to delete

Session session = getSession(serverUrl, username, password); // Get the session object = session.getObjectByPath(idObject); // get the object if (object.getAllowableActions().getAllowableActions().contains(Action.CAN_DELETE_OBJECT)) { //// You can delete } else { //// You can't delete System.out.println("I can't "); }

第 2 部分:删除方法

对于一个文档,删除它很简单

for a document it is simple to delete it

Session session = getSession(serverUrl, username, password); CmisObject object = session.getObject(path); Document suppDoc = (Document) object; suppDoc.delete(true);

注意一个文件夹是不同的,但是只有第2部分会改变(因为当你删除一个文件夹时,你需要删除他孩子的)

Note that it's different for a folder , but only the part 2 will be changed ( because when you delete a folder you need to delete his child's)

要完成此答案,您只需要将第 1 部分与第 2 部分结合起来即可.

to complete this answer you only need to combine part 1 with part 2.

更多推荐

如何使用 CMIS 删除文档

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

发布评论

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

>www.elefans.com

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