ARAI#36469: Koppeling Facilitor - Marlin

svn path=/Website/branches/v2016.1/; revision=29391
This commit is contained in:
Marcel Bourseau
2016-05-12 15:10:47 +00:00
parent 82355702fc
commit 23e4325aa9
2 changed files with 149 additions and 0 deletions

View File

@@ -0,0 +1,92 @@
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxml="urn:schemas-microsoft-com:xslt" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" version="1.0">
<xsl:output method="xml" indent="yes" encoding="utf-8"/>
<xsl:decimal-format name="european" decimal-separator="." grouping-separator=","/>
<xsl:param name="mode"/>
<xsl:variable name="Rev">
<!-- Revision van deze cust.xsl -->
<xsl:value-of select="substring(translate('$Revision$', '$ ', ''), 10)"/>
</xsl:variable>
<xsl:template match="opdracht">
<xsl:choose>
<xsl:when test="@type='response'">
<!-- ******************************************************************* -->
<!-- ***** RESPONSE naar LEVERANCIER nav. opdracht-insert/update -->
<!-- ***** => toevoegen envelop! -->
<!-- ******************************************************************* -->
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<facilitor>
<xsl:element name="opdracht">
<xsl:attribute name="key"><xsl:value-of select="@key"/></xsl:attribute>
<xsl:attribute name="type"><xsl:value-of select="@type"/></xsl:attribute>
<returncode><xsl:value-of select="returncode"/></returncode>
<returntekst><xsl:value-of select="returntekst"/></returntekst>
<datum><xsl:value-of select="datum"/></datum>
</xsl:element>
</facilitor>
</soap:Body>
</soap:Envelope>
</xsl:when>
<xsl:otherwise>
<!-- ******************************************************************* -->
<!-- ***** INSERT/UPDATE door LEVERANCIER -->
<!-- ***** => UPDATE 1-op-1 door! -->
<!-- ******************************************************************* -->
<!-- remove element prefix -->
<xsl:element name="{local-name()}">
<!-- process attributes -->
<xsl:for-each select="@*">
<!-- remove attribute prefix and 'IBA' from key-attribute! -->
<xsl:attribute name="{local-name()}">
<xsl:choose><xsl:when test="local-name()='key'"><xsl:value-of select="translate(., 'IBA', '')"/></xsl:when><xsl:otherwise><xsl:value-of select="."/></xsl:otherwise></xsl:choose>
</xsl:attribute>
</xsl:for-each>
<xsl:apply-templates/>
</xsl:element>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="facilitor">
<xsl:apply-templates select="opdracht"/>
</xsl:template>
<!--xsl:template match="soap:Body">
<xsl:apply-templates select="facilitor"/>
</xsl:template>
<xsl:template match="soap:Envelope">
<xsl:apply-templates select="soap:Body"/>
</xsl:template-->
<!-- Root -->
<xsl:template match="*">
<xsl:choose>
<!-- Zonder prefix en facilitor-node, dan -->
<!-- als response: toevoegen envelop! -->
<!-- als update: 1-op-1 door! -->
<xsl:when test="substring-before(name(),concat(':', local-name()))='' and local-name()='facilitor'">
<xsl:apply-templates select="facilitor"/>
</xsl:when>
<!--xsl:when test="local-name()='Envelope'">
<xsl:apply-templates select="soap:Envelope"/>
</xsl:when-->
<!-- Met prefix, dus insert/update: prefix weg + evt. velden "injecteren"! -->
<xsl:otherwise>
<!-- remove element prefix -->
<xsl:element name="{local-name()}">
<!-- process attributes -->
<xsl:for-each select="@*">
<!-- remove attribute prefix and 'IBA' from key-attribute! -->
<xsl:attribute name="{local-name()}">
<xsl:choose><xsl:when test="local-name()='key'"><xsl:value-of select="translate(., 'IBA', '')"/></xsl:when><xsl:otherwise><xsl:value-of select="."/></xsl:otherwise></xsl:choose>
</xsl:attribute>
</xsl:for-each>
<xsl:apply-templates/>
</xsl:element>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>

57
CUST/ARAI/xsl/marlin.xsl Normal file
View File

@@ -0,0 +1,57 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.pcamobile.com/marlin">
<xsl:output method="xml" indent="yes" encoding="UTF-8"/>
<xsl:decimal-format name="european" decimal-separator="." grouping-separator=","/>
<xsl:param name="mode"/>
<xsl:template match="opdracht">
<RqOutboundMessage>
<Header>
<Version>1.0</Version>
<CompanyID>{bc24439d-427b-4e69-95f2-1f76c2b2539a}</CompanyID>
<MessageID>{bc24439d-427b-4e69-95f2-1f76c2b2539a}</MessageID>
<MessageType>RqScheduleTask</MessageType>
<TestMessage>0</TestMessage>
</Header>
<!-- You have a CHOICE of the next 66 items at this level -->
<RqScheduleTask>
<ScheduleTask>
<!-- 1 or more repetitions: -->
<Task>
<ExternalTaskID><xsl:value-of select="key"/></ExternalTaskID>
<ReferenceID><xsl:value-of select="melding/stdmelding/discipline/srtdiscipline/prefix"/><xsl:value-of select="melding/key"/>/<xsl:value-of select="bedrijfopdr_volgnr"/></ReferenceID>
<Description><xsl:value-of select="omschrijving"/></Description>
<LabelDescription><xsl:value-of select="substring(normalize-space(melding/stdmelding/omschrijving),1,100)"/></LabelDescription>
<!-- Optional: -->
<StartDate><xsl:value-of select="substring(datumbegin/utcdatum,1,4)"/>-<xsl:value-of select="substring(datumbegin/utcdatum,5,2)"/>-<xsl:value-of select="substring(datumbegin/utcdatum,7,2)"/>T<xsl:value-of select="substring(datumbegin/utctijd,1,2)"/>:<xsl:value-of select="substring(datumbegin/utctijd,3,2)"/>:00Z</StartDate>
<FinishDate><xsl:value-of select="substring(einddatum/utcdatum,1,4)"/>-<xsl:value-of select="substring(einddatum/utcdatum,5,2)"/>-<xsl:value-of select="substring(einddatum/utcdatum,7,2)"/>T<xsl:value-of select="substring(einddatum/utctijd,1,2)"/>:<xsl:value-of select="substring(einddatum/utctijd,3,2)"/>:00Z</FinishDate>
<Duration>PT120M</Duration>
<CallIntaker><xsl:value-of select="substring(backoffice_contact/naam_full,1,100)"/></CallIntaker>
</Task>
</ScheduleTask>
</RqScheduleTask>
</RqOutboundMessage>
</xsl:template>
<!-- Maken 'bon' (XML) -->
<xsl:template match="facilitor">
<xsl:apply-templates select="opdracht"/>
</xsl:template>
<!-- Root -->
<xsl:template match="/">
<xsl:choose>
<xsl:when test="$mode='getExtension'">
<xsl:element name="format">
<xsl:element name="extension">xml</xsl:element>
</xsl:element>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="facilitor"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>