134 lines
5.4 KiB
Java
134 lines
5.4 KiB
Java
<#-- **** input parameters ***** -->
|
|
<#-- input : message RFX -->
|
|
<#-- project : projectId in ReflexPlatform -->
|
|
<#-- organisation : organisationtId in ReflexPlatform -->
|
|
|
|
<#assign cloudEventMsg = JsonUtil.jsonToMap(input)>
|
|
<#assign projectRP = project>
|
|
<#assign organisationRP = organisation>
|
|
|
|
<#assign aDateTime = .now>
|
|
|
|
<#switch cloudEventMsg.action>
|
|
<#case "C">
|
|
<#-- *********************************************** Action = CREATE ******************** -->
|
|
|
|
<#assign dataRfx = JsonUtil.decodeBase64(cloudEventMsg.data) />
|
|
<#assign receipt = JsonUtil.jsonToMap(dataRfx)>
|
|
<#if receipt.receipt_type = "030">
|
|
[
|
|
{
|
|
<#assign apiReflexPlatformID = ApiReflexPlatformID.ExecutionflowDetected>
|
|
"apiReflexPlatformID" : "${apiReflexPlatformID}",
|
|
"datas" :
|
|
<#include "RFXtoRP_HsrReceiptList_TransfertExecutionflowDetected.ftl">
|
|
|
|
},
|
|
{
|
|
<#assign apiReflexPlatformID = ApiReflexPlatformID.ExecutionflowReceiptExpected>
|
|
"apiReflexPlatformID" : "${apiReflexPlatformID}",
|
|
"datas" :
|
|
<#include "RFXtoRP_HsrReceiptList_TransfertReceiptExpected.ftl">
|
|
|
|
}
|
|
]
|
|
<#else>
|
|
[
|
|
{
|
|
<#assign apiReflexPlatformID = ApiReflexPlatformID.ExecutionflowDetected>
|
|
"apiReflexPlatformID" : "${apiReflexPlatformID}",
|
|
"datas" :
|
|
<#include "RFXtoRP_HsrReceiptList_ExecutionflowDetected.ftl">
|
|
|
|
},
|
|
{
|
|
<#assign apiReflexPlatformID = ApiReflexPlatformID.ExecutionflowReceiptExpected>
|
|
"apiReflexPlatformID" : "${apiReflexPlatformID}",
|
|
"datas" :
|
|
<#include "RFXtoRP_HsrReceiptList_ReceiptExpected.ftl">
|
|
|
|
}
|
|
]
|
|
</#if>
|
|
<#break>
|
|
<#case "U">
|
|
<#-- *********************************************** Action = UPDATE ******************** -->
|
|
<#assign dataRfx = JsonUtil.decodeBase64(cloudEventMsg.data) />
|
|
<#assign receipt = JsonUtil.jsonToMap(dataRfx)>
|
|
[
|
|
<#if receipt.receipt_type == "030" && receipt.receipt_confirmed == "true" && receipt.confirmation_total_level_1==0 && receipt.confirmation_total_level_2==0 && receipt.confirmation_total_level_3==0>
|
|
{
|
|
<#assign apiReflexPlatformID = ApiReflexPlatformID.ExecutionflowCancelled>
|
|
"apiReflexPlatformID" : "${apiReflexPlatformID}",
|
|
"datas" :
|
|
<#include "RFXtoRP_HsrReceiptList_TransfertExecutionflowCancelled.ftl">
|
|
}
|
|
<#else>
|
|
<#if receipt.receipt_type == "030" && receipt.receipt_confirmed == "true">
|
|
{
|
|
<#assign apiReflexPlatformID = ApiReflexPlatformID.ExecutionflowReceiptCompleted>
|
|
"apiReflexPlatformID" : "${apiReflexPlatformID}",
|
|
"datas" :
|
|
<#include "RFXtoRP_HsrReceiptList_TransfertExecutionflowReceiptCompleted.ftl">
|
|
}
|
|
<#else>
|
|
<#if receipt.receipt_confirmed == "true" && receipt.confirmation_total_level_1==0 && receipt.confirmation_total_level_2==0 && receipt.confirmation_total_level_3==0>
|
|
{
|
|
<#assign apiReflexPlatformID = ApiReflexPlatformID.ExecutionflowCancelled>
|
|
"apiReflexPlatformID" : "${apiReflexPlatformID}",
|
|
"datas" :
|
|
<#include "RFXtoRP_HsrReceiptList_ExecutionflowCancelled.ftl">
|
|
}
|
|
<#else>
|
|
<#if receipt.receipt_confirmed == "true" >
|
|
{
|
|
<#assign apiReflexPlatformID = ApiReflexPlatformID.ExecutionflowReceiptCompleted>
|
|
"apiReflexPlatformID" : "${apiReflexPlatformID}",
|
|
"datas" :
|
|
<#include "RFXtoRP_HsrReceiptList_ExecutionflowReceiptCompleted.ftl">
|
|
}
|
|
<#else>
|
|
{
|
|
<#assign apiReflexPlatformID = ApiReflexPlatformID.ExecutionflowDetected>
|
|
"apiReflexPlatformID" : "${apiReflexPlatformID}",
|
|
"datas" :
|
|
<#include "RFXtoRP_HsrReceiptList_ExecutionflowDetected.ftl">
|
|
},
|
|
{
|
|
<#assign apiReflexPlatformID = ApiReflexPlatformID.ExecutionflowReceiptExpected>
|
|
"apiReflexPlatformID" : "${apiReflexPlatformID}",
|
|
"datas" :
|
|
<#include "RFXtoRP_HsrReceiptList_ReceiptExpected.ftl">
|
|
}
|
|
</#if>
|
|
</#if>
|
|
</#if>
|
|
</#if>
|
|
]
|
|
<#break>
|
|
|
|
<#case "D">
|
|
<#-- *********************************************** Action = DELETE ******************** -->
|
|
<#assign dataRfx = JsonUtil.decodeBase64(cloudEventMsg.data) />
|
|
<#assign receipt = JsonUtil.jsonToMap(dataRfx)>
|
|
[
|
|
<#if receipt.receipt_reference?? && receipt.receipt_reference!="">
|
|
{
|
|
|
|
<#assign apiReflexPlatformID = ApiReflexPlatformID.ExecutionflowCancelled>
|
|
"apiReflexPlatformID" : "${apiReflexPlatformID}",
|
|
"datas" :
|
|
<#include "RFXtoRP_HsrReceiptList_ExecutionflowCancelled.ftl">
|
|
}
|
|
<#else>
|
|
<#stop "Receipt reference is empty">
|
|
</#if>
|
|
]
|
|
<#break>
|
|
|
|
|
|
<#default>
|
|
<#stop >
|
|
</#switch>
|
|
|