@Override
public void onCreate(DelegateTask delegateTask) throws Exception {
String taskDefinitionKey = delegateTask.getTaskDefinitionKey();
String processDefinitionId = delegateTask.getProcessDefinitionId();
String processInstanceId = delegateTask.getProcessInstanceId();
HistoricProcessInstanceEntity historicProcessInstanceEntity = Context
.getCommandContext().getHistoricProcessInstanceEntityManager()
.findHistoricProcessInstance(processInstanceId);
List<BpmConfRule> bpmConfRules = ApplicationContextHelper
.getBean(BpmConfRuleManager.class)
.find("from BpmConfRule where bpmConfNode.bpmConfBase.processDefinitionId=? and bpmConfNode.code=?",
processDefinitionId, taskDefinitionKey);
logger.debug("delegateTask.getId : {}", delegateTask.getId());
logger.debug("taskDefinitionKey : {}", taskDefinitionKey);
logger.debug("processDefinitionId : {}", processDefinitionId);
logger.debug("processInstanceId : {}", processInstanceId);
logger.debug("bpmConfRules : {}", bpmConfRules);
UserConnector userConnector = ApplicationContextHelper
.getBean(UserConnector.class);
OrgConnector orgConnector = (OrgConnector) ApplicationContextHelper
.getBean(OrgConnector.class);
ExpressionManager expressionManager = Context
.getProcessEngineConfiguration().getExpressionManager();
MapVariableScope mapVariableScope = new MapVariableScope();
String initiator = historicProcessInstanceEntity.getStartUserId();
mapVariableScope.setVariable("initiator",
userConnector.findById(initiator));
for (BpmConfRule bpmConfRule : bpmConfRules) {
String value = bpmConfRule.getValue();