Getting properties a userTask in deployed processdefintion, taking into account DynamicBpmnservice

Hi there,

a question related to using the DynamicBpmnService.
If I understand correctly, this method getProcessDefinitionInfo()
ObjectNode infoNode = dynamicBpmnService.getProcessDefinitionInfo(“procDefId”);
only returns changes that have already been made to a process definition by the method saveProcessDefinitionInfo() method:
dynamicBpmnService.saveProcessDefinitionInfo(“procDefId”, infoNode);
(because, when I simply call getProcessDefinitionInfo() on a procdef, it returns ‘null’ when not having call saveProcessDefinitionInfo() before).

But, imagine you want to create some GUI, where a users can select a processdefinition, and then select a usertask, and then you want to know, for example 'what is the current assignee expression for this usertask that will be evaluated by the engine when new taskinstance will be spawned?.
Then, we need to take into consideration that the assignee should be taken from the deployed model (in case nobody called ‘saveProcesseditionInfo’ for this procdef/usertask), OR it should be taken from the ‘overriding’ act_procdef_info (in case somebody has already called ‘saveProcesseditionInfo’ for this procdef/usertask)

So, is there a way in the API to get, given a processdefinitionId (String) and the userTask’s BPMNElementId (String), what is the assignee / candidateusers / candidategroups expression - taking into account the presence of overriding act_procdef_info under the hood?
(and, for that matter, for any other property that is supported by the dynamicBpmnService)

I imagine that the engine runtime needs such a method whenever a new userTask instance is about to be created.
Or does the engine at runtime check each time: 'is property X overridden by the act_procdef_info ? - and if so, use that propertyvalue instead of the original bpmn xml value" ?

Hi,

Good points, and I agree that it would make more sense to get the current assignee expression, and this includes the BPMN XML value or a value set with the saveProcessDefinitionInfo method. We’ll have a look how we could make it work like this. If you want to contribute then let us know as well.

Thanks,

Tijs

Hi Thijs,
I’m willing to see if one of my colleagues can contribute - we have to write some code anyway, so we might as well do that in the flowable api instead of in our own codebase. If you have some instructions on which methods / classes to create, we could evaluate if we can implementat that and contribute. (We’re still on activiti 5.21 but that should easily fit in flowable 5.22)

Hi Pieter,

Ok great. In the DynamicBpmnServiceImpl class the current logic only checks the process definition info values. I think the improvement would be to check the process definition info value and if it doesn’t exist get the value from the BpmnModel of the process definition. Let me know if there any questions.

Best regards,

Tijs

Hi Tijs,
we have some code ready that we can contribute. We have added some extra methods, however, to make it easier to work with the dynamicBPMNService. These methods might be useful for other as well; and especially useful if you want to provide some REST endpoints to work with the dynamicBPMNservice.
What we did:

  1. extra method that returns a summary object for the entire process, or a specific element. For each element, it shows if a property is present in the model and/or in the overrriding info table.
  2. Added a reset method that removes the field (key) from the processinfo node (= removes the key from the processinfo, so in effect it means: revert back to the original model)
  3. Helper methods for working with collections of candidateUsers or candidateGroups (accepts list of strings instead of a single value)

We have only implemented this for usertask assignee, candidateUser and candidateGroup, and the scripttask script.

How should be proceed? Put this all in one pull request? Or rather in smaller pieces?

Hi Tijs,

This fork commit shows you on the code level what we have added.

Example Code

Best Regards,

David

Hi Pieter and David,

Thanks, great contribution. If you can create one pull request that would be fine.

Thanks,

Tijs

Hi Tijs,

The pull request is available here https://github.com/flowable/flowable-engine/pull/61

Best Regards,

David

Hi David,

Thanks, will try to merge it now.

Best regards,

Tijs