Updating Procecss Busienss Key

Description

It is a legitimate requirement that business key of process be set as per business data collected during start event(or later events). Typically execution listener on start event would be allowed to set the business key if it is null (in case where instance started with business key).
Following changes are required to implement this -

  1.  

    1. org.activiti.engine.runtime.Execution interface declares method
      public String updateProcessBusinessKey(String bzKey);

##org.activiti.engine.impl.persistence.entity.ExecutionEntity implements it as follows

public String updateProcessBusinessKey(String bzKey) {
if (isProcessInstanceType() && businessKey == null) {
setBusinessKey(bzKey);
Context.getCommandContext()
.getHistoryManager().updateProcessBusinessKeyInHistory(this);
}
}

The update business key method is required in HistoryManager because the history is created before process start event execution listener is triggered.

Just to complement this a small change in explorer MyProcessInstancesListQuery at line 79 in method createItem will show all instances with business key - more user friendly way to display list of instances.

String itemName = getProcessDisplayName(processDefinition) + " (" + processInstance.getId() + ")"
+ (processInstance.getBusinessKey() != null? processInstance.getBusinessKey() : "");

Prashant

Assignee

Tijs Rademakers

Reporter

Prashant Mirajkar

Labels

None

Components

Fix versions

Priority

Minor
Configure