-
1. Re: task data returns null after getTaskById
swiderski.maciej Jun 24, 2014 1:41 AM (in response to jmiguel77)that indeed should work. What version to you use? Do you mind attaching complete client code used for this operation so it gets validated?
HTH
-
2. Re: Re: task data returns null after getTaskById
jmiguel77 Jun 24, 2014 10:35 AM (in response to swiderski.maciej)Hi Maciej
Thanks for your answer; i have installed the bpms with the jboss-bpms-installer-6.0.1.GA-redhat-4.jar installer
I am attaching both the jar with the bpmn file that contains the process definition (bpm-listas-negras.zip) and the client application (mupi-listas-negras.zip).
In the client application there is a class (com.ec.mutualistapichincha.listasnegras.process.GestorProcesosBpms) that uses the remote api to interact with the process.
There is also a junit test (com.ec.mutualistapichincha.test.TasksTest)
Thanks
-
bpm-listas-negras.zip 41.0 KB
-
mupi-listasnegras.zip 5.7 MB
-
-
3. Re: task data returns null after getTaskById
swiderski.maciej Jun 25, 2014 3:21 AM (in response to jmiguel77)thanks for detailed information, I'll try to look into it today and get back to you
-
4. Re: Re: Re: task data returns null after getTaskById
swiderski.maciej Jun 26, 2014 1:44 PM (in response to jmiguel77)alright, bit delayed but finally made the test of it. It all works well, though I used your process but created simple test case instead of using your client code:
RemoteRestRuntimeFactory factory = new RemoteRestRuntimeFactory( "org.jbpm:test:1.0", new URL("http://localhost:8080/kie-wb"), "user", "password" ); RemoteRuntimeEngine runtimeEngine = factory.newRuntimeEngine(); processVariables.put("identificacion", "1"); processVariables.put("nombres", "2"); processVariables.put("tipoIdentificacion", "3"); processVariables.put("apellidos", "4"); processVariables.put("basesAfectadas", "5"); ProcessInstance processInstance = kieSession.startProcess("ListasNegras.ExcepcionListasNegras", processVariables); System.out.println("Process isntance started = " + processInstance.getId()); List<Long> tasks = runtimeEngine.getTaskService().getTasksByProcessInstanceId(processInstance.getId()); System.out.println("Found tasks " + tasks); Task task = runtimeEngine.getTaskService().getTaskById(tasks.get(0)); assertNotNull(task); assertNotNull(task.getTaskData()); assertNotNull(task.getTaskData().getDocumentContentId()); KieSession kieSession = runtimeEngine.getKieSession(); Map<String, Object> processVariables = new HashMap<String, Object>();
Although I tried not on exact 6.0.1.GA but more updated one that will become 6.0.2 so there is a chance it was a bug but was already fixed.
HTH
-
5. Re: Re: Re: task data returns null after getTaskById
jmiguel77 Jun 26, 2014 4:56 PM (in response to swiderski.maciej)hi Maciej
Thanks for your time and effort; unfortunately i cannot wait until 6.0.2.GA is released right now;
What i did is to get the task data via the REST endpoint directly (using http client)
If somebody else faces this same error i can provide some code
Cheers
-
6. Re: task data returns null after getTaskById
jmiguel77 Jul 21, 2014 10:06 PM (in response to swiderski.maciej)Hi Maciej
I am trying this with the bpms 6.0.2 installation (jboss-bpms-installer-6.0.2.GA-redhat-5.jar) and this is what i've found:
- i can retrieve the variables associated to a task in the way described originally in this post, but only if i use the 6.1.0.CR2 version of kie-services-client, with the latest stable version (6.0.1.Final) it wont work
- But i also found that this piece of code
List<TaskSummary> tasks = service.getTasksAssignedAsPotentialOwner(usuario, "en-UK");
does not work with that version of the kie-services-client. So, now i cannot retrieve the possible tasks for a user - I also found that the format of this rest call http://localhost:8080/business-central/rest/task/4/content has changed. Now it retrieves me a serializedContent that i don't know how to translate, can you give a hint ??
thanks a lot
-
7. Re: task data returns null after getTaskById
swiderski.maciej Jul 22, 2014 1:54 AM (in response to jmiguel77)1 of 1 people found this helpfulbest would be to actually rely on getTaskContent method in 6.0.2 that removes the burden of marshaling/unmarshaling task variables from the user, you'll get direct object instances in a map.
When it comes to the client version, best is to stick to exact same version of server side and client side to gain best support of features.
Serialized content is Base64 bytes of a given content but when using getTaskContent you should not have that problem any more.
HTH
-
8. Re: task data returns null after getTaskById
jmiguel77 Jul 24, 2014 1:38 PM (in response to swiderski.maciej)Thanks Maciej, with the BASE64Decoder i could get the variables correctly
Its true that using the same version of client / server avoids most of the headaches; but i have found that using the rest api directly gives me a better performance
Cheers