简体   繁体   English

Alfresco使用CMIS获取文档路径

[英]Alfresco get the path of documents using CMIS


I'm trying to fetch document objects from Alfresco Community edition,I need the documents path, while i use 我正在尝试从Alfresco社区版中获取文档对象,我需要使用文档路径

SELECT * FROM cmis:document where ''

but i thing the cmis:document namespace doesn't return the path, i was wondering if there is a way to include the path. 但是我的东西cmis:document命名空间不返回路径,我想知道是否有一种方法可以包括该路径。
PS : i can only use JAVASCRIPT with cmis queries PS:我只能将JAVASCRIPT与cmis查询一起使用

Instead of a CMIS query you should just fetch the object by URL using its object ID, then grab the path. 代替CMIS查询,您应该只使用对象的ID通过URL获取对象,然后获取路径。 The browser binding, which is easily invocable from JavaScript, supports this. 浏览器绑定很容易从JavaScript中调用,它支持此功能。

For example, suppose I have a file named "test-1.txt" sitting in a folder called "/test" with an Alfresco object ID of: 例如,假设我有一个名为“ test-1.txt”的文件位于一个名为“ / test”的文件夹中,其Alfresco对象ID为:

workspace://SpacesStore/1fb2d9cf-11ca-47c2-94b4-cf72de8f9b92

I can use this URL: 我可以使用以下网址:

http://localhost:8080/alfresco/api/-default-/public/cmis/versions/1.1/browser/root?objectId=workspace://SpacesStore/1fb2d9cf-11ca-47c2-94b4-cf72de8f9b92&cmisselector=parents&includerelativepathsegment=true

To return JSON that includes: 要返回包含以下内容的JSON:

{
    "id": "cmis:path",
    "localName": "path",
    "displayName": "Path",
    "queryName": "cmis:path",
    "type": "string",
    "cardinality": "single",
    "value": "\/test"
}

Which contains the path. 其中包含路径。

You can shorten up the JSON significantly by also adding "&succinct=true" 您还可以通过添加“&succinct = true”大大缩短JSON

Another option would be to write your own Javascript backed web script. 另一种选择是编写自己的Javascript支持的Web脚本。 It's controller would find the node using CMIS query, and it's FTL would actually display the path in any format you like. 它的控制器将使用CMIS查询找到该节点,而FTL实际上将以您喜欢的任何格式显示路径。

https://community.alfresco.com/docs/DOC-6243-50-javascript-api http://docs.alfresco.com/5.0/references/API-JS-ScriptNode.html https://community.alfresco.com/docs/DOC-6243-50-javascript-api http://docs.alfresco.com/5.0/references/API-JS-ScriptNode.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM