Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Introduce UUID database #15

Merged
merged 11 commits into from
Aug 8, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<!ENTITY FromUltimo SYSTEM "./Configuration_FromUltimo.xml">
<!ENTITY ToMSB SYSTEM "./Configuration_ToMSB.xml">
<!ENTITY TokenManager SYSTEM "./Configuration_TokenManager.xml">
<!ENTITY UuidIdMapper SYSTEM "./Configuration_UuidIdMapper.xml">
]>

<Configuration name="morcoreMessageProcessor">
Expand All @@ -14,4 +15,5 @@
&FromUltimo;
&ToMSB;
&TokenManager;
&UuidIdMapper;
</Configuration>
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,11 @@
</JavascriptSender>
</SenderPipe>

<SenderPipe name="SendToUltimo">
<SenderPipe name="StoreUuidIdMapping" getInputFromSessionKey="meldingInfo">
<IbisLocalSender javaListener="Internal_StoreUuidIdMapping"/>
</SenderPipe>

<SenderPipe name="SendToUltimo" getInputFromSessionKey="jsonMessage">
<HttpSender name="SendToUltimo" methodType="POST" contentType="application/json"
headersParams="ApiKey,ApplicationElementId,Accept-Crs,Content-Crs">
<Param name="Accept-Crs" value="EPSG:4326" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
<Module xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../FrankConfig.xsd">

<Adapter name="Internal_GetUuidById">
<Receiver name="Internal_GetUuidById">
<JavaListener name="Internal_GetUuidById" />
</Receiver>

<Pipeline>
<Exits>
<Exit name="Exit" state="SUCCESS" />
<Exit name="Reject" state="REJECTED" />
<Exit name="Exception" state="ERROR" />
</Exits>

<SenderPipe name="RetrieveUuid">
<FixedQuerySender
name="RetrieveUuid"
query="SELECT uuid FROM UUIDIDMAP WHERE id = ?{Id}"
queryType="SELECT"> <!-- TODO: save for sql injection? -->
<Param name="Id" sessionKey="Id" />
</FixedQuerySender>
</SenderPipe>

<XsltPipe name="GetUuidValue" xpathExpression="//row[1]/field[1]" />

<Text2XmlPipe xmlTag="uuid" name="Text2Xml" />

</Pipeline>
</Adapter>

<Adapter name="Internal_GetIdByUuid">
<Receiver name="Internal_GetIdByUuid">
<JavaListener name="Internal_GetIdByUuid" />
</Receiver>

<Pipeline>
<Exits>
<Exit name="Exit" state="SUCCESS" />
<Exit name="Reject" state="REJECTED" />
<Exit name="Exception" state="ERROR" />
</Exits>

<SenderPipe name="RetrieveId">
<FixedQuerySender
name="RetrieveId"
query="SELECT id FROM UUIDIDMAP WHERE uuid = ?{Uuid}"
queryType="SELECT"> <!-- TODO: save for sql injection? -->
<Param name="Uuid" sessionKey="Uuid" />
</FixedQuerySender>
</SenderPipe>

<XsltPipe name="GetIdValue" xpathExpression="//row[1]/field[1]" />

<Text2XmlPipe xmlTag="id" name="Text2Xml" />

</Pipeline>
</Adapter>

<Adapter name="Internal_StoreUuidIdMapping">
<Receiver name="Internal_StoreUuidIdMapping">
<JavaListener name="Internal_StoreUuidIdMapping" />
</Receiver>

<Pipeline>
<Exits>
<Exit name="Exit" state="SUCCESS" />
<Exit name="Reject" state="REJECTED" />
<Exit name="Exception" state="ERROR" />
</Exits>

<SenderPipe name="GetUuidIdMapping" >
<FixedQuerySender
name="GetUuidIdMapping"
query="SELECT * FROM UUIDIDMAP WHERE UUID = ?{Uuid} OR ID = ?{Id}"
queryType="SELECT">
<Param name="Id" xpathExpression="/root/id" type="INTEGER"/>
<Param name="Uuid" xpathExpression="/root/uuid" type="STRING" />
</FixedQuerySender>
</SenderPipe>

<XmlIfPipe name="IfResultCount0" xpathExpression="count(//row) > 0">
<Forward name="then" path="RecordAlreadyExists" />
<Forward name="else" path="StoreUuidIdMapping" />
</XmlIfPipe>

<SenderPipe name="StoreUuidIdMapping" getInputFromSessionKey="originalMessage">
<FixedQuerySender
name="StoreUuidIdMapping"
query="INSERT INTO UUIDIDMAP (id, uuid) VALUES (?{Id}, ?{Uuid})"
queryType="OTHER">
<Param name="Id" xpathExpression="/root/id" type="INTEGER"/>
<Param name="Uuid" xpathExpression="/root/uuid" type="STRING" />
</FixedQuerySender>
<Forward name="success" path="Exit" />
<Forward name="exception" path="Exception" />
</SenderPipe>

<FixedResultPipe name="RecordAlreadyExists" returnString="&lt;result>Record already exists&lt;/result>"/>
</Pipeline>
</Adapter>

</Module>
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,20 @@
http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">
<changeSet id="0" author="Delano">
<createTable tableName="TOKENSTORE">
<column name="id" type="int"/>
<column name="id" type="int"/>
<column name="token" type="varchar(255)"/>
</createTable>
</changeSet>
<changeSet id="1" author="Maarten">
<createTable tableName="UUIDIDMAP">
<column name="id" type="int"/>
<column name="uuid" type="varchar(255)">
<constraints primaryKey="true" nullable="false" primaryKeyName="PK_UUIDIDMAP" />
</column>
</createTable>

<addUniqueConstraint columnNames="id"
constraintName="UK_UUIDIDMAP_ID"
tableName="UUIDIDMAP"/>
</changeSet>
</databaseChangeLog>
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<root>
<!-- Consists of 7 numbers, required -->
<meldingId>
<xsl:value-of select="$meldingInfo/root/uuid" />
<xsl:value-of select="$meldingInfo/root/id" />
</meldingId>
<!-- Required -->
<behandelaar>MSB</behandelaar>
Expand All @@ -35,7 +35,7 @@
<adres>
<xsl:value-of
select="concat(
$meldingInfo/root/signalen_voor_melding/locaties_voor_signaal/postcode , ' ',
$meldingInfo/root/signalen_voor_melding/locaties_voor_signaal/postcode , ' ',
$meldingInfo/root/signalen_voor_melding/locaties_voor_signaal/huisnummer)" />
</adres>
<plaatsbepaling>
Expand All @@ -57,7 +57,7 @@
<xsl:value-of
select="$meldingInfo/root/signalen_voor_melding/locaties_voor_signaal/geometrie/coordinates[1]" />
</y>

<!-- These 4 values might come from GetMeldingInfo -->
<foto1></foto1>
<foto1_filename></foto1_filename>
Expand Down
2 changes: 1 addition & 1 deletion src/test/testtool/scenario01/UltimoPostZaakRequest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"meldingId": "123456",
"meldingId": "1234",
"behandelaar": "MSB",
"afdeling": "",
"opmerkingBehandelaar": "",
Expand Down
Loading