【问题标题】:How to retrieve a content of Alfresco workflow?如何检索 Alfresco 工作流程的内容?
【发布时间】:2015-05-29 14:18:30
【问题描述】:

我有一个包含音频内容的工作流程。我需要在其他应用程序中访问此内容(使用 javascript)。我正在尝试对这个 URL 使用 GET 方法:

http://localhost:8086/alfresco/service/cmis/s/SpacesStore/i/1a7be6f8-0c50-4995-a211-1736642db06a/children?alf_ticket=TICKET_f9906d69befbc49668b92ddf372d62532a29ce7d

(在这个URL中,id“1a7be6f8-0c50-4995-a211-1736642db06a”是工作流任务包的标识。)

但是,响应是下一个 XML:

<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:app="http://www.w3.org/2007/app" xmlns:cmisra="http://docs.oasis-open.org/ns/cmis/restatom/200908/" xmlns:cmis="http://docs.oasis-open.org/ns/cmis/core/200908/" xmlns:alf="http://www.alfresco.org" xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/">
<author><name>admin</name></author>
<generator version="4.2.0 (r56674-b4848)">Alfresco (Community)</generator>
<icon>http://localhost:8086/alfresco/images/logo/AlfrescoLogo16.ico</icon>
<id>urn:uuid:1a7be6f8-0c50-4995-a211-1736642db06a-children</id>
<link rel="service" href="http://localhost:8086/alfresco/service/cmis"/>
<link rel="self" href="http://localhost:8086/alfresco/service/cmis/s/SpacesStore/i/1a7be6f8-0c50-4995-a211-1736642db06a/children?alf_ticket=TICKET_f9906d69befbc49668b92ddf372d62532a29ce7d"/>
<link rel="via" href="http://localhost:8086/alfresco/service/cmis/s/workspace:SpacesStore/i/1a7be6f8-0c50-4995-a211-1736642db06a"/>
<link rel="up" href="http://localhost:8086/alfresco/service/cmis/s/workspace:SpacesStore/i/13dd8d00-4ccd-4894-87fc-0b055cf41a4b/children" type="application/atom+xml;type=feed"/>
<link rel="down" href="http://localhost:8086/alfresco/service/cmis/s/workspace:SpacesStore/i/1a7be6f8-0c50-4995-a211-1736642db06a/descendants" type="application/cmistree+xml"/>
<link rel="http://docs.oasis-open.org/ns/cmis/link/200908/foldertree" href="http://localhost:8086/alfresco/service/cmis/s/workspace:SpacesStore/i/1a7be6f8-0c50-4995-a211-1736642db06a/tree" type="application/atom+xml;type=feed"/>
<title>1a7be6f8-0c50-4995-a211-1736642db06a Children</title>
<updated>2015-05-27T11:18:13.600-04:00</updated>
<opensearch:totalResults>0</opensearch:totalResults>
<opensearch:startIndex>0</opensearch:startIndex>
<opensearch:itemsPerPage>-1</opensearch:itemsPerPage>
<cmisra:numItems>0</cmisra:numItems>
</feed>

我不知道如何将此 XML 用于我的目的。我需要听到内容(mp3 音频文件)并在我的自定义应用程序中修改其属性。

我也在尝试使用下一个 URL (GET):

http://localhost:8086/alfresco/service/api/node/content/workspace/SpacesStore/1a7be6f8-0c50-4995-a211-1736642db06a

但结果是:Web Script Status 404 - Not Found

如何检索工作流的内容?有一些 RESTful URL 吗?

感谢您的帮助。

您好, 巴勃罗。

【问题讨论】:

    标签: javascript alfresco activiti


    【解决方案1】:

    最后,我使用其他 RESTful URL 解决了我的问题。因此,检索工作流内容的步骤如下:

    1.我得到了工作流任务的包 ID(这是一个文件夹节点):

    GET /alfresco/service/api/task-instances/activiti$taskID

    {
       "data": 
          {
             "id": "activiti$taskID",
             "url": "api\/task-instances\/activiti$taskID",
             "name": "wf:taskName",
             "title": "Task for this",
             "description": "Hello World !",
             "state": "IN_PROGRESS",
             "path": "api\/workflow-paths\/activiti$workflowID",
             "isPooled": false,
             "isEditable": true,
             "isReassignable": true,
             "isClaimable": false,
             "isReleasable": false,
             "outcome": null,
             "owner":
             {
                "userName": "admin",
                "firstName": "Admin",
                "lastName": "istrator"
             },
             "properties":
             {
                "bpm_percentComplete": 0,
                "bpm_description": "Hello World !",
                "bpm_hiddenTransitions": [],
                "bpm_package":"workspace:\/\/SpacesStore\/1a7be6f8-0c50-4995-a211-1736642db06a",
           ...........................................................
    }
    

    所以,包ID是:1a7be6f8-0c50-4995-a211-1736642db06a

    2。通过包 ID,我得到了我需要的这个包的内容:

    GET /alfresco/service/slingshot/node/workspace/SpacesStore/1a7be6f8-0c50-4995-a211-1736642db06a

    .............................................    
    "children": [
          {
             "name": {
                "name": "{http:\/\/www.alfresco.org\/model\/content\/1.0}grabacion1.mp3",
                "prefixedName": "cm:grabacion1.mp3"
            },
             "nodeRef": "workspace://SpacesStore/9ed7905d-7017-40e9-9514-93244b0a9a6a",
             "type": {
                "name": "{http:\/\/www.alfresco.org\/model\/content\/1.0}content",
                "prefixedName": "cm:content"
            },
             "assocType": {
                "name": "{http:\/\/www.alfresco.org\/model\/bpm\/1.0}packageContains",
                "prefixedName": "bpm:packageContains"
            },
             "primary": false,
             "index": 0
          }
       ],
    .............................................
    

    所以,内容 ID 是:9ed7905d-7017-40e9-9514-93244b0a9a6a

    3。最后,我得到了我需要的内容:

    GET /alfresco/service/api/node/content/workspace/SpacesStore/9ed7905d-7017-40e9-9514-93244b0a9a6a

    如果您需要访问内容的属性,您可以使用第二步的 URL 和内容 ID(在本例中:9ed7905d-7017-40e9-9514-93244b0a9a6a)。

    你好 :)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多