Completed vs. Deleted Tasks / Instances

676 visualizações
Pular para a primeira mensagem não lida

Carsten Spieker

não lida,
14 de mai. de 2014, 03:27:5514/05/2014
para camunda-...@googlegroups.com
Hello,

I don´t really know how to distinguish between normally completed and manually deleted tasks / process instances. Both are results of using history service. 
With tasks I think I can user the "deleteReason" field. It seems that all normally completed tasks have the value TaskEntity.DELETE_REASON_COMPLETED ("completed"), providing that no one deleted a task manually with that reason.

But what about process instances? I cannot find any difference between completed and deleted instances in the history service result.

Thanks in advance!!

Greetz
Carsten

Daniel Meyer

não lida,
14 de mai. de 2014, 07:06:3414/05/2014
para camunda-...@googlegroups.com
Hi Carsten,

with 7.1.0 we also introduced the new method HistoricActivityInstance.isCanceled() This allows you to check whether an activity instance was completed or cancelled. Beware though: the cancelled state can either result from a user cancelling the activity manually or from an interrupting BPMN activity (such as a boundary event) beeing fired.

The HistoricProcessInstance also provides a getDeleteReason() field. If you call RuntimeService.deleteProcessInstance('...') you can provide it.

Cheers,
Daniel

Carsten Spieker

não lida,
14 de mai. de 2014, 07:40:4114/05/2014
para camunda-...@googlegroups.com
Hi Daniel,

thanks for the quick answer. Now I feel confident with the user activities.

But what if RuntimeService.deleteProcessInstance was called without a delete reason? Then I cannot distinguish this instance from one that was completed.

Greetz
Carsten

Carsten Spieker

não lida,
16 de mai. de 2014, 03:54:0316/05/2014
para camunda-...@googlegroups.com
Update:
Furthermore there seem to be no HistoricActivityInstances for tasks which were created manually via TaskService.createTask() and TaskService.saveTask(). Anyway I do not know how to search for them since they to not have any activityInstanceId or executionId, even if they habe been completed via TaskService.completeTask().

What is best practise here?

Daniel Meyer

não lida,
22 de mai. de 2014, 04:24:5022/05/2014
para camunda-...@googlegroups.com
Hi Carsten,

I see your points. 

We should have a proper STATE_ flag in the database for HistoricProcessInstances in the same way we have for activity instances.

The thing about no historic activity instances to be present for standalone tasks is also correct. I would not change that though becase these tasks have no "activity" in BPMN.

You could also look into the new HistoryService.createUserOperationLogQuery(). It allows you to query for operations performed on tasks.
org.camunda.bpm.engine.history.UserOperationLogEntry provides a list of operation constants.

Regards,
Daniel
Responder a todos
Responder ao autor
Encaminhar
A mensagem foi excluída
A mensagem foi excluída
0 nova mensagem