From 8a8c94835c30282e31a315c4d1d6a1b0b742bbe1 Mon Sep 17 00:00:00 2001 From: ptorres-prowide Date: Thu, 21 Dec 2023 17:06:15 -0300 Subject: [PATCH] CU-86aywanzr_Expanded-printout-enhancement-for-fields-50F-and-59F --- CHANGELOG.md | 3 + .../swift/model/field/Field59F.java | 77 +++++++++++++++++++ 2 files changed, 80 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 49004bc89..bd8f8c97a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Prowide Core - CHANGELOG +#### 9.4.14 - SNAPSHOT + * Expanded printout enhancement for field 59F + #### 9.4.13 - November 2023 * (PW-1697) Fixed validation/parse pattern in field 29O * (PW-1697) MT306 changes in field 30I diff --git a/src/generated/java/com/prowidesoftware/swift/model/field/Field59F.java b/src/generated/java/com/prowidesoftware/swift/model/field/Field59F.java index 7df36d03a..a46f7b3c5 100644 --- a/src/generated/java/com/prowidesoftware/swift/model/field/Field59F.java +++ b/src/generated/java/com/prowidesoftware/swift/model/field/Field59F.java @@ -1476,6 +1476,83 @@ public static Field59F fromJson(final String json) { return field; } + /** + * Specific implementation for field 59F using dynamic labels based on line identifiers. + * + *

For component 3 this implementation will return the labels provided by + * {@link #getLabelForLineNumber(String)} while for all other cases it will return the + * default label. + * + *

+ * Also since the party identifier can be an account or a code plus the identifier, + * then for component 1 if the value starts with a slash, this implementation will return + * "Account" as label instead of the generic "Party Identifier". + * + * @param number a component number + * @return english label for the field component + * + * @since 9.4.14 + */ + @Override + public String getComponentLabel(final int number) { + if (number == 1 && StringUtils.startsWith(getComponent1(), "/")) { + return "Account"; + } + if (number == 3 || number == 5 || number == 7) { + String label = getLabelForLineNumber(getComponent(number-1)); + if (label != null) { + return label; + } + } + return super.getComponentLabel(number); + } + + + /** + * Return the line labels based on the structured line number identification as follows: + * + *

+ * + *

This is used in {@link #getComponentLabel(int)} to determine a suitable label dynamically + * based on the line identifiers. For example if the field value is this: + *

+	 * 1/John Smith
+	 * 2/Hoogstrat 6
+	 * 3/BE/Brussel
+	 * 
+ * The components will be parsed as follows: + * + * + *

+ * @param lineIdentifier the line number identifier, 1 to 3 according to the specification. + * @return the line label + * @since 9.4.14 + */ + public String getLabelForLineNumber(String lineIdentifier) { + if (StringUtils.isNumeric(StringUtils.trimToNull(lineIdentifier))) { + int number = Integer.valueOf(lineIdentifier.trim()); + if (number == 1) { + return "Name of Beneficiary Customer"; + } else if (number == 2) { + return "Address Line"; + } else if (number == 3) { + return "Country and Town"; + } + } + return null; + } /** * Get the details (right part of the line) based on the line identification number. * This API is specific for the structured field 59F.