Skip to content

Commit b369f9c

Browse files
committed
Add PersonMaxAge service
1 parent a0a008d commit b369f9c

File tree

3 files changed

+218
-0
lines changed

3 files changed

+218
-0
lines changed
Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<dmn:definitions xmlns:dmn="http://www.omg.org/spec/DMN/20180521/MODEL/" xmlns="https://kie.apache.org/dmn/_45AEA6C4-45ED-45F6-A18F-C534ADDEB602" xmlns:feel="http://www.omg.org/spec/DMN/20180521/FEEL/" xmlns:kie="http://www.drools.org/kie/dmn/1.2" xmlns:dmndi="http://www.omg.org/spec/DMN/20180521/DMNDI/" xmlns:di="http://www.omg.org/spec/DMN/20180521/DI/" xmlns:dc="http://www.omg.org/spec/DMN/20180521/DC/" xmlns:included1="https://kie.apache.org/dmn/_1B91A885-130A-4E0B-A762-E12AA6DD5C79" xmlns:included2="https://kie.apache.org/dmn/_81D401A8-CA81-4F9A-ABCC-532C25768708" id="_ACF018D7-A3FB-49CE-AF6E-0E58AF85A0E0" name="PersonMaxAge" typeLanguage="http://www.omg.org/spec/DMN/20180521/FEEL/" namespace="https://kie.apache.org/dmn/_45AEA6C4-45ED-45F6-A18F-C534ADDEB602">
3+
<dmn:extensionElements/>
4+
<dmn:import id="_17C24D7E-8925-485C-ACD9-E20E3BEEDB86" name="BDT" namespace="https://kie.apache.org/dmn/_1B91A885-130A-4E0B-A762-E12AA6DD5C79" locationURI="../../BDT.dmn" importType="http://www.omg.org/spec/DMN/20180521/MODEL/"/>
5+
<dmn:import id="_8C23053A-4DF3-4662-8FF1-67869BCE5AAE" name="Age" namespace="https://kie.apache.org/dmn/_81D401A8-CA81-4F9A-ABCC-532C25768708" locationURI="Age.dmn" importType="http://www.omg.org/spec/DMN/20180521/MODEL/"/>
6+
<dmn:itemDefinition id="_A5566AE8-C4BC-4021-A0F1-EE81B42FE4DA" name="tParameters" isCollection="false">
7+
<dmn:itemComponent id="_3EACAE92-B42D-414F-8B34-89764C4CD811" name="maxAge" isCollection="false">
8+
<dmn:typeRef>number</dmn:typeRef>
9+
</dmn:itemComponent>
10+
<dmn:itemComponent id="_AFC0A325-9DE8-4FC9-9100-A002D5EA104F" name="asOfDate" isCollection="false">
11+
<dmn:typeRef>date</dmn:typeRef>
12+
</dmn:itemComponent>
13+
<dmn:itemComponent id="_4D83F9CB-C7B7-4815-B666-99E81ED80640" name="personId" isCollection="false">
14+
<dmn:typeRef>string</dmn:typeRef>
15+
</dmn:itemComponent>
16+
</dmn:itemDefinition>
17+
<dmn:itemDefinition id="_0D71EA48-4205-46AA-A9AD-F8CACAA46DCA" name="tPerson" isCollection="false">
18+
<dmn:itemComponent id="_86173707-A8D7-445B-98CE-F4290D8759FF" name="id" isCollection="false">
19+
<dmn:typeRef>string</dmn:typeRef>
20+
</dmn:itemComponent>
21+
<dmn:itemComponent id="_B3435252-7AD9-4DA1-9146-30AA875309DB" name="dateOfBirth" isCollection="false">
22+
<dmn:typeRef>date</dmn:typeRef>
23+
</dmn:itemComponent>
24+
</dmn:itemDefinition>
25+
<dmn:itemDefinition id="_060708CA-ABE7-4539-B875-B27DF041CD57" name="tPersonList" isCollection="true">
26+
<dmn:typeRef>tPerson</dmn:typeRef>
27+
</dmn:itemDefinition>
28+
<dmn:itemDefinition id="_C2397C76-AF05-46B5-A22F-56B4FC974408" name="tSituation" isCollection="false">
29+
<dmn:itemComponent id="_C04C0B57-7407-4B63-B7A3-4B66F11EEC68" name="people" isCollection="false">
30+
<dmn:typeRef>tPersonList</dmn:typeRef>
31+
</dmn:itemComponent>
32+
</dmn:itemDefinition>
33+
<dmn:decisionService id="_50AFC26A-F5B6-498A-B58F-BDC38F8BE4C9" name="PersonMaxAgeService">
34+
<dmn:extensionElements/>
35+
<dmn:variable id="_96B237BA-6B14-42DC-9FA6-4CD430637360" name="PersonMaxAgeService"/>
36+
<dmn:outputDecision href="#_590F4D25-088E-44C2-B687-42994AA8EDFE"/>
37+
<dmn:inputData href="#_0504B4EF-D5C1-44D2-9CF5-DDFDD6A7C097"/>
38+
<dmn:inputData href="#_B722FDDE-1413-4731-82EC-5B49261E3D79"/>
39+
</dmn:decisionService>
40+
<dmn:decision id="_590F4D25-088E-44C2-B687-42994AA8EDFE" name="checkResult">
41+
<dmn:extensionElements/>
42+
<dmn:variable id="_A9A14E99-E73C-408C-B44D-0193B9BDEFDB" name="checkResult" typeRef="boolean"/>
43+
<dmn:informationRequirement id="_AA093E8F-6D25-46E9-8EF3-F20052C8D666">
44+
<dmn:requiredInput href="#_0504B4EF-D5C1-44D2-9CF5-DDFDD6A7C097"/>
45+
</dmn:informationRequirement>
46+
<dmn:informationRequirement id="_C3B1AE2A-845E-4ECE-8BDB-BCEF289F778B">
47+
<dmn:requiredInput href="#_B722FDDE-1413-4731-82EC-5B49261E3D79"/>
48+
</dmn:informationRequirement>
49+
<dmn:knowledgeRequirement id="_041CFF33-AE14-4D19-89D5-A0F7C18EC227">
50+
<dmn:requiredKnowledge href="https://kie.apache.org/dmn/_81D401A8-CA81-4F9A-ABCC-532C25768708#_1919D943-09A4-4D5C-98A0-2B8377862E4C"/>
51+
</dmn:knowledgeRequirement>
52+
<dmn:context id="_C560A975-EACF-4A78-BF08-B4FBFEA471F1">
53+
<dmn:contextEntry>
54+
<dmn:variable id="_B735F297-2C49-4509-B412-5FED1DF65560" name="dateOfBirth" typeRef="boolean"/>
55+
<dmn:literalExpression id="_CB89C8C7-F4D0-4877-9B6A-8DFDFA996508">
56+
<dmn:text>situation.people[id = parameters.personId].dateOfBirth[1]</dmn:text>
57+
</dmn:literalExpression>
58+
</dmn:contextEntry>
59+
<dmn:contextEntry>
60+
<dmn:variable id="_4C114FA3-6647-4F5F-8974-69B3F3497E1A" name="age" typeRef="boolean"/>
61+
<dmn:literalExpression id="_E266DABA-8F13-4B06-858E-E18C9D43882B">
62+
<dmn:text>Age.as of date(dateOfBirth, parameters.asOfDate)</dmn:text>
63+
</dmn:literalExpression>
64+
</dmn:contextEntry>
65+
<dmn:contextEntry>
66+
<dmn:variable id="_33A0AEB7-F0A7-4144-A9DE-594402406832" name="result" typeRef="boolean"/>
67+
<dmn:literalExpression id="_C9DD224E-A946-4361-88CE-986A1502E34B">
68+
<dmn:text>age &lt;= parameters.maxAge</dmn:text>
69+
</dmn:literalExpression>
70+
</dmn:contextEntry>
71+
<dmn:contextEntry>
72+
<dmn:literalExpression id="_535A5CCD-B352-4D82-82EE-F344E5BD9279">
73+
<dmn:text>result</dmn:text>
74+
</dmn:literalExpression>
75+
</dmn:contextEntry>
76+
</dmn:context>
77+
</dmn:decision>
78+
<dmn:inputData id="_B722FDDE-1413-4731-82EC-5B49261E3D79" name="situation">
79+
<dmn:extensionElements/>
80+
<dmn:variable id="_07C9312E-B180-4C09-BFB5-E5726ACF89D8" name="situation" typeRef="BDT.tSituation"/>
81+
</dmn:inputData>
82+
<dmn:inputData id="_0504B4EF-D5C1-44D2-9CF5-DDFDD6A7C097" name="parameters">
83+
<dmn:extensionElements/>
84+
<dmn:variable id="_8D7739A5-25DF-4C0A-8E3E-E8B9B51711FB" name="parameters" typeRef="tParameters"/>
85+
</dmn:inputData>
86+
<dmndi:DMNDI>
87+
<dmndi:DMNDiagram id="_91EE0ED0-F2A9-488E-A8DA-F54F4ED93805" name="DRG">
88+
<di:extension>
89+
<kie:ComponentsWidthsExtension>
90+
<kie:ComponentWidths dmnElementRef="_C560A975-EACF-4A78-BF08-B4FBFEA471F1">
91+
<kie:width>50</kie:width>
92+
<kie:width>120</kie:width>
93+
<kie:width>523</kie:width>
94+
</kie:ComponentWidths>
95+
<kie:ComponentWidths dmnElementRef="_CB89C8C7-F4D0-4877-9B6A-8DFDFA996508">
96+
<kie:width>523</kie:width>
97+
</kie:ComponentWidths>
98+
<kie:ComponentWidths dmnElementRef="_E266DABA-8F13-4B06-858E-E18C9D43882B">
99+
<kie:width>523</kie:width>
100+
</kie:ComponentWidths>
101+
<kie:ComponentWidths dmnElementRef="_C9DD224E-A946-4361-88CE-986A1502E34B">
102+
<kie:width>523</kie:width>
103+
</kie:ComponentWidths>
104+
<kie:ComponentWidths dmnElementRef="_535A5CCD-B352-4D82-82EE-F344E5BD9279">
105+
<kie:width>523</kie:width>
106+
</kie:ComponentWidths>
107+
</kie:ComponentsWidthsExtension>
108+
</di:extension>
109+
<dmndi:DMNShape id="dmnshape-drg-_50AFC26A-F5B6-498A-B58F-BDC38F8BE4C9" dmnElementRef="_50AFC26A-F5B6-498A-B58F-BDC38F8BE4C9" isCollapsed="false">
110+
<dmndi:DMNStyle>
111+
<dmndi:FillColor red="255" green="255" blue="255"/>
112+
<dmndi:StrokeColor red="0" green="0" blue="0"/>
113+
<dmndi:FontColor red="0" green="0" blue="0"/>
114+
</dmndi:DMNStyle>
115+
<dc:Bounds x="248" y="107" width="283" height="201"/>
116+
<dmndi:DMNLabel/>
117+
<dmndi:DMNDecisionServiceDividerLine>
118+
<di:waypoint x="248" y="207"/>
119+
<di:waypoint x="531" y="207"/>
120+
</dmndi:DMNDecisionServiceDividerLine>
121+
</dmndi:DMNShape>
122+
<dmndi:DMNShape id="dmnshape-drg-_590F4D25-088E-44C2-B687-42994AA8EDFE" dmnElementRef="_590F4D25-088E-44C2-B687-42994AA8EDFE" isCollapsed="false">
123+
<dmndi:DMNStyle>
124+
<dmndi:FillColor red="255" green="255" blue="255"/>
125+
<dmndi:StrokeColor red="0" green="0" blue="0"/>
126+
<dmndi:FontColor red="0" green="0" blue="0"/>
127+
</dmndi:DMNStyle>
128+
<dc:Bounds x="340" y="148" width="100" height="50"/>
129+
<dmndi:DMNLabel/>
130+
</dmndi:DMNShape>
131+
<dmndi:DMNShape id="dmnshape-drg-_B722FDDE-1413-4731-82EC-5B49261E3D79" dmnElementRef="_B722FDDE-1413-4731-82EC-5B49261E3D79" isCollapsed="false">
132+
<dmndi:DMNStyle>
133+
<dmndi:FillColor red="255" green="255" blue="255"/>
134+
<dmndi:StrokeColor red="0" green="0" blue="0"/>
135+
<dmndi:FontColor red="0" green="0" blue="0"/>
136+
</dmndi:DMNStyle>
137+
<dc:Bounds x="269" y="383" width="100" height="50"/>
138+
<dmndi:DMNLabel/>
139+
</dmndi:DMNShape>
140+
<dmndi:DMNShape id="dmnshape-drg-_0504B4EF-D5C1-44D2-9CF5-DDFDD6A7C097" dmnElementRef="_0504B4EF-D5C1-44D2-9CF5-DDFDD6A7C097" isCollapsed="false">
141+
<dmndi:DMNStyle>
142+
<dmndi:FillColor red="255" green="255" blue="255"/>
143+
<dmndi:StrokeColor red="0" green="0" blue="0"/>
144+
<dmndi:FontColor red="0" green="0" blue="0"/>
145+
</dmndi:DMNStyle>
146+
<dc:Bounds x="419" y="383" width="100" height="50"/>
147+
<dmndi:DMNLabel/>
148+
</dmndi:DMNShape>
149+
<dmndi:DMNShape id="dmnshape-drg-_1919D943-09A4-4D5C-98A0-2B8377862E4C" dmnElementRef="included2:_1919D943-09A4-4D5C-98A0-2B8377862E4C" isCollapsed="false">
150+
<dmndi:DMNStyle>
151+
<dmndi:FillColor red="255" green="255" blue="255"/>
152+
<dmndi:StrokeColor red="0" green="0" blue="0"/>
153+
<dmndi:FontColor red="0" green="0" blue="0"/>
154+
</dmndi:DMNStyle>
155+
<dc:Bounds x="97" y="161" width="100" height="50"/>
156+
<dmndi:DMNLabel/>
157+
</dmndi:DMNShape>
158+
<dmndi:DMNEdge id="dmnedge-drg-_AA093E8F-6D25-46E9-8EF3-F20052C8D666-AUTO-TARGET" dmnElementRef="_AA093E8F-6D25-46E9-8EF3-F20052C8D666">
159+
<di:waypoint x="469" y="408"/>
160+
<di:waypoint x="390" y="198"/>
161+
</dmndi:DMNEdge>
162+
<dmndi:DMNEdge id="dmnedge-drg-_C3B1AE2A-845E-4ECE-8BDB-BCEF289F778B-AUTO-TARGET" dmnElementRef="_C3B1AE2A-845E-4ECE-8BDB-BCEF289F778B">
163+
<di:waypoint x="319" y="408"/>
164+
<di:waypoint x="390" y="198"/>
165+
</dmndi:DMNEdge>
166+
<dmndi:DMNEdge id="dmnedge-drg-_041CFF33-AE14-4D19-89D5-A0F7C18EC227-AUTO-TARGET" dmnElementRef="_041CFF33-AE14-4D19-89D5-A0F7C18EC227">
167+
<di:waypoint x="147" y="186"/>
168+
<di:waypoint x="390" y="148"/>
169+
</dmndi:DMNEdge>
170+
</dmndi:DMNDiagram>
171+
</dmndi:DMNDI>
172+
</dmn:definitions>
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
meta {
2+
name: age is below max age
3+
type: http
4+
seq: 1
5+
}
6+
7+
post {
8+
url: {{host}}/checks/age/person-max-age
9+
body: json
10+
auth: inherit
11+
}
12+
13+
body:json {
14+
{
15+
"situation": {
16+
"people": [
17+
{
18+
"id": "p1",
19+
"dateOfBirth": "2025-01-01"
20+
}
21+
]
22+
},
23+
"parameters": {
24+
"personId": "p1",
25+
"asOfDate": "2025-12-31",
26+
"maxAge": 5
27+
}
28+
}
29+
}
30+
31+
assert {
32+
res.body.checkResult: eq true
33+
}
34+
35+
settings {
36+
encodeUrl: true
37+
timeout: 0
38+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
meta {
2+
name: PersonMaxAge
3+
seq: 2
4+
}
5+
6+
auth {
7+
mode: inherit
8+
}

0 commit comments

Comments
 (0)