AnsweredAssumed Answered

bpmnParse.getCurrentProcessDefinition().getId() returns null

Question asked by lmazurk on Sep 20, 2015
Latest reply on Sep 22, 2015 by lmazurk
I'm trying to hook into UserTaskBPMNParsePre to set some UserTask properties overriding bpmn.xml definition.
I store those custom properties in external db table and want to connect them with specific UserTask basing on processDefinitionId (it's very convenient in others part of application to use procDefId) and some  others (deploymentId, userTaskId,processDefinitionKey). But seems that bpmnParse.getCurrentProcessDefinition().getId() returns null.

public class CustomUserTaskParseHandlerBefore extends AbstractBpmnParseHandler<UserTask> {

@Override
   protected Class<? extends BaseElement> getHandledType() {
      return UserTask.class;
   }

@Override
   protected void executeParse(BpmnParse bpmnParse, UserTask element) {

                String deploymentId=bpmnParse.getDeployment().getId();//OK
      String processDefKey=bpmnParse.getCurrentProcessDefinition().getKey();//OK
      String processDefId=bpmnParse.getCurrentProcessDefinition().getId();//NOT OK - null
      String userTaskId=element.getId();//OK

                //getting stored custom information
      List<ExtUserTask> lista=service.getAllExtUserTask(deploymentId,processDefId,processDefKey, userTaskId);
                ….
                //setting some custom properties overriding original from bpmn.xml e.g.
                element.setCandidateGroups(overriding_group);
        }
}

I understand that processDefinitionId is generated by activity and that processDefinitionKey is proces id in bpmn.xml scope,
but I have to use rather that generated (and present in db table for process definition) Id cause of there is situation that many same bpmn.xml files are deployed and processDefinitionKey is not unique.

Same situation is if I hook PostParser.

Do you have any suggestion?

Outcomes