Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
CSTask().getWorkflow() not working as expected
Bowker
Java 1.6
TS 7.2.1
CSSDK 3.1 (? [whatever comes with TS 7.2.1])
So migrating from CSSDK 2.5 to 3.1 has, for the most part been pretty painless - except this (so far.)
I retrieve a list of tasks using the query:
csClient.getWorkflowEngine().getTasksByQuery("");
As expected I get back my two tasks in a CSTask array.
I can loop through the array of tasks and see every the name, description, even the Job Id comes back correctly. BUT when I try to get the actual CSWorkflow object back it comes back with an uninitialized object. All the fields are blank/null.
No errors/exceptions thrown. It's like I don't have permissions to see my own job information.
Any Clues/Guesses would be appreciated.
Upon further investigation - The engineers at Autonomy/Interwoven changed the interface in such a way that everything "works great, but you get no data". No error, no null pointers nothing the old parameters work just fine, but you get different content back. THIS IS VERY VERY UNFRIENDLY CHANGE.
CSTask tasks[] = getUserTasks(csClient);
System.out.println("found " + tasks.length);
for (CSTask csTask : tasks) {
System.out.println("");
System.out.println("csTask.getId: " + csTask.getId());
System.out.println("csTask.getWorkflowId: " + csTask.getWorkflowId());
System.out.println("csTask.getWorkflow().getName(): " + csTask.getWorkflow().getName());
CSWorkflow csWorkflow = csClient.getWorkflow(csTask.getWorkflowId(),true);
System.out.println("csWorkflow.getName(): " + csWorkflow.getName());
}
The resulting output:
found 2
csTask.getId: 682
csTask.getWorkflowId: 680
csTask.getWorkflow().getName():
csWorkflow.getName(): ECMS Workflow
csTask.getId: 770
csTask.getWorkflowId: 768
csTask.getWorkflow().getName():
csWorkflow.getName(): ECMS Workflow
Notice that csTask.getWorkflow() does not supply a name with getName().
More:
If you call csTask.getWorkflow().toString() you get:
Exception in thread "main" java.lang.NumberFormatException: For input string: ""
at java.lang.NumberFormatException.forInputString(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at java.lang.Integer.(Unknown Source)
at com.interwoven.cssdk.workflow.pvt.CSTaskQueryResult.getWorkflowParentTaskId(CSTaskQueryResult.java:583)
at com.interwoven.cssdk.workflow.impl.CSWorkflowImpl.toString(CSWorkflowImpl.java:500)
If you call csWorkflow.toString() you get:
---
com.interwoven.cssdk.workflow.impl.CSWorkflowImpl{
Id=680
ActivationDate=Wed Apr 20 13:29:33 CDT 2011
Creator=myid
Description=test1
Name=ECMS Workflow
Owner=myid
Active=true
ParentTaskId=0
}
---
Find more posts tagged with
Comments
Rick Poulin
It's a performance optimization thing. Basically, if you obtain the workflow object from the task via task.getWorkflow(), the internal query only gets a few properties. If you're going to do anything bigger with it, you're best off doing csclient.getWorkflow(task.getWorkflowId()) and then you get the full object. It's been that way since at least 6.7.2 I believe.
Bowker
That's what I found.
Actually what really honked me off was the change to the XML text parameter to return different information. They could have added a different call or a hundred different options to prevent rework on production code for an upgrade. Not only that, but add getdata='t' still didn't get all the data that was returned originally. (Variable data was not returned)
That's a full day of my life I'll never get back because someone changed something that didn't need to be changed or were to lazy to make it backwards compatible.