diff options
Diffstat (limited to 'bpmn/mso-infrastructure-bpmn/src/main')
3 files changed, 55 insertions, 2 deletions
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java index 70365b744c..25f7c4b93f 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java @@ -75,9 +75,8 @@ public class WorkflowProcessor extends ProcessEngineAwareService { } } - // Note: the business key is used to identify the process in unit tests protected static String getBusinessKey(Map<String, Object> inputVariables) { - return getOrCreate(inputVariables, "mso-business-key"); + return getOrCreate(inputVariables, "mso-request-id"); } diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/CallActivityBusinessKeyParseListener.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/CallActivityBusinessKeyParseListener.java new file mode 100644 index 0000000000..80d86ad009 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/CallActivityBusinessKeyParseListener.java @@ -0,0 +1,30 @@ +package org.onap.so.bpmn.core.plugins; + +import org.camunda.bpm.engine.impl.bpmn.behavior.CallableElementActivityBehavior; +import org.camunda.bpm.engine.impl.bpmn.parser.AbstractBpmnParseListener; +import org.camunda.bpm.engine.impl.context.Context; +import org.camunda.bpm.engine.impl.core.model.CallableElement; +import org.camunda.bpm.engine.impl.el.ElValueProvider; +import org.camunda.bpm.engine.impl.el.Expression; +import org.camunda.bpm.engine.impl.el.ExpressionManager; +import org.camunda.bpm.engine.impl.pvm.process.ActivityImpl; +import org.camunda.bpm.engine.impl.pvm.process.ScopeImpl; +import org.camunda.bpm.engine.impl.util.xml.Element; +import org.springframework.stereotype.Component; + + +@Component +public class CallActivityBusinessKeyParseListener extends AbstractBpmnParseListener { + + @Override + public void parseCallActivity(Element callActivityElement, ScopeImpl scope, ActivityImpl activity) { + ExpressionManager expressionManager = Context.getProcessEngineConfiguration().getExpressionManager(); + Expression expression = expressionManager.createExpression("#{execution.processBusinessKey}"); + ElValueProvider p = new ElValueProvider(expression); + CallableElementActivityBehavior callableElementActivityBehavior = + (CallableElementActivityBehavior) activity.getActivityBehavior(); + CallableElement callableElement = (CallableElement) callableElementActivityBehavior.getCallableElement(); + callableElement.setBusinessKeyValueProvider(p); + callableElementActivityBehavior.setCallableElement(callableElement); + } +} diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/CallActivityBusinessKeyParseListenerPlugin.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/CallActivityBusinessKeyParseListenerPlugin.java new file mode 100644 index 0000000000..a2d897e367 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/CallActivityBusinessKeyParseListenerPlugin.java @@ -0,0 +1,24 @@ +package org.onap.so.bpmn.core.plugins; + +import java.util.ArrayList; +import java.util.List; +import org.camunda.bpm.engine.impl.bpmn.parser.BpmnParseListener; +import org.camunda.bpm.engine.impl.cfg.AbstractProcessEnginePlugin; +import org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl; +import org.springframework.stereotype.Component; + + +@Component +public class CallActivityBusinessKeyParseListenerPlugin extends AbstractProcessEnginePlugin { + + @Override + public void preInit(ProcessEngineConfigurationImpl processEngineConfiguration) { + List<BpmnParseListener> preParseListeners = processEngineConfiguration.getCustomPreBPMNParseListeners(); + if (preParseListeners == null) { + preParseListeners = new ArrayList<>(); + processEngineConfiguration.setCustomPreBPMNParseListeners(preParseListeners); + } + preParseListeners.add(new CallActivityBusinessKeyParseListener()); + } + +} |