Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/ProcessMaker/Nayra/Bpmn/StartEventTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@

namespace ProcessMaker\Nayra\Bpmn;

use ProcessMaker\Nayra\Contracts\Bpmn\CatchEventInterface;
use ProcessMaker\Nayra\Contracts\Bpmn\CollectionInterface;
use ProcessMaker\Nayra\Contracts\Bpmn\EndEventInterface;
use ProcessMaker\Nayra\Contracts\Bpmn\EventDefinitionInterface;
use ProcessMaker\Nayra\Contracts\Bpmn\EventInterface;
use ProcessMaker\Nayra\Contracts\Bpmn\FlowInterface;
use ProcessMaker\Nayra\Contracts\Bpmn\MessageEventDefinitionInterface;
use ProcessMaker\Nayra\Contracts\Bpmn\ThrowEventInterface;
use ProcessMaker\Nayra\Contracts\Bpmn\TokenInterface;
use ProcessMaker\Nayra\Contracts\Bpmn\TransitionInterface;
use ProcessMaker\Nayra\Contracts\Engine\EngineInterface;
Expand Down Expand Up @@ -116,7 +120,11 @@ public function execute(EventDefinitionInterface $eventDef, ExecutionInstanceInt
$process = $this->getOwnerProcess();
$data = $eventDefinition->getPayloadData($token, $this);
$dataStorage = $process->getRepository()->createDataStore();
$dataStorage->setData($data);
$sourceHasDataMapping = $token?->getOwnerElement()?->getDataInputs()?->count();
$targetHasDataMapping = $this->getDataOutputAssociations()?->count();
if (!$sourceHasDataMapping && !$targetHasDataMapping) {
$dataStorage->setData($data);
}
$instance = $process->getEngine()->createExecutionInstance($process, $dataStorage);
}
$this->triggerPlace[$index]->addNewToken($instance);
Expand Down
14 changes: 14 additions & 0 deletions tests/Feature/Patterns/PatternsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,20 @@ private function runProcess($filename, $data, $startEvent, $result, $events, $ou
if ($errors) {
$this->assertData($errors, $runtimeErrors);
}
// Check data from all instances
$expectedDataByInstances = $json['expectedDataByInstances'] ?? false;
if ($expectedDataByInstances ?? false) {
$i = 0;
foreach ($processes as $process) {
foreach ($process->getBpmnElementInstance()->getInstances() as $ins) {
if (!isset($expectedDataByInstances[$i])) {
$this->fail('Data instance ' . $i . ' not found for test' . $testName);
}
$this->assertData($expectedDataByInstances[$i], $ins->getDataStore()->getData());
$i++;
}
}
}
}

/**
Expand Down
185 changes: 185 additions & 0 deletions tests/Feature/Patterns/files/MessageDataMappingStartEvent.bpmn
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
<?xml version="1.0" encoding="UTF-8"?>
<bpmn:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:pm="http://processmaker.com/BPMN/2.0/Schema.xsd" xmlns:tns="http://sourceforge.net/bpmn/definitions/_1530553328908" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://bpmn.io/schema/bpmn" exporter="ProcessMaker Modeler" exporterVersion="1.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL http://bpmn.sourceforge.net/schemas/BPMN20.xsd">
<bpmn:process id="ProcessId" name="ProcessName" isExecutable="true">
<bpmn:startEvent id="node_3" name="Start Event" pm:allowInterstitial="true" pm:interstitialScreenRef="14" pm:config="{&quot;web_entry&quot;:null}">
<bpmn:outgoing>node_20</bpmn:outgoing>
</bpmn:startEvent>
<bpmn:task id="node_4" name="Form Task 1" pm:screenRef="15" pm:allowInterstitial="false" pm:assignment="requester" pm:assignmentLock="false" pm:allowReassignment="false" pm:config="{&quot;email_notifications&quot;:{&quot;notifications&quot;:[{&quot;sendAt&quot;:&quot;task-start&quot;,&quot;expression&quot;:&quot;&quot;,&quot;subject&quot;:&quot;RE: {{_user.firstname}} assigned you in \&quot;{{_task_name}}\&quot;&quot;,&quot;type&quot;:&quot;screen&quot;,&quot;textBody&quot;:&quot;&quot;,&quot;screenRef&quot;:12,&quot;usersAndGroupsOptionSelected&quot;:null,&quot;toRecipients&quot;:[{&quot;type&quot;:&quot;assignedUser&quot;,&quot;value&quot;:null}],&quot;ccRecipients&quot;:[],&quot;bccRecipients&quot;:[],&quot;i&quot;:21}]},&quot;web_entry&quot;:null}" pm:elementDestination="{&quot;type&quot;:&quot;processLaunchpad&quot;,&quot;value&quot;:&quot;process-browser/123?categorySelected=-1&quot;}">
<bpmn:incoming>node_20</bpmn:incoming>
<bpmn:outgoing>node_153</bpmn:outgoing>
</bpmn:task>
<bpmn:intermediateThrowEvent id="node_18" name="Intermediate Message Throw Event">
<bpmn:incoming>node_177</bpmn:incoming>
<bpmn:outgoing>node_37</bpmn:outgoing>
<bpmn:dataInput id="din_1764370229232" name="form_input_1"/>
<bpmn:dataInput id="din_1764965138442" name="glossary"/>
<bpmn:dataInputAssociation>
<bpmn:targetRef>din_1764370229232</bpmn:targetRef>
<bpmn:assignment>
<bpmn:from>form_input_1</bpmn:from>
<bpmn:to>form_input_3</bpmn:to>
</bpmn:assignment>
</bpmn:dataInputAssociation>
<bpmn:dataInputAssociation>
<bpmn:targetRef>din_1764965138442</bpmn:targetRef>
<bpmn:assignment>
<bpmn:from>glossary.title</bpmn:from>
<bpmn:to>form_input_1a</bpmn:to>
</bpmn:assignment>
</bpmn:dataInputAssociation>
<bpmn:inputSet>
<bpmn:dataInputRefs>din_1764370229232</bpmn:dataInputRefs>
<bpmn:dataInputRefs>din_1764965138442</bpmn:dataInputRefs>
</bpmn:inputSet>
<bpmn:messageEventDefinition messageRef="node_18_message"/>
</bpmn:intermediateThrowEvent>
<bpmn:sequenceFlow id="node_20" name="" sourceRef="node_3" targetRef="node_4"/>
<bpmn:sequenceFlow id="node_53" name="" sourceRef="node_17" targetRef="node_43"/>
<bpmn:sequenceFlow id="node_74" name="" sourceRef="node_43" targetRef="node_66"/>
<bpmn:sequenceFlow id="node_97" name="" sourceRef="node_77" targetRef="node_87"/>
<bpmn:sequenceFlow id="node_88" name="" sourceRef="node_103" targetRef="node_77"/>
<bpmn:endEvent id="node_104" name="Message End Event">
<bpmn:incoming>node_37</bpmn:incoming>
<bpmn:dataInput id="din_1764908076462" name="form_select_list_1"/>
<bpmn:dataInputAssociation>
<bpmn:targetRef>din_1764908076462</bpmn:targetRef>
<bpmn:assignment>
<bpmn:from>form_select_list_1</bpmn:from>
<bpmn:to>form_select_list_3</bpmn:to>
</bpmn:assignment>
</bpmn:dataInputAssociation>
<bpmn:inputSet>
<bpmn:dataInputRefs>din_1764908076462</bpmn:dataInputRefs>
</bpmn:inputSet>
<bpmn:messageEventDefinition messageRef="node_104_message"/>
</bpmn:endEvent>
<bpmn:sequenceFlow id="node_37" name="" sourceRef="node_18" targetRef="node_104"/>
<bpmn:scriptTask id="node_129" name="Script Task" pm:scriptRef="4">
<bpmn:incoming>node_153</bpmn:incoming>
<bpmn:outgoing>node_177</bpmn:outgoing>
</bpmn:scriptTask>
<bpmn:sequenceFlow id="node_153" sourceRef="node_4" targetRef="node_129"/>
<bpmn:sequenceFlow id="node_177" sourceRef="node_129" targetRef="node_18"/>
</bpmn:process>
<bpmn:collaboration id="collaboration_0">
<bpmn:participant id="node_1" name="Pool" processRef="ProcessId"/>
<bpmn:participant id="node_2" name="Pool" processRef="Process_1"/>
<bpmn:participant id="node_75" name="Pool" processRef="Process_2"/>
<bpmn:messageFlow id="node_19" name="" sourceRef="node_18" targetRef="node_17"/>
<bpmn:messageFlow id="node_105" name="" sourceRef="node_104" targetRef="node_103"/>
</bpmn:collaboration>
<bpmn:process id="Process_1">
<bpmn:startEvent id="node_17" name="Message Start Event">
<bpmn:outgoing>node_53</bpmn:outgoing>
<bpmn:messageEventDefinition messageRef="node_18_message"/>
</bpmn:startEvent>
<bpmn:task id="node_43" name="Form Task 2" pm:screenRef="16" pm:allowInterstitial="false" pm:assignment="requester" pm:assignmentLock="false" pm:allowReassignment="false" pm:config="{&quot;email_notifications&quot;:{&quot;notifications&quot;:[{&quot;sendAt&quot;:&quot;task-start&quot;,&quot;expression&quot;:&quot;&quot;,&quot;subject&quot;:&quot;RE: {{_user.firstname}} assigned you in \&quot;{{_task_name}}\&quot;&quot;,&quot;type&quot;:&quot;screen&quot;,&quot;textBody&quot;:&quot;&quot;,&quot;screenRef&quot;:12,&quot;usersAndGroupsOptionSelected&quot;:null,&quot;toRecipients&quot;:[{&quot;type&quot;:&quot;assignedUser&quot;,&quot;value&quot;:null}],&quot;ccRecipients&quot;:[],&quot;bccRecipients&quot;:[],&quot;i&quot;:15}]},&quot;web_entry&quot;:null}" pm:elementDestination="{&quot;type&quot;:&quot;taskSource&quot;,&quot;value&quot;:null}">
<bpmn:incoming>node_53</bpmn:incoming>
<bpmn:outgoing>node_74</bpmn:outgoing>
</bpmn:task>
<bpmn:endEvent id="node_66" name="End Event" pm:elementDestination="{&quot;type&quot;:&quot;summaryScreen&quot;,&quot;value&quot;:null}">
<bpmn:incoming>node_74</bpmn:incoming>
</bpmn:endEvent>
</bpmn:process>
<bpmn:message id="node_18_message" name="node_18_message"/>
<bpmn:process id="Process_2">
<bpmn:task id="node_77" name="Form Task 3" pm:screenRef="17" pm:allowInterstitial="false" pm:assignment="requester" pm:assignmentLock="false" pm:allowReassignment="false" pm:config="{&quot;email_notifications&quot;:{&quot;notifications&quot;:[{&quot;sendAt&quot;:&quot;task-start&quot;,&quot;expression&quot;:&quot;&quot;,&quot;subject&quot;:&quot;RE: {{_user.firstname}} assigned you in \&quot;{{_task_name}}\&quot;&quot;,&quot;type&quot;:&quot;screen&quot;,&quot;textBody&quot;:&quot;&quot;,&quot;screenRef&quot;:13,&quot;usersAndGroupsOptionSelected&quot;:null,&quot;toRecipients&quot;:[{&quot;type&quot;:&quot;assignedUser&quot;,&quot;value&quot;:null}],&quot;ccRecipients&quot;:[],&quot;bccRecipients&quot;:[],&quot;i&quot;:13}]},&quot;web_entry&quot;:null}" pm:elementDestination="{&quot;type&quot;:&quot;taskSource&quot;,&quot;value&quot;:null}">
<bpmn:incoming>node_88</bpmn:incoming>
<bpmn:outgoing>node_97</bpmn:outgoing>
</bpmn:task>
<bpmn:endEvent id="node_87" name="End Event" pm:elementDestination="{&quot;type&quot;:&quot;summaryScreen&quot;,&quot;value&quot;:null}">
<bpmn:incoming>node_97</bpmn:incoming>
</bpmn:endEvent>
<bpmn:startEvent id="node_103" name="Message Start Event">
<bpmn:outgoing>node_88</bpmn:outgoing>
<bpmn:messageEventDefinition messageRef="node_104_message"/>
</bpmn:startEvent>
</bpmn:process>
<bpmn:message id="node_104_message" name="node_104_message"/>
<bpmndi:BPMNDiagram id="BPMNDiagramId">
<bpmndi:BPMNPlane id="BPMNPlaneId" bpmnElement="collaboration_0">
<bpmndi:BPMNShape id="node_1_di" bpmnElement="node_1">
<dc:Bounds x="196" y="-5" width="608" height="300"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="node_2_di" bpmnElement="node_2">
<dc:Bounds x="282" y="341" width="600" height="300"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="node_3_di" bpmnElement="node_3">
<dc:Bounds x="703" y="50" width="36" height="36"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="node_4_di" bpmnElement="node_4">
<dc:Bounds x="489" y="30" width="116" height="76"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="node_17_di" bpmnElement="node_17">
<dc:Bounds x="350" y="450" width="36" height="36"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="node_18_di" bpmnElement="node_18">
<dc:Bounds x="350" y="209" width="36" height="36"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="node_19_di" bpmnElement="node_19">
<di:waypoint x="368" y="227"/>
<di:waypoint x="368" y="468"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="node_20_di" bpmnElement="node_20">
<di:waypoint x="721" y="68"/>
<di:waypoint x="547" y="68"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="node_43_di" bpmnElement="node_43">
<dc:Bounds x="478" y="430" width="116" height="76"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="node_53_di" bpmnElement="node_53">
<di:waypoint x="368" y="468"/>
<di:waypoint x="536" y="468"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="node_66_di" bpmnElement="node_66">
<dc:Bounds x="650" y="450" width="36" height="36"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="node_74_di" bpmnElement="node_74">
<di:waypoint x="536" y="468"/>
<di:waypoint x="668" y="468"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="node_75_di" bpmnElement="node_75">
<dc:Bounds x="880" y="13" width="600" height="300"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="node_77_di" bpmnElement="node_77">
<dc:Bounds x="1131" y="188" width="116" height="76"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="node_87_di" bpmnElement="node_87">
<dc:Bounds x="1308" y="208" width="36" height="36"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="node_97_di" bpmnElement="node_97">
<di:waypoint x="1189" y="226"/>
<di:waypoint x="1326" y="226"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="node_103_di" bpmnElement="node_103">
<dc:Bounds x="1000" y="208" width="36" height="36"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="node_88_di" bpmnElement="node_88">
<di:waypoint x="1018" y="226"/>
<di:waypoint x="1189" y="226"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="node_104_di" bpmnElement="node_104">
<dc:Bounds x="577" y="209" width="36" height="36"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="node_37_di" bpmnElement="node_37">
<di:waypoint x="368" y="227"/>
<di:waypoint x="595" y="227"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="node_105_di" bpmnElement="node_105">
<di:waypoint x="595" y="227"/>
<di:waypoint x="1018" y="226"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="node_129_di" bpmnElement="node_129">
<dc:Bounds x="310" y="30" width="116" height="76"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="node_153_di" bpmnElement="node_153">
<di:waypoint x="547" y="68"/>
<di:waypoint x="368" y="68"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="node_177_di" bpmnElement="node_177">
<di:waypoint x="368" y="68"/>
<di:waypoint x="368" y="227"/>
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>
Loading