Skip to content

Commit 2979547

Browse files
committed
FIN-348 update the account reconcile to the new BPMN test strategy
1 parent b9e845f commit 2979547

File tree

8 files changed

+205
-248
lines changed

8 files changed

+205
-248
lines changed

bpmn-process/src/main/java/com/jongsoft/finance/bpmn/delegate/account/ReconcileAccountDelegate.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
import com.jongsoft.finance.core.exception.StatusException;
55
import com.jongsoft.finance.domain.account.Account;
66
import com.jongsoft.finance.domain.transaction.Transaction;
7+
import com.jongsoft.finance.messaging.commands.transaction.CreateTransactionCommand;
8+
import com.jongsoft.finance.messaging.handlers.TransactionCreationHandler;
79
import com.jongsoft.finance.providers.AccountProvider;
810
import jakarta.inject.Singleton;
911
import lombok.extern.slf4j.Slf4j;
@@ -33,9 +35,11 @@
3335
public class ReconcileAccountDelegate implements JavaDelegate {
3436

3537
private final AccountProvider accountProvider;
38+
private final TransactionCreationHandler creationHandler;
3639

37-
ReconcileAccountDelegate(AccountProvider accountProvider) {
40+
ReconcileAccountDelegate(AccountProvider accountProvider, TransactionCreationHandler creationHandler) {
3841
this.accountProvider = accountProvider;
42+
this.creationHandler = creationHandler;
3943
}
4044

4145
@Override
@@ -61,7 +65,7 @@ public void execute(DelegateExecution execution) throws Exception {
6165
.currency(toReconcile.getCurrency())
6266
.date(transactionDate));
6367

64-
transaction.register();
68+
creationHandler.handleCreatedEvent(new CreateTransactionCommand(transaction));
6569
}
6670

6771
}

bpmn-process/src/main/resources/bpmn/contract/contract.warn.termination.bpmn

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<bpmn:definitions 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:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_0owz5j0" targetNamespace="http://jong-soft.org/fintrack/transactions/contract" exporter="Camunda Modeler" exporterVersion="3.0.1">
2+
<bpmn:definitions 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:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_0owz5j0" targetNamespace="http://jong-soft.org/fintrack/transactions/contract" exporter="Camunda Modeler" exporterVersion="5.17.0">
33
<bpmn:process id="ContractEndWarning" name="Contract expiry warning" isExecutable="true" camunda:historyTimeToLive="P1000D">
44
<bpmn:documentation>This proces describes how a contract warning should be initiated in the system.
55

@@ -13,7 +13,7 @@ This flow expects the following variables to be present:
1313
<bpmn:sequenceFlow id="SequenceFlow_0c8udwp" name="no" sourceRef="gw_in_past" targetRef="timer_activate">
1414
<bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${now().before(warnAt)}</bpmn:conditionExpression>
1515
</bpmn:sequenceFlow>
16-
<bpmn:intermediateCatchEvent id="timer_activate" name="Wait until end of contract&#10;&#10;" camunda:asyncBefore="true">
16+
<bpmn:intermediateCatchEvent id="timer_activate" name="Wait until end of contract&#10;&#10;">
1717
<bpmn:incoming>SequenceFlow_0c8udwp</bpmn:incoming>
1818
<bpmn:outgoing>SequenceFlow_0w3woqe</bpmn:outgoing>
1919
<bpmn:timerEventDefinition>
@@ -66,36 +66,45 @@ This flow expects the following variables to be present:
6666
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
6767
<dc:Bounds x="187" y="201" width="36" height="36" />
6868
</bpmndi:BPMNShape>
69-
<bpmndi:BPMNEdge id="SequenceFlow_0c8udwp_di" bpmnElement="SequenceFlow_0c8udwp">
70-
<di:waypoint x="367" y="219" />
71-
<di:waypoint x="497" y="219" />
72-
<bpmndi:BPMNLabel>
73-
<dc:Bounds x="428" y="201" width="13" height="14" />
74-
</bpmndi:BPMNLabel>
75-
</bpmndi:BPMNEdge>
7669
<bpmndi:BPMNShape id="IntermediateCatchEvent_1ex1k0b_di" bpmnElement="timer_activate">
7770
<dc:Bounds x="497" y="201" width="36" height="36" />
7871
<bpmndi:BPMNLabel>
7972
<dc:Bounds x="475" y="247" width="79" height="53" />
8073
</bpmndi:BPMNLabel>
8174
</bpmndi:BPMNShape>
82-
<bpmndi:BPMNEdge id="SequenceFlow_0w3woqe_di" bpmnElement="SequenceFlow_0w3woqe">
83-
<di:waypoint x="533" y="219" />
84-
<di:waypoint x="645" y="219" />
85-
</bpmndi:BPMNEdge>
8675
<bpmndi:BPMNShape id="EndEvent_1d1y86l_di" bpmnElement="EndEvent_1d1y86l">
8776
<dc:Bounds x="1119" y="81" width="36" height="36" />
8877
</bpmndi:BPMNShape>
89-
<bpmndi:BPMNEdge id="SequenceFlow_1723bz3_di" bpmnElement="SequenceFlow_1723bz3">
90-
<di:waypoint x="1137" y="179" />
91-
<di:waypoint x="1137" y="117" />
92-
</bpmndi:BPMNEdge>
9378
<bpmndi:BPMNShape id="ExclusiveGateway_0lbu8jy_di" bpmnElement="gw_in_past" isMarkerVisible="true">
9479
<dc:Bounds x="317" y="194" width="50" height="50" />
9580
<bpmndi:BPMNLabel>
9681
<dc:Bounds x="317" y="251" width="52" height="40" />
9782
</bpmndi:BPMNLabel>
9883
</bpmndi:BPMNShape>
84+
<bpmndi:BPMNShape id="ServiceTask_0z0vqhn_di" bpmnElement="tsk_prepare_mail_properties">
85+
<dc:Bounds x="851" y="179" width="100" height="80" />
86+
</bpmndi:BPMNShape>
87+
<bpmndi:BPMNShape id="SendTask_0d1fghn_di" bpmnElement="task_send_alert">
88+
<dc:Bounds x="1087" y="179" width="100" height="80" />
89+
</bpmndi:BPMNShape>
90+
<bpmndi:BPMNShape id="ServiceTask_1aojn9d_di" bpmnElement="st_contract_lookup">
91+
<dc:Bounds x="645" y="179" width="100" height="80" />
92+
</bpmndi:BPMNShape>
93+
<bpmndi:BPMNEdge id="SequenceFlow_0c8udwp_di" bpmnElement="SequenceFlow_0c8udwp">
94+
<di:waypoint x="367" y="219" />
95+
<di:waypoint x="497" y="219" />
96+
<bpmndi:BPMNLabel>
97+
<dc:Bounds x="428" y="201" width="13" height="14" />
98+
</bpmndi:BPMNLabel>
99+
</bpmndi:BPMNEdge>
100+
<bpmndi:BPMNEdge id="SequenceFlow_0w3woqe_di" bpmnElement="SequenceFlow_0w3woqe">
101+
<di:waypoint x="533" y="219" />
102+
<di:waypoint x="645" y="219" />
103+
</bpmndi:BPMNEdge>
104+
<bpmndi:BPMNEdge id="SequenceFlow_1723bz3_di" bpmnElement="SequenceFlow_1723bz3">
105+
<di:waypoint x="1137" y="179" />
106+
<di:waypoint x="1137" y="117" />
107+
</bpmndi:BPMNEdge>
99108
<bpmndi:BPMNEdge id="SequenceFlow_114x3a7_di" bpmnElement="SequenceFlow_114x3a7">
100109
<di:waypoint x="342" y="194" />
101110
<di:waypoint x="342" y="99" />
@@ -108,12 +117,6 @@ This flow expects the following variables to be present:
108117
<di:waypoint x="951" y="219" />
109118
<di:waypoint x="1087" y="219" />
110119
</bpmndi:BPMNEdge>
111-
<bpmndi:BPMNShape id="ServiceTask_0z0vqhn_di" bpmnElement="tsk_prepare_mail_properties">
112-
<dc:Bounds x="851" y="179" width="100" height="80" />
113-
</bpmndi:BPMNShape>
114-
<bpmndi:BPMNShape id="SendTask_0d1fghn_di" bpmnElement="task_send_alert">
115-
<dc:Bounds x="1087" y="179" width="100" height="80" />
116-
</bpmndi:BPMNShape>
117120
<bpmndi:BPMNEdge id="SequenceFlow_0b6wb04_di" bpmnElement="SequenceFlow_0b6wb04">
118121
<di:waypoint x="223" y="219" />
119122
<di:waypoint x="317" y="219" />
@@ -122,9 +125,6 @@ This flow expects the following variables to be present:
122125
<di:waypoint x="745" y="219" />
123126
<di:waypoint x="851" y="219" />
124127
</bpmndi:BPMNEdge>
125-
<bpmndi:BPMNShape id="ServiceTask_1aojn9d_di" bpmnElement="st_contract_lookup">
126-
<dc:Bounds x="645" y="179" width="100" height="80" />
127-
</bpmndi:BPMNShape>
128128
</bpmndi:BPMNPlane>
129129
</bpmndi:BPMNDiagram>
130130
</bpmn:definitions>

bpmn-process/src/main/resources/bpmn/profile/account_reconcile.bpmn

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ It will then compute if there is a difference between the open en end balance pr
3737
<bpmn:sequenceFlow id="sf_no_difference" name="no" sourceRef="xg_has_difference" targetRef="EndEvent_002t7o1">
3838
<bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${balanceDifference.doubleValue() == 0}</bpmn:conditionExpression>
3939
</bpmn:sequenceFlow>
40-
<bpmn:userTask id="task_reconcile_before" name="Start differs warning" camunda:asyncBefore="true">
40+
<bpmn:userTask id="task_reconcile_before" name="Start differs warning">
4141
<bpmn:extensionElements>
4242
<camunda:inputOutput>
4343
<camunda:inputParameter name="endDate">${startDate}</camunda:inputParameter>
@@ -65,7 +65,7 @@ It will then compute if there is a difference between the open en end balance pr
6565
<bpmn:sequenceFlow id="SequenceFlow_16hoisl" sourceRef="st_compute_end" targetRef="compute_difference" />
6666
<bpmn:sequenceFlow id="Flow_1uu32vr" sourceRef="task_reconcile_before" targetRef="st_compute_start" />
6767
<bpmn:sequenceFlow id="Flow_1i4lt7y" sourceRef="StartEvent_1" targetRef="st_compute_start" />
68-
<bpmn:serviceTask id="reconcile_account" name="Register reconcile transaction" camunda:modelerTemplate="com.jongsoft.finance.bpmn.account.AccountReconcile" camunda:modelerTemplateVersion="1" camunda:asyncBefore="true" camunda:delegateExpression="${reconcileAccountDelegate}">
68+
<bpmn:serviceTask id="reconcile_account" name="Register reconcile transaction" camunda:modelerTemplate="com.jongsoft.finance.bpmn.account.AccountReconcile" camunda:modelerTemplateVersion="1" camunda:asyncBefore="false" camunda:delegateExpression="${reconcileAccountDelegate}">
6969
<bpmn:extensionElements>
7070
<camunda:inputOutput>
7171
<camunda:inputParameter name="accountId">${accountId}</camunda:inputParameter>

0 commit comments

Comments
 (0)