-
1. Re: how to a Human Task by using the kie API
arif.mohammed Apr 19, 2014 1:40 PM (in response to cescobar)What do you mean by rejecting, can you be more specific ? You can go through the API documentation for org.kie.api.task.TaskService and see which methods you can use.Along with that you can go through the task life cycle diagram(see attachment). I believe you might need fail/exit methods and for that you need to have taskId and userId. Following is the code fragment to get the TaskService object
RuntimeEngine engine = runtimeManager.getRuntimeEngine(ProcessInstanceIdContext.get(processInstanceId)); //In case if you are using session per process instance strategy.Where processInstanceId is the id //associated to process for this task and runtimeManager depends on how you configure jBPM in your environment.
TaskService localTaskService = engine.getTaskService();
localTaskService.fail(taskId,userId,null);
-
HTLifeCycle.PNG 82.2 KB
-
-
2. Re: how to a Human Task by using the kie API
cescobar Apr 19, 2014 5:50 PM (in response to arif.mohammed)Hi Arif,
Thanks for you soon respond.
I actually need a method to revoke the current task to previous state. The fail method does that? Or there is another method to do it?
-
3. Re: how to a Human Task by using the kie API
arif.mohammed Apr 19, 2014 7:58 PM (in response to cescobar)Hi Carlos,
I dont think so you can goto previous state in human task as per the task life cycle. But I will leave it to experts to provide advice.
-
4. Re: how to a Human Task by using the kie API
cescobar Apr 19, 2014 10:39 PM (in response to arif.mohammed)Hmmm... But How can I revoke a task? what would be the method from taskService?
-
5. Re: how to a Human Task by using the kie API
calca Apr 20, 2014 10:04 PM (in response to cescobar)mmm what do you mean by go back to a previous state? could you please give an example of what you are trying to achieve?
You can release a task that is assigned to someone, which will go back to reserved state (this is the human task life cycle http://dcalca.files.wordpress.com/2011/05/screenshot-11.png?w=645&h=438). But I am not sure what you are trying to achieve..
Demian
-
6. Re: how to a Human Task by using the kie API
cescobar Apr 20, 2014 11:45 PM (in response to calca)Hi Demian,
I wan to achieve the following, for example:
1. Task A assigneed to Carlos with status "Ready". When Carlos completes it, this task automatically is assigneed to the following actor (Mary)
2. Now Task B assigneed to Mary with status "Ready", in this case I want to return or revoke or reject this task to Carlos again, due to the task does not accomplish with some criterials.
3. When Carlos logs in, its task list will show the task again with status Ready, which was completed before.
-
7. Re: how to a Human Task by using the kie API
lakshjee Apr 22, 2014 1:06 AM (in response to cescobar)Hi Carols,
I think this will be useful..
1. first you need to add "Database Exclusive Gateway" in between start node and Task A.
2. Then you need to again add "Database Exclusive Gateway" in between Task B and End node.
3. The gateway which connect to end node should be connect to first gateway which is connected to Task A.
4. All gateways should have three directions connectivities.
5. The add following scripts to the second gateways if it is completed then go to end ("return KieFunctions.isTrue(TaskA.getApproval())==true;") (please note that this is an example and you have to create TaskA and .Approval in the data modeler.
6. if it is rejected then add this script to the directions of the second gateway which is connected to first gateway ("return KieFunctions.isTrue(TaskA.getApproval())==false;")
-
8. Re: how to a Human Task by using the kie API
cescobar Apr 22, 2014 1:43 AM (in response to lakshjee)Thanks so much
Jeewani Lakshani
I will try this.. that makes sense for me
-
9. Re: how to a Human Task by using the kie API
arif.mohammed Apr 22, 2014 2:31 AM (in response to cescobar)But keep in mind if the out come of task B is negative(in your case rejecting) it will complete the instance of Task B and will create a new instance of Task A in DB. You can not change the state of Task B instance nor Task A instance to previous state. Hope you understood that.
-
10. Re: how to a Human Task by using the kie API
cescobar May 8, 2014 1:18 AM (in response to cescobar)Hi everyone.
I have the following issue when I complete a user task. The flow should get to conditional gateway as the picture below.
But the problem is no matter what values the variables values into the condition, The flow always goes to sequence named "Rejected".
Please someone has any idea which will be the problem
Thanks in advance.