<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Query taskButtons from Workflow RouteNode in Nuxeo Forum</title>
    <link>https://connect.hyland.com/t5/nuxeo-forum/query-taskbuttons-from-workflow-routenode/m-p/314724#M1725</link>
    <description>&lt;P&gt;The way I use is now working so I can share my experience with you:&lt;/P&gt;
&lt;P&gt;1/ Get the open tasks for my document with automation Context.GetOpenTasks&lt;/P&gt;
&lt;P&gt;2/ for the TaskDocId just retrieved I fetch the document
service.getDocument(new IdRef(taskDocId), true);&lt;/P&gt;
&lt;P&gt;3/ Get the RouteNode declaration&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;get JSON from &lt;A href="http://my.nuxe.server/nuxeo/site/api/v1/id/&amp;quot;" target="test_blank"&gt;http://my.nuxe.server/nuxeo/site/api/v1/id/"&lt;/A&gt;; + taskDocId&lt;/LI&gt;
&lt;LI&gt;extract document.routing.step&lt;/LI&gt;
&lt;LI&gt;get JSON from &lt;A href="http://my.nuxe.server/nuxeo/site/api/v1/id/&amp;quot;" target="test_blank"&gt;http://my.nuxe.server/nuxeo/site/api/v1/id/"&lt;/A&gt;; + routingStepId&lt;/LI&gt;
&lt;LI&gt;extract taskButtons from "properties"&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;this is my getRouteNode function with ugly exception management &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;   public RouteNode getRouteNode(String docId) {
    RouteNode node = null;
    try {
        DefaultSession session = (DefaultSession) getNuxeoClient().getSession();
        DocumentManager service = session.getAdapter(DocumentManager.class);
        String json = GET("http://my.nuxeo.server/nuxeo/site/api/v1/id/" + docId, session);

        JSONObject x = new JSONObject(json);
        try {
            JSONObject properties = x.getJSONObject("properties");
            JSONArray array = properties.getJSONArray("nt:task_variables");
            String routeNodeId = null;
            for (int i = 0; i &amp;lt; array.length(); i++) {
                JSONObject object = array.getJSONObject(i);
                if ("document.routing.step".equals(object.getString("key"))) {
                    routeNodeId = object.getString("value");
                    break;
                }

            }
            if (routeNodeId != null) {
                String routeNodeString = GET("http://my.nuxeo.server/nuxeo/site/api/v1/id/" + routeNodeId,
                        session);
                JSONObject routeNodeJson = new JSONObject(routeNodeString);
                JSONObject nodeProperties = routeNodeJson.getJSONObject("properties");
                
                Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ").create();
                node = gson.fromJson(nodeProperties.toString(), RouteNode.class);

            }
        } catch (Exception e) {
            Log.e(TAG, e.getMessage(), e);
        }
        ;
       
    } catch (Exception e) {
        e.printStackTrace();
    }
    return node;
}
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 18 Mar 2015 19:31:05 GMT</pubDate>
    <dc:creator>Artmoni_Mobile</dc:creator>
    <dc:date>2015-03-18T19:31:05Z</dc:date>
    <item>
      <title>Query taskButtons from Workflow RouteNode</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/query-taskbuttons-from-workflow-routenode/m-p/314723#M1724</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I've created a simple Workflow with a Node and two buttons (accept/reject).
I try to request my node information specifically the availables buttons from a query automation but thoses params don't appear.&lt;/P&gt;
&lt;P&gt;The NXQL query is "&lt;STRONG&gt;Select * from RouteNode  where rnode:nodeId = 'Task7a0' and ecm:currentLifeCycleState = 'suspended'&lt;/STRONG&gt;"&lt;/P&gt;
&lt;P&gt;The result from nxshell is the one below with properties task:Buttons available&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt; RouteNode -- Validation
    UID: b4243650-33f7-4de8-88fa-fe67145a84c0
    Path: /document-route-instances-root/2015/01/13/validation/Task7a0
    Type: RouteNode
    State: suspended
    Lock: none

DESCRIPTION
    Thank you for validating the document

PROPERTIES
    dc:contributors = []
    [...]
    rnode:taskAssigneesPermission = ReadWrite
    rnode:taskButtons = [name=reject label=reject filter= , name=validate label=validate filter= ]**
    rnode:taskDirective = Have a look and moderate this document
    [...]
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I would like to get this rnode:taskButtons parameter in my automation request but only simple parameters are returns while taskButton is a list.&lt;/P&gt;
&lt;P&gt;Is there a way to get these variables back?&lt;/P&gt;
&lt;P&gt;Thanks in advance&lt;/P&gt;</description>
      <pubDate>Wed, 14 Jan 2015 01:32:55 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/query-taskbuttons-from-workflow-routenode/m-p/314723#M1724</guid>
      <dc:creator>Artmoni_Mobile</dc:creator>
      <dc:date>2015-01-14T01:32:55Z</dc:date>
    </item>
    <item>
      <title>Re: Query taskButtons from Workflow RouteNode</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/query-taskbuttons-from-workflow-routenode/m-p/314724#M1725</link>
      <description>&lt;P&gt;The way I use is now working so I can share my experience with you:&lt;/P&gt;
&lt;P&gt;1/ Get the open tasks for my document with automation Context.GetOpenTasks&lt;/P&gt;
&lt;P&gt;2/ for the TaskDocId just retrieved I fetch the document
service.getDocument(new IdRef(taskDocId), true);&lt;/P&gt;
&lt;P&gt;3/ Get the RouteNode declaration&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;get JSON from &lt;A href="http://my.nuxe.server/nuxeo/site/api/v1/id/&amp;quot;" target="test_blank"&gt;http://my.nuxe.server/nuxeo/site/api/v1/id/"&lt;/A&gt;; + taskDocId&lt;/LI&gt;
&lt;LI&gt;extract document.routing.step&lt;/LI&gt;
&lt;LI&gt;get JSON from &lt;A href="http://my.nuxe.server/nuxeo/site/api/v1/id/&amp;quot;" target="test_blank"&gt;http://my.nuxe.server/nuxeo/site/api/v1/id/"&lt;/A&gt;; + routingStepId&lt;/LI&gt;
&lt;LI&gt;extract taskButtons from "properties"&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;this is my getRouteNode function with ugly exception management &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;   public RouteNode getRouteNode(String docId) {
    RouteNode node = null;
    try {
        DefaultSession session = (DefaultSession) getNuxeoClient().getSession();
        DocumentManager service = session.getAdapter(DocumentManager.class);
        String json = GET("http://my.nuxeo.server/nuxeo/site/api/v1/id/" + docId, session);

        JSONObject x = new JSONObject(json);
        try {
            JSONObject properties = x.getJSONObject("properties");
            JSONArray array = properties.getJSONArray("nt:task_variables");
            String routeNodeId = null;
            for (int i = 0; i &amp;lt; array.length(); i++) {
                JSONObject object = array.getJSONObject(i);
                if ("document.routing.step".equals(object.getString("key"))) {
                    routeNodeId = object.getString("value");
                    break;
                }

            }
            if (routeNodeId != null) {
                String routeNodeString = GET("http://my.nuxeo.server/nuxeo/site/api/v1/id/" + routeNodeId,
                        session);
                JSONObject routeNodeJson = new JSONObject(routeNodeString);
                JSONObject nodeProperties = routeNodeJson.getJSONObject("properties");
                
                Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ").create();
                node = gson.fromJson(nodeProperties.toString(), RouteNode.class);

            }
        } catch (Exception e) {
            Log.e(TAG, e.getMessage(), e);
        }
        ;
       
    } catch (Exception e) {
        e.printStackTrace();
    }
    return node;
}
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 18 Mar 2015 19:31:05 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/query-taskbuttons-from-workflow-routenode/m-p/314724#M1725</guid>
      <dc:creator>Artmoni_Mobile</dc:creator>
      <dc:date>2015-03-18T19:31:05Z</dc:date>
    </item>
  </channel>
</rss>

