67 lines
2.3 KiB
Java
67 lines
2.3 KiB
Java
<#-- **** input parameters ***** -->
|
|
<#-- input : message RFX -->
|
|
<#-- project : projectId in ReflexPlatform -->
|
|
<#-- organisation : organisationtId in ReflexPlatform -->
|
|
<#include "ReflexUtils.ftl">
|
|
<#include "HfRpConfig.ftl">
|
|
<#include "ActorPrefix.ftl">
|
|
|
|
<#assign cloudEventMsg = JsonUtil.jsonToMap(input)>
|
|
<#assign projectRP = project>
|
|
<#assign organisationRP = organisation>
|
|
|
|
<#assign aDateTime = .now>
|
|
|
|
<#switch cloudEventMsg.action>
|
|
<#case "C">
|
|
<#case "U">
|
|
<#-- *********************************************** Action = CREATE or UPDATE ******************** -->
|
|
<#assign dataRfx = JsonUtil.decodeBase64(cloudEventMsg.data) />
|
|
<#assign actor = JsonUtil.jsonToMap(dataRfx)>
|
|
<#assign refID = RFXtoRPprefixConsignee(actor.code?trim?json_string)>
|
|
|
|
<#assign payLoad = '{"Header": {"ProjectID": "${projectRP!""}"},"IDs": [{"RefID": "${refID}"}]}' />
|
|
<#assign queryApiReflexPlatformID = QueryApiReflexPlatformID.ActorGetByIds>
|
|
<#assign response = QueryApiReflexPlatformCall.call(queryApiReflexPlatformID,payLoad) />
|
|
<#assign actorRP = JsonUtil.jsonToMap(response)>
|
|
<#if actorRP?? && actorRP.Objects?? && actorRP.Objects[0]?? && actorRP.Objects[0].ID.RefID?? >
|
|
[
|
|
{
|
|
<#assign apiReflexPlatformID = ApiReflexPlatformID.ActorCreated>
|
|
"apiReflexPlatformID" : "${apiReflexPlatformID}",
|
|
"datas" :
|
|
<#include "RFXtoRP_HsaCons_ActorUpdated.ftl">
|
|
}
|
|
]
|
|
<#else>
|
|
[
|
|
{
|
|
<#assign apiReflexPlatformID = ApiReflexPlatformID.ActorCreated>
|
|
"apiReflexPlatformID" : "${apiReflexPlatformID}",
|
|
"datas" :
|
|
<#include "RFXtoRP_HsaSup_ActorCreated.ftl">
|
|
}
|
|
]
|
|
</#if>
|
|
<#break>
|
|
|
|
<#case "D">
|
|
<#-- *********************************************** Action = DELETE ******************** -->
|
|
<#assign dataRfx = JsonUtil.decodeBase64(cloudEventMsg.data) />
|
|
<#assign actor = JsonUtil.jsonToMap(dataRfx)>
|
|
[
|
|
{
|
|
<#assign apiReflexPlatformID = ApiReflexPlatformID.ActorDeleted>
|
|
"apiReflexPlatformID" : "${apiReflexPlatformID}",
|
|
"datas" :
|
|
<#include "RFXtoRP_HsaSup_ActorDeleted.ftl">
|
|
}
|
|
]
|
|
<#break>
|
|
|
|
|
|
<#default>
|
|
<#stop >
|
|
</#switch>
|
|
|