Skip to content

Commit

Permalink
WIP: Save mapping uuid -> id, tell Ultimo the id instead of uuid. Nee…
Browse files Browse the repository at this point in the history
…d to transform this back when Ultimo replies.
  • Loading branch information
maartendekeizer committed Aug 1, 2024
1 parent b30e2ae commit bcbe0a9
Show file tree
Hide file tree
Showing 5 changed files with 106 additions and 5 deletions.
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 @@ -26,10 +26,19 @@
<Param name="Authorization" xpathExpression="concat('Token ', $MorCoreToken)">
<Param name="MorCoreToken" sessionKey="MorCoreToken" xpathExpression="//token" />
</Param>
<Forward name="success" path="Json2Xml" />
<Forward name="success" path="SaveUuidIdMapping" />
<Forward name="exception" path="CallMSBSender" />
</SenderPipe>

<SenderPipe name="SaveUuidIdMapping">
<IbisLocalSender javaListener="Internal_SaveIdByUuid">
<!-- TODO: klopt deze mapping? -->
<Param name="Uuid" xpathExpression="//uuid" type="STRING" />
<Param name="Id" xpathExpression="//id" type="INTEGER" />
</IbisLocalSender>
<Forward name="success" path="Json2Xml" />
</SenderPipe>

<SenderPipe name="CallMSBSender">
<IbisLocalSender name="CallMSBSender" javaListener="MSB_GetMelding" />
<Forward name="success" path="Json2Xml" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
<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_SaveIdByUuid">
<Receiver name="Internal_SaveIdByUuid">
<JavaListener name="Internal_SaveIdByUuid" />
</Receiver>

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

<SenderPipe name="SaveUuidIdMapping">
<FixedQuerySender
name="SaveUuidIdMapping"
query="INSERT INTO UUIDIDMAP (id, uuid) VALUES (?{Id}, ?{Uuid})"
queryType="OTHER"> <!-- TODO: save for sql injection? -->
<Param name="Id" sessionKey="Id" />
<Param name="Uuid" sessionKey="Uuid" />
</FixedQuerySender>
</SenderPipe>
</Pipeline>
</Adapter>

</Module>
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,14 @@
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)"/>
</createTable>
</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

0 comments on commit bcbe0a9

Please sign in to comment.