@Test public void testTransformJsonPayloadToTemplate() { String newTemplateId = PayloadToTemplateConverter.transformPayloadToTemplate( WebHookPayloadJson.FORMAT_SHORT_NAME, null); assertEquals(LegacyJsonWebHookTemplate.TEMPLATE_ID, newTemplateId); }
public static String transformPayloadToTemplate(String formatId, String templateId) { if (Objects.isNull(templateId) || "none".equalsIgnoreCase(templateId)) { if (WebHookPayloadXml.FORMAT_SHORT_NAME.equalsIgnoreCase(formatId)) { return LegacyXmlWebHookTemplate.TEMPLATE_ID; } if (WebHookPayloadEmpty.FORMAT_SHORT_NAME.equalsIgnoreCase(formatId)) { return LegacyEmptyWebHookTemplate.TEMPLATE_ID; } if (WebHookPayloadJson.FORMAT_SHORT_NAME.equalsIgnoreCase(formatId)) { return LegacyJsonWebHookTemplate.TEMPLATE_ID; } if (WebHookPayloadTailoredJson.FORMAT_SHORT_NAME.equalsIgnoreCase(formatId)) { return LegacyTailoredJsonWebHookTemplate.TEMPLATE_ID; } return LegacyNameValuePairsWebHookTemplate.TEMPLATE_ID; } return templateId; }
PayloadToTemplateConverter { public static String transformPayloadToTemplate(String formatId, String templateId) { if (Objects.isNull(templateId) || "none".equalsIgnoreCase(templateId)) { if (WebHookPayloadXml.FORMAT_SHORT_NAME.equalsIgnoreCase(formatId)) { return LegacyXmlWebHookTemplate.TEMPLATE_ID; } if (WebHookPayloadEmpty.FORMAT_SHORT_NAME.equalsIgnoreCase(formatId)) { return LegacyEmptyWebHookTemplate.TEMPLATE_ID; } if (WebHookPayloadJson.FORMAT_SHORT_NAME.equalsIgnoreCase(formatId)) { return LegacyJsonWebHookTemplate.TEMPLATE_ID; } if (WebHookPayloadTailoredJson.FORMAT_SHORT_NAME.equalsIgnoreCase(formatId)) { return LegacyTailoredJsonWebHookTemplate.TEMPLATE_ID; } return LegacyNameValuePairsWebHookTemplate.TEMPLATE_ID; } return templateId; } }
PayloadToTemplateConverter { public static String transformPayloadToTemplate(String formatId, String templateId) { if (Objects.isNull(templateId) || "none".equalsIgnoreCase(templateId)) { if (WebHookPayloadXml.FORMAT_SHORT_NAME.equalsIgnoreCase(formatId)) { return LegacyXmlWebHookTemplate.TEMPLATE_ID; } if (WebHookPayloadEmpty.FORMAT_SHORT_NAME.equalsIgnoreCase(formatId)) { return LegacyEmptyWebHookTemplate.TEMPLATE_ID; } if (WebHookPayloadJson.FORMAT_SHORT_NAME.equalsIgnoreCase(formatId)) { return LegacyJsonWebHookTemplate.TEMPLATE_ID; } if (WebHookPayloadTailoredJson.FORMAT_SHORT_NAME.equalsIgnoreCase(formatId)) { return LegacyTailoredJsonWebHookTemplate.TEMPLATE_ID; } return LegacyNameValuePairsWebHookTemplate.TEMPLATE_ID; } return templateId; } private  PayloadToTemplateConverter(); }
PayloadToTemplateConverter { public static String transformPayloadToTemplate(String formatId, String templateId) { if (Objects.isNull(templateId) || "none".equalsIgnoreCase(templateId)) { if (WebHookPayloadXml.FORMAT_SHORT_NAME.equalsIgnoreCase(formatId)) { return LegacyXmlWebHookTemplate.TEMPLATE_ID; } if (WebHookPayloadEmpty.FORMAT_SHORT_NAME.equalsIgnoreCase(formatId)) { return LegacyEmptyWebHookTemplate.TEMPLATE_ID; } if (WebHookPayloadJson.FORMAT_SHORT_NAME.equalsIgnoreCase(formatId)) { return LegacyJsonWebHookTemplate.TEMPLATE_ID; } if (WebHookPayloadTailoredJson.FORMAT_SHORT_NAME.equalsIgnoreCase(formatId)) { return LegacyTailoredJsonWebHookTemplate.TEMPLATE_ID; } return LegacyNameValuePairsWebHookTemplate.TEMPLATE_ID; } return templateId; } private  PayloadToTemplateConverter(); static String transformPayloadToTemplate(String formatId, String templateId); }
PayloadToTemplateConverter { public static String transformPayloadToTemplate(String formatId, String templateId) { if (Objects.isNull(templateId) || "none".equalsIgnoreCase(templateId)) { if (WebHookPayloadXml.FORMAT_SHORT_NAME.equalsIgnoreCase(formatId)) { return LegacyXmlWebHookTemplate.TEMPLATE_ID; } if (WebHookPayloadEmpty.FORMAT_SHORT_NAME.equalsIgnoreCase(formatId)) { return LegacyEmptyWebHookTemplate.TEMPLATE_ID; } if (WebHookPayloadJson.FORMAT_SHORT_NAME.equalsIgnoreCase(formatId)) { return LegacyJsonWebHookTemplate.TEMPLATE_ID; } if (WebHookPayloadTailoredJson.FORMAT_SHORT_NAME.equalsIgnoreCase(formatId)) { return LegacyTailoredJsonWebHookTemplate.TEMPLATE_ID; } return LegacyNameValuePairsWebHookTemplate.TEMPLATE_ID; } return templateId; } private  PayloadToTemplateConverter(); static String transformPayloadToTemplate(String formatId, String templateId);  }