Files
reflex-wms-connector/RFXtoRP_PlatformLogCreate.ftl
Nathan SOULIER 999ab0ebb6 SCPN1-11065
(cherry picked from commit c37727e00069589973880dc6d0e03b31f182d38e)

Co-authored-by: Laurie Montant <laurie.montant@hardis-group.com>
2026-07-20 15:06:32 +00:00

51 lines
1.7 KiB
Java

<#include "HfRpConfig.ftl">
[
<#assign UUID = UUID.randomUUID()>
<#assign strJsonBody = JsonUtil.espaceQuoteInJsonString(restResponseBody)?replace("\n", "")?replace("\r", "")>
<#assign maxLen = 32000>
<#if strJsonBody?length gt maxLen>
<#assign strJsonBody = JsonUtil.espaceQuoteInJsonString(restResponseBody)?replace("\n", "")?replace("\r", "")?replace('"logical_key_list"\\s*:\\s*\\[[^\\]]*\\]', '"logical_key_list": []', 'r')>
</#if>
<#if strJsonBody?length gt maxLen>
<#assign safeJsonBody = "{\"truncated\": true, \"original_size\": " + strJsonBody?length + "}">
<#else>
<#assign safeJsonBody = strJsonBody>
</#if>
{
"Header": {
"ProjectID": "${projectRP}"
},
"ID": {
"RefID": "${UUID}",
"RefDate": {
"DateTime": "${aDateTime?iso_utc}",
"AuthorTimeZone": "${time_zone_rfx}"
}
},
"Payload": {
<#assign severity = SeverityLevel.ERROR>
"Severity": "${severity}",
"Namespace": "ReflexIntegration",
"DateTime": {
"DateTime": "${aDateTime?iso_utc}",
"AuthorTimeZone": "${time_zone_rfx}"
},
"TechMessage": {
"Code": "${restResponsetMsg.status!"no Code"}",
"Label": "${safeJsonBody?json_string}"
},
"UserMessage": {
"Code": "${restResponsetMsg.status!"no Code"}",
"Label": "${safeJsonBody?json_string}",
"Params": []
},
"DetailElements": [],
"CorrelationID": "${id.correlationid!"no Correlationid"}",
"ContextPayload": "${safeJsonBody?json_string}",
"Type": "${event}",
"Task": "${id.apiRestReflexID!"no Task"}",
"OriginalID": "${id.refid!"no OriginalID"?trim?json_string}",
"StackTrace": ""
}
}
]