01-13-2015 08:32 PM
Hi,
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.
The NXQL query is "Select * from RouteNode where rnode:nodeId = 'Task7a0' and ecm:currentLifeCycleState = 'suspended'"
The result from nxshell is the one below with properties task:Buttons available
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
[...]
I would like to get this rnode:taskButtons parameter in my automation request but only simple parameters are returns while taskButton is a list.
Is there a way to get these variables back?
Thanks in advance
03-18-2015 03:31 PM
The way I use is now working so I can share my experience with you:
1/ Get the open tasks for my document with automation Context.GetOpenTasks
2/ for the TaskDocId just retrieved I fetch the document service.getDocument(new IdRef(taskDocId), true);
3/ Get the RouteNode declaration
this is my getRouteNode function with ugly exception management 😞
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 < 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;
}
03-18-2015 03:31 PM
The way I use is now working so I can share my experience with you:
1/ Get the open tasks for my document with automation Context.GetOpenTasks
2/ for the TaskDocId just retrieved I fetch the document service.getDocument(new IdRef(taskDocId), true);
3/ Get the RouteNode declaration
this is my getRouteNode function with ugly exception management 😞
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 < 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;
}
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.