AnsweredAssumed Answered

Historic service task name does not resolve EL expression

Question asked by pkonyves on May 9, 2014
Latest reply on May 12, 2014 by trademak
Hi,

You can put EL expression into user task definition. When the task is created, the expression is resolved. It's a feature of activiti. And a good feature.

As it turns out User tasks are different from service tasks from the historic service's point of view (and implementation point of view). Historic user tasks are stored in ACT_HI_TASKINST, service tasks and all other activities are stored in ACT_HI_ACTINST table.

The EL name of the User task is resolved fine in ACT_HI_TASKINST but the EL name of Service task and every other activities are not resolved in ACT_HI_ACTINST. I see that user tasks are unique from other activities from implementation point of view, but from a model perspective they are equivalent.
Based on what I see in org.activiti.engine.impl.bpmn.behavior.UserTaskActivitiyBehavior and ServiceTaskDelegate*ActivityBehavior

If I can have EL in the User Task name, why cannot I have EL in the name of a Service Task or let's say every other activities? I want the name of every activities to be presented nice and shiny not just the User task.

I can implement it and create a pull request. What I think we have to do:
In the BpmnParseHandlers e.g. in AbstractBpmnParseHandler.createActivitiyOnScope() change the

activity.setProperty("name", flowElement.getName());


to:

ExpressionManager expressionManager = bpmnParse.getExpressionManager();
activity.setProperty("name", expressionManager.createExpression(flowElement.getName()));


Change the DefaultHistoryManager.recordActivityStart() to resolve the el expression of the activity name similar to what is found in UserTaskActivityBehavior

String name = (String)this.taskDefinition.getNameExpression().getValue(execution);
       task.setName(name);


Of course there might be changes needed elsewhere in the code, but I think it's a good starting point. What do you think?

Outcomes