递归获取Alfresco 5.0中某个文件夹下的所有内容文件名(通过WebScripts) [英] Recursively get all content file names under a folder in Alfresco 5.0 (by WebScripts)

查看:104
本文介绍了递归获取Alfresco 5.0中某个文件夹下的所有内容文件名(通过WebScripts)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

到目前为止,我已经找到了向孩子展示脚本:

So far I found the script to show the children:

http://localhost:8080/alfresco/service/slingshot/datalists/lists/site/MyFakeSite/documentLibrary

返回的内容如下:

{
   "container": "workspace:\/\/SpacesStore\/8ef98a58-18f0-4f27-9fee-709f81ca0a65",
   "permissions":
   {
      "create": true
   },
   "datalists":
   [
      {
   "name": "MyPicture.jpg",
   "title": "My Awesome Picture File",
   "description": "Legen - wait for it - dary!!!",
   "nodeRef": "workspace://SpacesStore/54acabf9-bf6b-42f0-8b68-bbe9732b29b8",
   "itemType": "",
   "permissions":
   {
      "edit": true,
      "delete": true
   }
}
,
      {
   "name": "MyFirstLevelFolder",
   "title": "FirstLevel",
   "description": "",
   "nodeRef": "workspace://SpacesStore/181a36df-2892-4669-aac0-d13ff90457bb",
   "itemType": "",
   "permissions":
   {
      "edit": true,
      "delete": true
   }
}

这是下一级子节点的列表。

which is the list of the child nodes of a level down.

有没有办法:


  • 以递归方式显示所有节点?

  • Show ALL nodes recursively ??

次要点:

仅过滤内容对象以获取答案(文件夹循环但不包含
返回)?

Filter only content objects for the answer (folders looped but not returned)?

过滤除元数据以外的所有元数据,这对我来说是唯一重要的事情?

Filter all the metadata but the name, the only important thing to me?

推荐答案

以下是一个可以帮助您的网络脚本示例。

Here is an example of webscript which may help you. Create this webscript in alfresco.

getChildren.get.desc.xml

<webscript>
    <shortname>Get Documents</shortname>
    <description>Display all Documents within Folder</description>
    <url>/getChildren</url>
    <format default="json">argument</format>
    <authentication>user</authentication>
</webscript>

getChildren.get.js

function main()
{
    var node = [];
    var folderName = args["foldername"];
    node = search.luceneSearch("PATH:\"/app:company_home/cm:"+folderName+"/*\"");
    model.totalItems = node.length;
    model.results = node;

} main();

getChildren.get.json.ftl

{
    "totalItems": "${totalItems}",
    "nodes":
    [<#list results as node>
        {
            "name" : "${node.properties["cm:name"]?trim}"
        }<#if (node_index + 1 < results?size)>,</#if>
     </#list>
    ]
}

在浏览器中创建此查询后:

After creating fire this query in browser:

http:// localhost:8080 / alfresco / service / getChildren?foldername = Test_Folder

http://localhost:8080/alfresco/service/getChildren?foldername=Test_Folder

注意:这将仅获取公司主页中文件夹的子项详细信息。根据您的要求更改javascript文件中的lucene查询。

Note: This will fetch child details of folders in company home only. Change lucene query in javascript file according to your requirement.

这篇关于递归获取Alfresco 5.0中某个文件夹下的所有内容文件名(通过WebScripts)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆