diff options
author | Plummer, Brittany <brittany.plummer@att.com> | 2020-02-06 11:26:19 -0500 |
---|---|---|
committer | Benjamin, Max (mb388a) <mb388a@att.com> | 2020-02-06 11:26:19 -0500 |
commit | fdc8f787e9874f82409cdb2eae0475162d6519aa (patch) | |
tree | f6648e8ce7d476edb9e3c1fac2611e63f4920a79 /bpmn/mso-infrastructure-bpmn/src/main | |
parent | 422c2a3615ca059b2b9e79304738106fb845bf69 (diff) |
optimize camunda process instance history
Set buinessKey to requestId. Added plugin to pass businessKey to
subprocesses
Updated process-instance and activity-instance lookups to filter
response
Removed duplicate tests and updated att history lookup
Updated businessKey to be set to mso-request-id
Updated snapshot version to fix build issues
Removed query param from properties. added uribuilder
Updated to use uriBuilder.build().toString()
Updated unit tests to lookup by procesInstanceId to fix build failure
Issue-ID: SO-2650
Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com>
Change-Id: I357053c52a75ee5149a56392ce866dbb654b541d
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()); + } + +} |