cancel
Showing results for 
Search instead for 
Did you mean: 

Activiti and Other View Technolgies Integration

limcheekin
Champ on-the-rise
Champ on-the-rise
Hi,

We are using Grails GSP as the view layer of the workflow application instead of Activiti Explorer. So we will need to create our own task lists.

I will use the vacation request process as an example. Let's say a user submitted a request, at this point a task is pending in management unassigned tasklist and a manager is claim the task and the task now is in the manager's assigned tasklist. Next, the manager click on the task to retrieve the request for approval.

Is task Id. (from Task.getId()) unique per process definition? If the answer is yes, will it be appropriate if I use it as row Id. or record Id. (primary key) of vacation request record, so that when the manager click on the task, the application can use the task Id. to retrieve the vacation request record.

Did you have better suggestion on this matter? Please advice.

Regards,
Chee Kin
4 REPLIES 4

jbarrez
Star Contributor
Star Contributor
The task id is unique per process definition. It is even unique for all the tasks ever created, even when you would run Activiti in a cluster.

So yes, you can use the task id to find the correct process instance for that specific vacaction request.

limcheekin
Champ on-the-rise
Champ on-the-rise
The task id is unique per process definition. It is even unique for all the tasks ever created, even when you would run Activiti in a cluster.

So yes, you can use the task id to find the correct process instance for that specific vacaction request.

Thanks for promptly response. Is this approach is the best way? Do you have better suggestion in mind?

Regards,
Chee Kin

jbarrez
Star Contributor
Star Contributor
I wouldnt use the same id for the task and the vacation request. Rather, I would give the vacation request record a unique id, and store that reference as a process variable (note: I'm not storing the whole vacation request record as a process variable).

Then, if you need the vacation request record, you simply do:
String executionId = task.getExecutionId();
long vacationRequestId = runtimeService.getVariable(executionId, "vacactionRequestId");

limcheekin
Champ on-the-rise
Champ on-the-rise
I wouldnt use the same id for the task and the vacation request. Rather, I would give the vacation request record a unique id, and store that reference as a process variable (note: I'm not storing the whole vacation request record as a process variable).

Then, if you need the vacation request record, you simply do:
String executionId = task.getExecutionId();
long vacationRequestId = runtimeService.getVariable(executionId, "vacactionRequestId");

Thanks for the suggestion and sample code. I think your suggestion was better idea.

Regards,
Chee Kin