From 0f02baf13e6abe88efc4608161fb62942a94bce2 Mon Sep 17 00:00:00 2001 From: Dan Date: Thu, 23 Feb 2023 17:11:32 -0500 Subject: [PATCH] maintain a way to access the correlations in relation to the correlation keys --- .../SpiffWorkflow/bpmn/specs/events/event_definitions.py | 9 +++++++++ .../tests/SpiffWorkflow/camunda/StartMessageEventTest.py | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/SpiffWorkflow/SpiffWorkflow/bpmn/specs/events/event_definitions.py b/SpiffWorkflow/SpiffWorkflow/bpmn/specs/events/event_definitions.py index f9080329b..ef76270cb 100644 --- a/SpiffWorkflow/SpiffWorkflow/bpmn/specs/events/event_definitions.py +++ b/SpiffWorkflow/SpiffWorkflow/bpmn/specs/events/event_definitions.py @@ -206,6 +206,15 @@ class MessageEventDefinition(NamedEventDefinition): if payload is not None: my_task.set_data(**payload) + def get_correlation_keys(self, task, payload): + correlation_keys = {} + for property in self.correlation_properties: + for key in property.correlation_keys: + if key not in correlation_keys: + correlation_keys[key] = {} + correlation_keys[key][property.name] = task.workflow.script_engine._evaluate(property.expression, payload) + return correlation_keys + def get_correlations(self, task, payload): correlations = {} for property in self.correlation_properties: diff --git a/SpiffWorkflow/tests/SpiffWorkflow/camunda/StartMessageEventTest.py b/SpiffWorkflow/tests/SpiffWorkflow/camunda/StartMessageEventTest.py index 5dd81a069..dd6200f53 100644 --- a/SpiffWorkflow/tests/SpiffWorkflow/camunda/StartMessageEventTest.py +++ b/SpiffWorkflow/tests/SpiffWorkflow/camunda/StartMessageEventTest.py @@ -17,7 +17,7 @@ class StartMessageTest(BaseTestCase): def testParserCanReturnStartMessages(self): parser = self.get_parser('message_test.bpmn') self.assertEqual( - parser.process_parsers['ThrowCatch'].start_messages(), ['Message_1rkbi27']) + parser.process_parsers['ThrowCatch'].start_messages(), ['ApprovalRequest']) parser = self.get_parser('random_fact.bpmn') self.assertEqual(