From 77dbd0167d26945fbe24c3b61f176ec24c651a1f Mon Sep 17 00:00:00 2001 From: Sebastian Zubrinic <sebastian@prowidesoftware.com> Date: Fri, 2 Aug 2024 20:31:55 -0300 Subject: [PATCH] Add support for business application header version head.001.001.04 v10 (#124) --- CHANGELOG.md | 6 +- .../swift/model/mx/AbstractMX.java | 33 +- .../swift/model/mx/AppHdrFactory.java | 49 ++ .../swift/model/mx/AppHdrParser.java | 16 +- .../swift/model/mx/AppHdrType.java | 3 +- .../swift/model/mx/BusinessAppHdrV04.java | 306 ++++++++++++ .../swift/model/mx/MxWriteConfiguration.java | 13 +- .../swift/model/mx/AppHdrParserTest.java | 146 +++++- .../swift/model/mx/MxWriteTest.java | 6 +- .../mx/dic/BusinessApplicationHeader8.java | 415 ++++++++++++++++ .../dic/BusinessApplicationHeaderV04Impl.java | 467 ++++++++++++++++++ .../swift/model/mx/dic/Party51Choice.java | 97 ++++ 12 files changed, 1524 insertions(+), 33 deletions(-) create mode 100644 iso20022-core/src/main/java/com/prowidesoftware/swift/model/mx/BusinessAppHdrV04.java create mode 100644 model-common-types/src/generated/java/com/prowidesoftware/swift/model/mx/dic/BusinessApplicationHeader8.java create mode 100644 model-common-types/src/generated/java/com/prowidesoftware/swift/model/mx/dic/BusinessApplicationHeaderV04Impl.java create mode 100644 model-common-types/src/generated/java/com/prowidesoftware/swift/model/mx/dic/Party51Choice.java diff --git a/CHANGELOG.md b/CHANGELOG.md index a61dd5031..fd0ac53b7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,10 @@ # Prowide ISO 20022 - CHANGELOG -#### 10.2.2 - SNAPSHOT +#### 10.2.2 - August 2024 * (PW-1947) Updated MX model with latest SWIFT SRU2024 schema update, including new messages such as trck.001.001.03 * (PW-1933) Fix backward compatibility issue on DateTime fields when doing JSON to model conversion (thanks @elominp) + * (PW-1875) Fixed the `ZuluDateTimeAdapter` to convert the datetime to UTC offset if needed + * Add support for Business Application Header version head.001.001.04 #### 10.2.1 - June 2024 * Enhanced the AppHdrFactory to honor the business service set in the parameter MxId @@ -11,7 +13,7 @@ #### 10.2.0 - May 2024 * SWIFT Standard release update 2024 (live 16 November 2024) * Yearly revision of deprecation phase (see https://dev.prowidesoftware.com/SRU2024/getting-started/deprecation/) - * Added message categories for File Management (cafm), Fraud Reporting and Disposition (cafm), Network Management (canm) and Settlement Reporting (casr) + * Added message categories for File Management (cafm), Fraud Reporting and Disposition (cafm), Network Management (canm), and Settlement Reporting (casr) * Add support in the MxWriteConfiguration to use standard envelopes for SWIFT and ISO 20022 * Changed the default Document prefix to the message category; "camt", "pacs", etc... * Enhanced MxId with optional and transient businessService field to act as a message type discriminator diff --git a/iso20022-core/src/main/java/com/prowidesoftware/swift/model/mx/AbstractMX.java b/iso20022-core/src/main/java/com/prowidesoftware/swift/model/mx/AbstractMX.java index 2467a6dc5..fab2c524d 100644 --- a/iso20022-core/src/main/java/com/prowidesoftware/swift/model/mx/AbstractMX.java +++ b/iso20022-core/src/main/java/com/prowidesoftware/swift/model/mx/AbstractMX.java @@ -237,8 +237,9 @@ public String message(MxWriteConfiguration conf) { // handle manually at this method level params.includeXMLDeclaration = false; - EnvelopeType envelope = usableConf.envelopeTyoe; - String envelopeElement = envelope == EnvelopeType.CUSTOM ? usableConf.rootElement : envelope.rootElement(); + EnvelopeType envelopeType = usableConf.envelopeType; + String envelopeElement = + envelopeType == EnvelopeType.CUSTOM ? usableConf.rootElement : envelopeType.rootElement(); StringBuilder xml = new StringBuilder(); if (usableConf.includeXMLDeclaration) { @@ -250,35 +251,35 @@ public String message(MxWriteConfiguration conf) { if (header != null) { // open envelope element xml.append("<"); - if (envelope.prefix() != null) { - xml.append(envelope.prefix()).append(":"); + if (envelopeType.prefix() != null) { + xml.append(envelopeType.prefix()).append(":"); } xml.append(envelopeElement); - if (envelope != EnvelopeType.CUSTOM) { + if (envelopeType != EnvelopeType.CUSTOM) { xml.append(" xmlns=\"") - .append(usableConf.envelopeTyoe.namespace()) + .append(usableConf.envelopeType.namespace()) .append("\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""); } xml.append(">\n"); // for ISO envelopes we have to add an extra element wrapping the header - if (envelope.name().startsWith("BME")) { - xml.append("<").append(envelope.prefix()).append(":Hdr>\n"); + if (envelopeType.name().startsWith("BME")) { + xml.append("<").append(envelopeType.prefix()).append(":Hdr>\n"); } // write AppHdr xml.append(header).append("\n"); // for ISO envelopes we have to close the extra element wrapping the header - if (envelope.name().startsWith("BME")) { - xml.append("</").append(envelope.prefix()).append(":Hdr>\n"); + if (envelopeType.name().startsWith("BME")) { + xml.append("</").append(envelopeType.prefix()).append(":Hdr>\n"); } } // for ISO envelopes we have to wrap the Document in an extra element - if (envelope.name().startsWith("BME")) { - xml.append("<").append(envelope.prefix()).append(":Doc>\n"); + if (envelopeType.name().startsWith("BME")) { + xml.append("<").append(envelopeType.prefix()).append(":Doc>\n"); } // write Document @@ -290,15 +291,15 @@ public String message(MxWriteConfiguration conf) { xml.append(document(params)).append("\n"); // for ISO envelopes we have to close the extra element wrapping the Document - if (envelope.name().startsWith("BME")) { - xml.append("</").append(envelope.prefix()).append(":Doc>\n"); + if (envelopeType.name().startsWith("BME")) { + xml.append("</").append(envelopeType.prefix()).append(":Doc>\n"); } if (header != null) { // close the envelope element xml.append("</"); - if (envelope.prefix() != null) { - xml.append(envelope.prefix()).append(":"); + if (envelopeType.prefix() != null) { + xml.append(envelopeType.prefix()).append(":"); } xml.append(envelopeElement).append(">"); } diff --git a/iso20022-core/src/main/java/com/prowidesoftware/swift/model/mx/AppHdrFactory.java b/iso20022-core/src/main/java/com/prowidesoftware/swift/model/mx/AppHdrFactory.java index 3e968c893..910df8f41 100644 --- a/iso20022-core/src/main/java/com/prowidesoftware/swift/model/mx/AppHdrFactory.java +++ b/iso20022-core/src/main/java/com/prowidesoftware/swift/model/mx/AppHdrFactory.java @@ -164,6 +164,53 @@ public static BusinessAppHdrV03 createBusinessAppHdrV03( return h; } + /** + * Convenient method to create a new ISO header version 4, initialized from simple parameters. + * + * <p>All parameters are optional but in order for the header to be valid the sender, receiver and reference must + * be set. Creation date will be set to current time. + * + * @param sender optional sender BIC for the Fr element or null to leave not set + * @param receiver optional receiver BIC for the To element or null to leave not set + * @param reference optional reference for the BizMsgIdr (business message identifier) or null to leave not set + * @param id optional MX identification for the MsgDefIdr (message definition identifier) element or null to leave not set + * @return new header initialized from parameters. + * @since 9.5.3 + */ + public static BusinessAppHdrV04 createBusinessAppHdrV04( + final String sender, final String receiver, final String reference, final MxId id) { + BusinessAppHdrV04 h = new BusinessAppHdrV04(); + + if (sender != null) { + h.setFr(new Party51Choice()); + h.getFr().setFIId(new BranchAndFinancialInstitutionIdentification8()); + h.getFr().getFIId().setFinInstnId(new FinancialInstitutionIdentification23()); + h.getFr().getFIId().getFinInstnId().setBICFI(sender); + } + + if (receiver != null) { + h.setTo(new Party51Choice()); + h.getTo().setFIId(new BranchAndFinancialInstitutionIdentification8()); + h.getTo().getFIId().setFinInstnId(new FinancialInstitutionIdentification23()); + h.getTo().getFIId().getFinInstnId().setBICFI(receiver); + } + + if (reference != null) { + h.setBizMsgIdr(reference); + } + + if (id != null) { + h.setMsgDefIdr(id.id()); + if (id.getBusinessService().isPresent()) { + h.setBizSvc(id.getBusinessService().get()); + } + } + + h.setCreDt(OffsetDateTime.now()); + + return h; + } + /** * Convenient method to create a new legacy SWIFT header, initialized from simple parameters. * @@ -226,6 +273,8 @@ public static AppHdr createAppHdr( return createBusinessAppHdrV02(sender, receiver, reference, id); case BAH_V3: return createBusinessAppHdrV03(sender, receiver, reference, id); + case BAH_V4: + return createBusinessAppHdrV04(sender, receiver, reference, id); default: throw new ProwideException("Don't know how to create header " + type); } diff --git a/iso20022-core/src/main/java/com/prowidesoftware/swift/model/mx/AppHdrParser.java b/iso20022-core/src/main/java/com/prowidesoftware/swift/model/mx/AppHdrParser.java index a67cdf395..ce993eba0 100644 --- a/iso20022-core/src/main/java/com/prowidesoftware/swift/model/mx/AppHdrParser.java +++ b/iso20022-core/src/main/java/com/prowidesoftware/swift/model/mx/AppHdrParser.java @@ -83,6 +83,11 @@ private static AppHdr parseHeaderFromSAXSource( return (LegacyAppHdr) MxParseUtils.parseSAXSource(source, LegacyAppHdr.class, LegacyAppHdr._classes, params); + } else if (StringUtils.equals(BusinessAppHdrV01.NAMESPACE, namespace)) { + // parse BAH version 1 + return (BusinessAppHdrV01) + MxParseUtils.parseSAXSource(source, BusinessAppHdrV01.class, BusinessAppHdrV01._classes, params); + } else if (StringUtils.equals(BusinessAppHdrV02.NAMESPACE, namespace)) { // parse BAH version 2 return (BusinessAppHdrV02) @@ -93,10 +98,15 @@ private static AppHdr parseHeaderFromSAXSource( return (BusinessAppHdrV03) MxParseUtils.parseSAXSource(source, BusinessAppHdrV03.class, BusinessAppHdrV03._classes, params); + } else if (StringUtils.equals(BusinessAppHdrV04.NAMESPACE, namespace)) { + // parse BAH version 4 + return (BusinessAppHdrV04) + MxParseUtils.parseSAXSource(source, BusinessAppHdrV04.class, BusinessAppHdrV04._classes, params); + } else { - // by default try to parse to BAH version 1 - return (BusinessAppHdrV01) - MxParseUtils.parseSAXSource(source, BusinessAppHdrV01.class, BusinessAppHdrV01._classes, params); + // by default try to parse to BAH version 2 (most common version, used by CBPR+) + return (BusinessAppHdrV02) + MxParseUtils.parseSAXSource(source, BusinessAppHdrV02.class, BusinessAppHdrV02._classes, params); } } diff --git a/iso20022-core/src/main/java/com/prowidesoftware/swift/model/mx/AppHdrType.java b/iso20022-core/src/main/java/com/prowidesoftware/swift/model/mx/AppHdrType.java index 6a7155cea..6e29759ea 100644 --- a/iso20022-core/src/main/java/com/prowidesoftware/swift/model/mx/AppHdrType.java +++ b/iso20022-core/src/main/java/com/prowidesoftware/swift/model/mx/AppHdrType.java @@ -24,7 +24,8 @@ public enum AppHdrType { LEGACY(LegacyAppHdr.NAMESPACE, LegacyAppHdr.class), BAH_V1(BusinessAppHdrV01.NAMESPACE, BusinessAppHdrV01.class), BAH_V2(BusinessAppHdrV02.NAMESPACE, BusinessAppHdrV02.class), - BAH_V3(BusinessAppHdrV03.NAMESPACE, BusinessAppHdrV03.class); + BAH_V3(BusinessAppHdrV03.NAMESPACE, BusinessAppHdrV03.class), + BAH_V4(BusinessAppHdrV04.NAMESPACE, BusinessAppHdrV04.class); private String namespace; private Class headerClass; diff --git a/iso20022-core/src/main/java/com/prowidesoftware/swift/model/mx/BusinessAppHdrV04.java b/iso20022-core/src/main/java/com/prowidesoftware/swift/model/mx/BusinessAppHdrV04.java new file mode 100644 index 000000000..30a13cced --- /dev/null +++ b/iso20022-core/src/main/java/com/prowidesoftware/swift/model/mx/BusinessAppHdrV04.java @@ -0,0 +1,306 @@ +/* + * Copyright 2006-2023 Prowide + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.prowidesoftware.swift.model.mx; + +import com.prowidesoftware.ProwideException; +import com.prowidesoftware.deprecation.DeprecationUtils; +import com.prowidesoftware.deprecation.ProwideDeprecated; +import com.prowidesoftware.deprecation.TargetYear; +import com.prowidesoftware.swift.model.mx.dic.BusinessApplicationHeaderV04Impl; +import com.prowidesoftware.swift.model.mx.dic.Party51Choice; +import jakarta.xml.bind.JAXBContext; +import jakarta.xml.bind.JAXBElement; +import jakarta.xml.bind.JAXBException; +import jakarta.xml.bind.Marshaller; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; +import java.io.StringWriter; +import java.time.OffsetDateTime; +import java.time.ZoneOffset; +import java.util.Arrays; +import java.util.Objects; +import java.util.logging.Level; +import java.util.logging.Logger; +import javax.xml.namespace.QName; +import javax.xml.transform.dom.DOMResult; +import org.apache.commons.lang3.StringUtils; +import org.w3c.dom.Document; +import org.w3c.dom.Element; + +/** + * ISO 20022 business application header version 4 usually known by its namespace head.001.001.04 + * + * @since 9.5.3 + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "AppHdr") +@XmlRootElement(name = "AppHdr", namespace = "urn:iso:std:iso:20022:tech:xsd:head.001.001.04") +public class BusinessAppHdrV04 extends BusinessApplicationHeaderV04Impl implements AppHdr { + public static final String NAMESPACE = "urn:iso:std:iso:20022:tech:xsd:head.001.001.04"; + static final Class[] _classes; + private static final Logger log = Logger.getLogger(BusinessAppHdrV04.class.getName()); + + static { + _classes = Arrays.copyOf( + BusinessApplicationHeaderV04Impl._classes, BusinessApplicationHeaderV04Impl._classes.length + 1); + _classes[_classes.length - 1] = BusinessAppHdrV04.class; + } + + /** + * Parse the header from an XML with optional wrapper and sibling elements that will be ignored. + * + * Default adapters are applied, for more options use {@link #parse(String, MxReadParams)} + * + * @param xml the XML content, can contain wrapper elements that will be ignored + * @return parsed element or null if cannot be parsed + * @throws ProwideException if severe errors occur during parse + */ + public static BusinessAppHdrV04 parse(final String xml) { + return parse(xml, new MxReadParams()); + } + + /** + * Parse the header from an XML with optional wrapper and sibling elements that will be ignored. + * + * @param xml the XML content, can contain wrapper elements that will be ignored + * @param params not null unmarshalling parameters + * @return parsed element or null if cannot be parsed + * @throws ProwideException if severe errors occur during parse + */ + public static BusinessAppHdrV04 parse(final String xml, final MxReadParams params) { + Objects.requireNonNull(params, "The unmarshalling params cannot be null"); + return (BusinessAppHdrV04) MxParseUtils.parse(BusinessAppHdrV04.class, xml, _classes, HEADER_LOCALNAME, params); + } + + /** + * Get the classes associated with this message + */ + @SuppressWarnings("rawtypes") + Class[] getClasses() { + return _classes; + } + + /** + * Gets the sender BIC code from these elements in the following order: + * <ol> + * <li>BusinessApplicationHeaderV04/Fr/FIId/FinInstnId/BICFI</li> + * <li>BusinessApplicationHeaderV04/Fr/OrgId/Id/OrgId/Id/AnyBIC</li> + * </ol> + * + * @return found BIC or null if not present or cannot be parsed + */ + @Override + public String from() { + return getBIC(this.getFr()); + } + + /** + * Gets the receiver BIC code from these elements in the following order: + * <ol> + * <li>BusinessApplicationHeaderV04/To/FIId/FinInstnId/BICFI</li> + * <li>BusinessApplicationHeaderV04/To/OrgId/Id/OrgId/Id/AnyBIC</li> + * </ol> + * + * @return found BIC or null if not present or cannot be parsed + */ + @Override + public String to() { + return getBIC(this.getTo()); + } + + private String getBIC(final Party51Choice p) { + try { + final String found = p.getFIId().getFinInstnId().getBICFI(); + if (!StringUtils.isEmpty(found)) { + return found; + } + } catch (NullPointerException e) { + try { + final String found = p.getOrgId().getId().getOrgId().getAnyBIC(); + if (!StringUtils.isEmpty(found)) { + return found; + } + } catch (NullPointerException e2) { + return null; + } + } + return null; + } + + /** + * Get the message reference. + * + * @see #getBizMsgIdr() + */ + @Override + public String reference() { + return this.getBizMsgIdr(); + } + + /** + * Gets the message name. + * + * @see #getMsgDefIdr() + */ + @Override + public String messageName() { + return this.getMsgDefIdr(); + } + + /** + * Gets the service name. + * + * @see #getBizSvc() + */ + @Override + public String serviceName() { + return this.getBizSvc(); + } + + /** + * @return true if the CpyDplct element is present, false otherwise + * @see #getCpyDplct() + */ + @Override + public boolean duplicate() { + return (this.isPssblDplct() != null && this.isPssblDplct()) || this.getCpyDplct() != null; + } + + /** + * Gets the creation date + * + * @see #getCreDt() + */ + @Override + public OffsetDateTime creationDate() { + return this.getCreDt(); + } + + /** + * Sets the creation date. + * + * @param overwrite if true, the creation date will always be set overwriting any previous value; + * @see #setCreDt(OffsetDateTime) + */ + @Override + public void setCreationDate(boolean overwrite) { + if (this.getCreDt() == null || overwrite) { + this.setCreDt(OffsetDateTime.now(ZoneOffset.UTC)); + } + } + + /** + * @deprecated use {@link #xml(MxWriteParams)} instead + */ + @Deprecated + @ProwideDeprecated(phase4 = TargetYear.SRU2025) + @Override + public String xml(String prefix, boolean includeXMLDeclaration) { + DeprecationUtils.phase3(AbstractMX.class, "xml(String, boolean)", "Use xml(MxWriteParams) instead"); + MxWriteParams params = new MxWriteParams(); + params.prefix = prefix; + params.includeXMLDeclaration = includeXMLDeclaration; + return xml(params); + } + + /** + * @deprecated use {@link #xml(MxWriteParams)} instead + */ + @Deprecated + @ProwideDeprecated(phase4 = TargetYear.SRU2025) + @Override + public String xml(String prefix, boolean includeXMLDeclaration, EscapeHandler escapeHandler) { + DeprecationUtils.phase3( + AbstractMX.class, "xml(String, boolean, EscapeHandler)", "Use xml(MxWriteParams) instead"); + MxWriteParams params = new MxWriteParams(); + params.prefix = prefix; + params.includeXMLDeclaration = includeXMLDeclaration; + params.escapeHandler = escapeHandler; + return xml(params); + } + + @Override + public String xml(MxWriteParams params) { + try { + JAXBContext context; + if (params.context != null) { + context = params.context; + } else { + context = JAXBContext.newInstance(BusinessApplicationHeaderV04Impl.class); + } + final Marshaller marshaller = MxWriteUtils.createMarshaller(context, params); + + final StringWriter sw = new StringWriter(); + JAXBElement<BusinessApplicationHeaderV04Impl> element = new JAXBElement( + new QName(NAMESPACE, AppHdr.HEADER_LOCALNAME), BusinessApplicationHeaderV04Impl.class, null, this); + XmlEventWriter eventWriter = new XmlEventWriter( + sw, + params.prefix, + params.includeXMLDeclaration, + AppHdr.HEADER_LOCALNAME, + params.escapeHandler, + params.indent); + marshaller.marshal(element, eventWriter); + return sw.getBuffer().toString(); + + } catch (JAXBException e) { + log.log(Level.SEVERE, "Error writing head.001.001.04 XML:" + e.getMessage()); + } + return null; + } + + @Override + public Element element() { + return element(null); + } + + /** + * @since 9.3.5 + */ + public Element element(JAXBContext inputContext) { + try { + JAXBContext context; + if (inputContext != null) { + context = inputContext; + } else { + context = JAXBContext.newInstance(BusinessApplicationHeaderV04Impl.class); + } + final Marshaller marshaller = context.createMarshaller(); + marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); + + DOMResult res = new DOMResult(); + JAXBElement<BusinessApplicationHeaderV04Impl> element = new JAXBElement( + new QName(NAMESPACE, AppHdr.HEADER_LOCALNAME), BusinessApplicationHeaderV04Impl.class, null, this); + marshaller.marshal(element, res); + Document doc = (Document) res.getNode(); + return (Element) doc.getFirstChild(); + + } catch (JAXBException e) { + log.log(Level.SEVERE, "Error writing head.001.001.04 XML:" + e.getMessage()); + } + return null; + } + + /** + * @return NAMESPACE + */ + @Override + public String namespace() { + return NAMESPACE; + } +} diff --git a/iso20022-core/src/main/java/com/prowidesoftware/swift/model/mx/MxWriteConfiguration.java b/iso20022-core/src/main/java/com/prowidesoftware/swift/model/mx/MxWriteConfiguration.java index 6c1c36881..74edcb1fb 100644 --- a/iso20022-core/src/main/java/com/prowidesoftware/swift/model/mx/MxWriteConfiguration.java +++ b/iso20022-core/src/main/java/com/prowidesoftware/swift/model/mx/MxWriteConfiguration.java @@ -15,6 +15,8 @@ */ package com.prowidesoftware.swift.model.mx; +import com.prowidesoftware.deprecation.ProwideDeprecated; +import com.prowidesoftware.deprecation.TargetYear; import com.prowidesoftware.swift.model.mx.adapters.TypeAdaptersConfiguration; import jakarta.xml.bind.JAXBContext; @@ -81,15 +83,22 @@ public class MxWriteConfiguration { */ public String indent = XmlEventWriter.DEFAULT_INDENT; + /** + * @deprecated use {@link #envelopeType} instead + */ + @Deprecated + @ProwideDeprecated(phase2 = TargetYear.SRU2025) + public EnvelopeType envelopeTyoe = EnvelopeType.CUSTOM; + /** * Defaults to CUSTOM meaning the parameters for the envelope root element are used. This can be changed to * SWIFT, BME_V1 or BME_V2 to use the default values for those envelope types. If an envelope other than CUSTOM * is selected, the rootElement is ignored and the corresponding envelope structure and namespace will be used * instead. * - * @since 9.5.0 + * @since 9.5.3 */ - public EnvelopeType envelopeTyoe = EnvelopeType.CUSTOM; + public EnvelopeType envelopeType = EnvelopeType.CUSTOM; /** * If true, the category code will be used as prefix for the Document element. For example "camt" or "pacs" diff --git a/iso20022-core/src/test/java/com/prowidesoftware/swift/model/mx/AppHdrParserTest.java b/iso20022-core/src/test/java/com/prowidesoftware/swift/model/mx/AppHdrParserTest.java index 78d1568c7..3594de301 100644 --- a/iso20022-core/src/test/java/com/prowidesoftware/swift/model/mx/AppHdrParserTest.java +++ b/iso20022-core/src/test/java/com/prowidesoftware/swift/model/mx/AppHdrParserTest.java @@ -40,8 +40,9 @@ public void testParseApplicationHeader_sample_header() throws IOException { private void assertSampleApplicationHeader(final AppHdr bh) { assertNotNull(bh); + assertInstanceOf(LegacyAppHdr.class, bh); LegacyAppHdr h = (LegacyAppHdr) bh; - assertNotNull(h); + assertEquals("DN", h.getFrom().getType()); assertEquals("cn=funds,ou=abcdchzz,o=swift", h.getFrom().getId()); assertEquals("DN", h.getTo().getType()); @@ -71,9 +72,11 @@ public void testParseApplicationHeader_sample_request_wrapper() throws IOExcepti public void testParseApplicationHeader_sample_payload_mq() throws IOException { final String xml = Lib.readResource("app_to_mqsq.xml"); Optional<AppHdr> appHdr = AppHdrParser.parse(xml); + assertTrue(appHdr.isPresent()); + assertInstanceOf(LegacyAppHdr.class, appHdr.get()); LegacyAppHdr h = (LegacyAppHdr) appHdr.get(); - assertNotNull(h); + assertEquals("SCRRQ01", h.getMsgRef()); assertNotNull(h.getCrDate()); assertEquals(2006, h.getCrDate().get(ChronoField.YEAR)); @@ -84,8 +87,11 @@ public void testParseApplicationHeader_sample_payload_mq() throws IOException { public void testParseApplicationHeader_sample_bah() throws IOException { final String xml = Lib.readResource("mx_sample_bah.xml"); Optional<AppHdr> appHdr = AppHdrParser.parse(xml); + assertTrue(appHdr.isPresent()); + assertInstanceOf(BusinessAppHdrV01.class, appHdr.get()); BusinessAppHdrV01 bah = (BusinessAppHdrV01) appHdr.get(); + assertEquals( "T2S", bah.getFr() @@ -104,7 +110,7 @@ public void testParseApplicationHeader_sample_bah() throws IOException { } @Test - public void testParseBusinessApplicationHeader_sample() { + public void testParseBAH1_sample() { final String xml = "<AppHdr xmlns=\"urn:iso:std:iso:20022:tech:xsd:head.001.001.01\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n" + "<Fr> \n" @@ -139,7 +145,9 @@ public void testParseBusinessApplicationHeader_sample() { + "<CreDt>2015-08-27T08:59:00Z</CreDt>\n" + "</AppHdr>"; Optional<AppHdr> appHdr = AppHdrParser.parse(xml); + assertTrue(appHdr.isPresent()); + assertInstanceOf(BusinessAppHdrV01.class, appHdr.get()); BusinessAppHdrV01 bah = (BusinessAppHdrV01) appHdr.get(); assertNotNull(bah); @@ -182,7 +190,7 @@ public void testParseBusinessApplicationHeader_sample() { } @Test - public void testParseApplicationHeader() { + public void testParseBAH1_sample2() { final String xml = "<h:AppHdr xmlns:h=\"urn:iso:std:iso:20022:tech:xsd:head.001.001.01\">" + " <h:Fr>" + " <h:FIId>" + " <h:FinInstnId>" @@ -202,9 +210,11 @@ public void testParseApplicationHeader() { + " <h:CreDt>2017-08-08T16:58:01Z</h:CreDt>" + "</h:AppHdr>"; Optional<AppHdr> appHdr = AppHdrParser.parse(xml); + assertTrue(appHdr.isPresent()); + assertInstanceOf(BusinessAppHdrV01.class, appHdr.get()); BusinessAppHdrV01 bah = (BusinessAppHdrV01) appHdr.get(); - assertNotNull(bah); + assertEquals("Not available", bah.getFr().getFIId().getFinInstnId().getNm()); assertEquals("Not available", bah.getTo().getFIId().getFinInstnId().getNm()); assertEquals("AAAAAAAAAA222222", bah.getBizMsgIdr()); @@ -212,6 +222,130 @@ public void testParseApplicationHeader() { assertNotNull(bah.getCreDt()); } + @Test + public void testParseBAH2_sample() { + final String xml = "<AppHdr xmlns=\"urn:iso:std:iso:20022:tech:xsd:head.001.001.02\">\n" + + " <Fr>\n" + + " <FIId>\n" + + " <FinInstnId>\n" + + " <BICFI>FOOXGB2L</BICFI>\n" + + " </FinInstnId>\n" + + " </FIId>\n" + + " </Fr>\n" + + " <To>\n" + + " <FIId>\n" + + " <FinInstnId>\n" + + " <BICFI>FOOOSG22</BICFI>\n" + + " </FinInstnId>\n" + + " </FIId>\n" + + " </To>\n" + + " <BizMsgIdr>pacs002bizmsgidr-001</BizMsgIdr>\n" + + " <MsgDefIdr>pacs.002.001.10</MsgDefIdr>\n" + + " <BizSvc>swift.cbprplus.02</BizSvc>\n" + + " <CreDt>2020-08-06T19:10:47+09:00</CreDt>\n" + + " <Rltd>\n" + + " <Fr>\n" + + " <FIId>\n" + + " <FinInstnId>\n" + + " <BICFI>FOOOSG22</BICFI>\n" + + " </FinInstnId>\n" + + " </FIId>\n" + + " </Fr>\n" + + " <To>\n" + + " <FIId>\n" + + " <FinInstnId>\n" + + " <BICFI>FOOXGB2L</BICFI>\n" + + " </FinInstnId>\n" + + " </FIId>\n" + + " </To>\n" + + " <BizMsgIdr>pacs8bizmsgidr01</BizMsgIdr>\n" + + " <MsgDefIdr>pacs.008.001.08</MsgDefIdr>\n" + + " <BizSvc>swift.cbprplus.cov.02</BizSvc>\n" + + " <CreDt>2020-08-06T10:00:47+01:00</CreDt>\n" + + " </Rltd>\n" + + " </AppHdr>\n"; + Optional<AppHdr> appHdr = AppHdrParser.parse(xml); + + assertTrue(appHdr.isPresent()); + assertInstanceOf(BusinessAppHdrV02.class, appHdr.get()); + BusinessAppHdrV02 bah = (BusinessAppHdrV02) appHdr.get(); + + assertEquals("FOOXGB2L", bah.getFr().getFIId().getFinInstnId().getBICFI()); + assertEquals("FOOOSG22", bah.getTo().getFIId().getFinInstnId().getBICFI()); + assertEquals("pacs002bizmsgidr-001", bah.getBizMsgIdr()); + assertEquals("pacs.002.001.10", bah.getMsgDefIdr()); + assertEquals("swift.cbprplus.02", bah.getBizSvc()); + assertNotNull(bah.getCreDt()); + } + + @Test + public void testParseBAH3_sample() { + final String xml = "<AppHdr xmlns=\"urn:iso:std:iso:20022:tech:xsd:head.001.001.03\">\n" + + " <Fr>\n" + + " <FIId>\n" + + " <FinInstnId>\n" + + " <BICFI>FOOXGB2L</BICFI>\n" + + " </FinInstnId>\n" + + " </FIId>\n" + + " </Fr>\n" + + " <To>\n" + + " <FIId>\n" + + " <FinInstnId>\n" + + " <BICFI>FOOOSG22</BICFI>\n" + + " </FinInstnId>\n" + + " </FIId>\n" + + " </To>\n" + + " <BizMsgIdr>pacs002bizmsgidr-001</BizMsgIdr>\n" + + " <MsgDefIdr>pacs.002.001.10</MsgDefIdr>\n" + + " <CreDt>2020-08-06T19:10:47+09:00</CreDt>\n" + + " </AppHdr>\n"; + Optional<AppHdr> appHdr = AppHdrParser.parse(xml); + + assertTrue(appHdr.isPresent()); + assertInstanceOf(BusinessAppHdrV03.class, appHdr.get()); + BusinessAppHdrV03 bah = (BusinessAppHdrV03) appHdr.get(); + + assertEquals("FOOXGB2L", bah.getFr().getFIId().getFinInstnId().getBICFI()); + assertEquals("FOOOSG22", bah.getTo().getFIId().getFinInstnId().getBICFI()); + assertEquals("pacs002bizmsgidr-001", bah.getBizMsgIdr()); + assertEquals("pacs.002.001.10", bah.getMsgDefIdr()); + assertNotNull(bah.getCreDt()); + } + + @Test + public void testParseBAH4_sample() { + final String xml = "<AppHdr xmlns=\"urn:iso:std:iso:20022:tech:xsd:head.001.001.04\">\n" + + " <Fr>\n" + + " <FIId>\n" + + " <FinInstnId>\n" + + " <BICFI>FOOXGB2L</BICFI>\n" + + " </FinInstnId>\n" + + " </FIId>\n" + + " </Fr>\n" + + " <To>\n" + + " <FIId>\n" + + " <FinInstnId>\n" + + " <BICFI>FOOOSG22</BICFI>\n" + + " </FinInstnId>\n" + + " </FIId>\n" + + " </To>\n" + + " <BizMsgIdr>pacs002bizmsgidr-001</BizMsgIdr>\n" + + " <MsgDefIdr>pacs.002.001.10</MsgDefIdr>\n" + + " <CreDt>2020-08-06T19:10:47+09:00</CreDt>\n" + + " </AppHdr>\n"; + Optional<AppHdr> appHdr = AppHdrParser.parse(xml); + + assertTrue(appHdr.isPresent()); + assertInstanceOf(BusinessAppHdrV04.class, appHdr.get()); + BusinessAppHdrV04 bah = (BusinessAppHdrV04) appHdr.get(); + + assertEquals("FOOXGB2L", bah.getFr().getFIId().getFinInstnId().getBICFI()); + assertEquals("FOOOSG22", bah.getTo().getFIId().getFinInstnId().getBICFI()); + assertEquals("pacs002bizmsgidr-001", bah.getBizMsgIdr()); + assertEquals("pacs.002.001.10", bah.getMsgDefIdr()); + assertNotNull(bah.getCreDt()); + } + /** * Test that external entities feature is disabled in the XML parsing to avoid XXE (external entity injection) */ @@ -259,7 +393,7 @@ public void testNoNamespaceDefaultToBAH() { + "</AppHdr>"; Optional<AppHdr> appHdr = AppHdrParser.parse(xml); assertTrue(appHdr.isPresent()); - BusinessAppHdrV01 bah = (BusinessAppHdrV01) appHdr.get(); + BusinessAppHdrV02 bah = (BusinessAppHdrV02) appHdr.get(); assertEquals("0001645041", bah.getBizMsgIdr()); } } diff --git a/iso20022-core/src/test/java/com/prowidesoftware/swift/model/mx/MxWriteTest.java b/iso20022-core/src/test/java/com/prowidesoftware/swift/model/mx/MxWriteTest.java index cde7d4203..f8ac6d94b 100644 --- a/iso20022-core/src/test/java/com/prowidesoftware/swift/model/mx/MxWriteTest.java +++ b/iso20022-core/src/test/java/com/prowidesoftware/swift/model/mx/MxWriteTest.java @@ -206,7 +206,7 @@ public void testWriteWithSWIFTEnvelope() { mx.getFIToFICstmrCdtTrf().getGrpHdr().setMsgId("123"); MxWriteConfiguration conf = new MxWriteConfiguration(); - conf.envelopeTyoe = EnvelopeType.SWIFT; + conf.envelopeType = EnvelopeType.SWIFT; final String xml = mx.message(conf); @@ -233,7 +233,7 @@ public void testWriteWithISOEnvelopeV1() { mx.getFIToFICstmrCdtTrf().getGrpHdr().setMsgId("123"); MxWriteConfiguration conf = new MxWriteConfiguration(); - conf.envelopeTyoe = EnvelopeType.BME_V1; + conf.envelopeType = EnvelopeType.BME_V1; final String xml = mx.message(conf); @@ -264,7 +264,7 @@ public void testWriteWithISOEnvelopeV2() { mx.getFIToFICstmrCdtTrf().getGrpHdr().setMsgId("123"); MxWriteConfiguration conf = new MxWriteConfiguration(); - conf.envelopeTyoe = EnvelopeType.BME_V2; + conf.envelopeType = EnvelopeType.BME_V2; final String xml = mx.message(conf); diff --git a/model-common-types/src/generated/java/com/prowidesoftware/swift/model/mx/dic/BusinessApplicationHeader8.java b/model-common-types/src/generated/java/com/prowidesoftware/swift/model/mx/dic/BusinessApplicationHeader8.java new file mode 100644 index 000000000..8e6936f4f --- /dev/null +++ b/model-common-types/src/generated/java/com/prowidesoftware/swift/model/mx/dic/BusinessApplicationHeader8.java @@ -0,0 +1,415 @@ + +package com.prowidesoftware.swift.model.mx.dic; + +import java.time.OffsetDateTime; +import com.prowidesoftware.swift.model.mx.adapters.IsoDateTimeAdapter; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlSchemaType; +import jakarta.xml.bind.annotation.XmlType; +import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter; +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + + +/** + * Specifies the Business Application Header of the Business Message. + * Can be used when replying to a query; can also be used when cancelling or amending. + * + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "BusinessApplicationHeader8", propOrder = { + "charSet", + "fr", + "to", + "bizMsgIdr", + "msgDefIdr", + "bizSvc", + "mktPrctc", + "creDt", + "bizPrcgDt", + "cpyDplct", + "pssblDplct", + "prty", + "sgntr" +}) +public class BusinessApplicationHeader8 { + + @XmlElement(name = "CharSet") + protected String charSet; + @XmlElement(name = "Fr", required = true) + protected Party51Choice fr; + @XmlElement(name = "To", required = true) + protected Party51Choice to; + @XmlElement(name = "BizMsgIdr", required = true) + protected String bizMsgIdr; + @XmlElement(name = "MsgDefIdr", required = true) + protected String msgDefIdr; + @XmlElement(name = "BizSvc") + protected String bizSvc; + @XmlElement(name = "MktPrctc") + protected ImplementationSpecification1 mktPrctc; + @XmlElement(name = "CreDt", required = true, type = String.class) + @XmlJavaTypeAdapter(IsoDateTimeAdapter.class) + @XmlSchemaType(name = "dateTime") + protected OffsetDateTime creDt; + @XmlElement(name = "BizPrcgDt", type = String.class) + @XmlJavaTypeAdapter(IsoDateTimeAdapter.class) + @XmlSchemaType(name = "dateTime") + protected OffsetDateTime bizPrcgDt; + @XmlElement(name = "CpyDplct") + @XmlSchemaType(name = "string") + protected CopyDuplicate1Code cpyDplct; + @XmlElement(name = "PssblDplct") + protected Boolean pssblDplct; + @XmlElement(name = "Prty") + protected String prty; + @XmlElement(name = "Sgntr") + protected SignatureEnvelope sgntr; + + /** + * Gets the value of the charSet property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCharSet() { + return charSet; + } + + /** + * Sets the value of the charSet property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public BusinessApplicationHeader8 setCharSet(String value) { + this.charSet = value; + return this; + } + + /** + * Gets the value of the fr property. + * + * @return + * possible object is + * {@link Party51Choice } + * + */ + public Party51Choice getFr() { + return fr; + } + + /** + * Sets the value of the fr property. + * + * @param value + * allowed object is + * {@link Party51Choice } + * + */ + public BusinessApplicationHeader8 setFr(Party51Choice value) { + this.fr = value; + return this; + } + + /** + * Gets the value of the to property. + * + * @return + * possible object is + * {@link Party51Choice } + * + */ + public Party51Choice getTo() { + return to; + } + + /** + * Sets the value of the to property. + * + * @param value + * allowed object is + * {@link Party51Choice } + * + */ + public BusinessApplicationHeader8 setTo(Party51Choice value) { + this.to = value; + return this; + } + + /** + * Gets the value of the bizMsgIdr property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getBizMsgIdr() { + return bizMsgIdr; + } + + /** + * Sets the value of the bizMsgIdr property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public BusinessApplicationHeader8 setBizMsgIdr(String value) { + this.bizMsgIdr = value; + return this; + } + + /** + * Gets the value of the msgDefIdr property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getMsgDefIdr() { + return msgDefIdr; + } + + /** + * Sets the value of the msgDefIdr property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public BusinessApplicationHeader8 setMsgDefIdr(String value) { + this.msgDefIdr = value; + return this; + } + + /** + * Gets the value of the bizSvc property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getBizSvc() { + return bizSvc; + } + + /** + * Sets the value of the bizSvc property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public BusinessApplicationHeader8 setBizSvc(String value) { + this.bizSvc = value; + return this; + } + + /** + * Gets the value of the mktPrctc property. + * + * @return + * possible object is + * {@link ImplementationSpecification1 } + * + */ + public ImplementationSpecification1 getMktPrctc() { + return mktPrctc; + } + + /** + * Sets the value of the mktPrctc property. + * + * @param value + * allowed object is + * {@link ImplementationSpecification1 } + * + */ + public BusinessApplicationHeader8 setMktPrctc(ImplementationSpecification1 value) { + this.mktPrctc = value; + return this; + } + + /** + * Gets the value of the creDt property. + * + * @return + * possible object is + * {@link String } + * + */ + public OffsetDateTime getCreDt() { + return creDt; + } + + /** + * Sets the value of the creDt property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public BusinessApplicationHeader8 setCreDt(OffsetDateTime value) { + this.creDt = value; + return this; + } + + /** + * Gets the value of the bizPrcgDt property. + * + * @return + * possible object is + * {@link String } + * + */ + public OffsetDateTime getBizPrcgDt() { + return bizPrcgDt; + } + + /** + * Sets the value of the bizPrcgDt property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public BusinessApplicationHeader8 setBizPrcgDt(OffsetDateTime value) { + this.bizPrcgDt = value; + return this; + } + + /** + * Gets the value of the cpyDplct property. + * + * @return + * possible object is + * {@link CopyDuplicate1Code } + * + */ + public CopyDuplicate1Code getCpyDplct() { + return cpyDplct; + } + + /** + * Sets the value of the cpyDplct property. + * + * @param value + * allowed object is + * {@link CopyDuplicate1Code } + * + */ + public BusinessApplicationHeader8 setCpyDplct(CopyDuplicate1Code value) { + this.cpyDplct = value; + return this; + } + + /** + * Gets the value of the pssblDplct property. + * + * @return + * possible object is + * {@link Boolean } + * + */ + public Boolean isPssblDplct() { + return pssblDplct; + } + + /** + * Sets the value of the pssblDplct property. + * + * @param value + * allowed object is + * {@link Boolean } + * + */ + public BusinessApplicationHeader8 setPssblDplct(Boolean value) { + this.pssblDplct = value; + return this; + } + + /** + * Gets the value of the prty property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getPrty() { + return prty; + } + + /** + * Sets the value of the prty property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public BusinessApplicationHeader8 setPrty(String value) { + this.prty = value; + return this; + } + + /** + * Gets the value of the sgntr property. + * + * @return + * possible object is + * {@link SignatureEnvelope } + * + */ + public SignatureEnvelope getSgntr() { + return sgntr; + } + + /** + * Sets the value of the sgntr property. + * + * @param value + * allowed object is + * {@link SignatureEnvelope } + * + */ + public BusinessApplicationHeader8 setSgntr(SignatureEnvelope value) { + this.sgntr = value; + return this; + } + + @Override + public String toString() { + return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE); + } + + @Override + public boolean equals(Object that) { + return EqualsBuilder.reflectionEquals(this, that); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + +} diff --git a/model-common-types/src/generated/java/com/prowidesoftware/swift/model/mx/dic/BusinessApplicationHeaderV04Impl.java b/model-common-types/src/generated/java/com/prowidesoftware/swift/model/mx/dic/BusinessApplicationHeaderV04Impl.java new file mode 100644 index 000000000..792ff04fe --- /dev/null +++ b/model-common-types/src/generated/java/com/prowidesoftware/swift/model/mx/dic/BusinessApplicationHeaderV04Impl.java @@ -0,0 +1,467 @@ + +package com.prowidesoftware.swift.model.mx.dic; + +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.List; +import com.prowidesoftware.swift.model.mx.adapters.IsoDateTimeAdapter; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlSchemaType; +import jakarta.xml.bind.annotation.XmlType; +import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter; +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + + +/** + * The Business Layer deals with Business Messages. The behaviour of the Business Messages is fully described by the Business Transaction and the structure of the Business Messages is fully described by the Message Definitions and related Message Rules, Rules and Market Practices. All of which are registered in the ISO 20022 Repository. + * A single new Business Message (with its accompagnying business application header) is created - by the sending MessagingEndpoint - for each business event; that is each interaction in a Business Transaction. A Business Message adheres to the following principles: + * " A Business Message (and its business application header) must not contain information about the Message Transport System or the mechanics or mechanism of message sending, transportation, or receipt. + * " A Business Message must be comprehensible outside of the context of the Transport Message. That is the Business Message must not require knowledge of the Transport Message to be understood. + * " A Business Message may contain headers, footers, and envelopes that are meaningful for the business. When present, they are treated as any other message content, which means that they are considered part of the Message Definition of the Business Message and as such will be part of the ISO 20022 Repository. + * " A Business Message refers to Business Actors by their Name. Each instance of a Business Actor has one Name. The Business Actor must not be referred to in the Transport Layer. + * Specific usage of this BusinessMessageHeader may be defined by the relevant SEG. + * + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "BusinessApplicationHeaderV04", propOrder = { + "charSet", + "fr", + "to", + "bizMsgIdr", + "msgDefIdr", + "bizSvc", + "mktPrctc", + "creDt", + "bizPrcgDt", + "cpyDplct", + "pssblDplct", + "prty", + "sgntr", + "rltd" +}) +public class BusinessApplicationHeaderV04Impl { + + @XmlElement(name = "CharSet") + protected String charSet; + @XmlElement(name = "Fr", required = true) + protected Party51Choice fr; + @XmlElement(name = "To", required = true) + protected Party51Choice to; + @XmlElement(name = "BizMsgIdr", required = true) + protected String bizMsgIdr; + @XmlElement(name = "MsgDefIdr", required = true) + protected String msgDefIdr; + @XmlElement(name = "BizSvc") + protected String bizSvc; + @XmlElement(name = "MktPrctc") + protected ImplementationSpecification1 mktPrctc; + @XmlElement(name = "CreDt", required = true, type = String.class) + @XmlJavaTypeAdapter(IsoDateTimeAdapter.class) + @XmlSchemaType(name = "dateTime") + protected OffsetDateTime creDt; + @XmlElement(name = "BizPrcgDt", type = String.class) + @XmlJavaTypeAdapter(IsoDateTimeAdapter.class) + @XmlSchemaType(name = "dateTime") + protected OffsetDateTime bizPrcgDt; + @XmlElement(name = "CpyDplct") + @XmlSchemaType(name = "string") + protected CopyDuplicate1Code cpyDplct; + @XmlElement(name = "PssblDplct") + protected Boolean pssblDplct; + @XmlElement(name = "Prty") + protected String prty; + @XmlElement(name = "Sgntr") + protected SignatureEnvelope sgntr; + @XmlElement(name = "Rltd") + protected List<BusinessApplicationHeader8> rltd; + public static final transient Class[] _classes = new Class[] {AddressType2Code.class, AddressType3Choice.class, BranchAndFinancialInstitutionIdentification8 .class, BranchData5 .class, BusinessApplicationHeader8 .class, BusinessApplicationHeaderV04Impl.class, ClearingSystemIdentification2Choice.class, ClearingSystemMemberIdentification2 .class, Contact13 .class, CopyDuplicate1Code.class, DateAndPlaceOfBirth1 .class, FinancialIdentificationSchemeName1Choice.class, FinancialInstitutionIdentification23 .class, GenericFinancialIdentification1 .class, GenericIdentification30 .class, GenericOrganisationIdentification3 .class, GenericPersonIdentification2 .class, ImplementationSpecification1 .class, NamePrefix2Code.class, OrganisationIdentification39 .class, OrganisationIdentificationSchemeName1Choice.class, OtherContact1 .class, Party51Choice.class, Party52Choice.class, PartyIdentification272 .class, PersonIdentification18 .class, PersonIdentificationSchemeName1Choice.class, PostalAddress27 .class, PreferredContactMethod2Code.class, SignatureEnvelope.class }; + + /** + * Gets the value of the charSet property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCharSet() { + return charSet; + } + + /** + * Sets the value of the charSet property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public BusinessApplicationHeaderV04Impl setCharSet(String value) { + this.charSet = value; + return this; + } + + /** + * Gets the value of the fr property. + * + * @return + * possible object is + * {@link Party51Choice } + * + */ + public Party51Choice getFr() { + return fr; + } + + /** + * Sets the value of the fr property. + * + * @param value + * allowed object is + * {@link Party51Choice } + * + */ + public BusinessApplicationHeaderV04Impl setFr(Party51Choice value) { + this.fr = value; + return this; + } + + /** + * Gets the value of the to property. + * + * @return + * possible object is + * {@link Party51Choice } + * + */ + public Party51Choice getTo() { + return to; + } + + /** + * Sets the value of the to property. + * + * @param value + * allowed object is + * {@link Party51Choice } + * + */ + public BusinessApplicationHeaderV04Impl setTo(Party51Choice value) { + this.to = value; + return this; + } + + /** + * Gets the value of the bizMsgIdr property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getBizMsgIdr() { + return bizMsgIdr; + } + + /** + * Sets the value of the bizMsgIdr property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public BusinessApplicationHeaderV04Impl setBizMsgIdr(String value) { + this.bizMsgIdr = value; + return this; + } + + /** + * Gets the value of the msgDefIdr property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getMsgDefIdr() { + return msgDefIdr; + } + + /** + * Sets the value of the msgDefIdr property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public BusinessApplicationHeaderV04Impl setMsgDefIdr(String value) { + this.msgDefIdr = value; + return this; + } + + /** + * Gets the value of the bizSvc property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getBizSvc() { + return bizSvc; + } + + /** + * Sets the value of the bizSvc property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public BusinessApplicationHeaderV04Impl setBizSvc(String value) { + this.bizSvc = value; + return this; + } + + /** + * Gets the value of the mktPrctc property. + * + * @return + * possible object is + * {@link ImplementationSpecification1 } + * + */ + public ImplementationSpecification1 getMktPrctc() { + return mktPrctc; + } + + /** + * Sets the value of the mktPrctc property. + * + * @param value + * allowed object is + * {@link ImplementationSpecification1 } + * + */ + public BusinessApplicationHeaderV04Impl setMktPrctc(ImplementationSpecification1 value) { + this.mktPrctc = value; + return this; + } + + /** + * Gets the value of the creDt property. + * + * @return + * possible object is + * {@link String } + * + */ + public OffsetDateTime getCreDt() { + return creDt; + } + + /** + * Sets the value of the creDt property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public BusinessApplicationHeaderV04Impl setCreDt(OffsetDateTime value) { + this.creDt = value; + return this; + } + + /** + * Gets the value of the bizPrcgDt property. + * + * @return + * possible object is + * {@link String } + * + */ + public OffsetDateTime getBizPrcgDt() { + return bizPrcgDt; + } + + /** + * Sets the value of the bizPrcgDt property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public BusinessApplicationHeaderV04Impl setBizPrcgDt(OffsetDateTime value) { + this.bizPrcgDt = value; + return this; + } + + /** + * Gets the value of the cpyDplct property. + * + * @return + * possible object is + * {@link CopyDuplicate1Code } + * + */ + public CopyDuplicate1Code getCpyDplct() { + return cpyDplct; + } + + /** + * Sets the value of the cpyDplct property. + * + * @param value + * allowed object is + * {@link CopyDuplicate1Code } + * + */ + public BusinessApplicationHeaderV04Impl setCpyDplct(CopyDuplicate1Code value) { + this.cpyDplct = value; + return this; + } + + /** + * Gets the value of the pssblDplct property. + * + * @return + * possible object is + * {@link Boolean } + * + */ + public Boolean isPssblDplct() { + return pssblDplct; + } + + /** + * Sets the value of the pssblDplct property. + * + * @param value + * allowed object is + * {@link Boolean } + * + */ + public BusinessApplicationHeaderV04Impl setPssblDplct(Boolean value) { + this.pssblDplct = value; + return this; + } + + /** + * Gets the value of the prty property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getPrty() { + return prty; + } + + /** + * Sets the value of the prty property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public BusinessApplicationHeaderV04Impl setPrty(String value) { + this.prty = value; + return this; + } + + /** + * Gets the value of the sgntr property. + * + * @return + * possible object is + * {@link SignatureEnvelope } + * + */ + public SignatureEnvelope getSgntr() { + return sgntr; + } + + /** + * Sets the value of the sgntr property. + * + * @param value + * allowed object is + * {@link SignatureEnvelope } + * + */ + public BusinessApplicationHeaderV04Impl setSgntr(SignatureEnvelope value) { + this.sgntr = value; + return this; + } + + /** + * Gets the value of the rltd property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the Jakarta XML Binding object. + * This is why there is not a {@code set} method for the rltd property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getRltd().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link BusinessApplicationHeader8 } + * + * + * @return + * The value of the rltd property. + */ + public List<BusinessApplicationHeader8> getRltd() { + if (rltd == null) { + rltd = new ArrayList<>(); + } + return this.rltd; + } + + @Override + public String toString() { + return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE); + } + + @Override + public boolean equals(Object that) { + return EqualsBuilder.reflectionEquals(this, that); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + /** + * Adds a new item to the rltd list. + * @see #getRltd() + * + */ + public BusinessApplicationHeaderV04Impl addRltd(BusinessApplicationHeader8 rltd) { + getRltd().add(rltd); + return this; + } + +} diff --git a/model-common-types/src/generated/java/com/prowidesoftware/swift/model/mx/dic/Party51Choice.java b/model-common-types/src/generated/java/com/prowidesoftware/swift/model/mx/dic/Party51Choice.java new file mode 100644 index 000000000..626635172 --- /dev/null +++ b/model-common-types/src/generated/java/com/prowidesoftware/swift/model/mx/dic/Party51Choice.java @@ -0,0 +1,97 @@ + +package com.prowidesoftware.swift.model.mx.dic; + +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlType; +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + + +/** + * Identification of a person, an organisation or a financial institution. + * + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "Party51Choice", propOrder = { + "orgId", + "fiId" +}) +public class Party51Choice { + + @XmlElement(name = "OrgId") + protected PartyIdentification272 orgId; + @XmlElement(name = "FIId") + protected BranchAndFinancialInstitutionIdentification8 fiId; + + /** + * Gets the value of the orgId property. + * + * @return + * possible object is + * {@link PartyIdentification272 } + * + */ + public PartyIdentification272 getOrgId() { + return orgId; + } + + /** + * Sets the value of the orgId property. + * + * @param value + * allowed object is + * {@link PartyIdentification272 } + * + */ + public Party51Choice setOrgId(PartyIdentification272 value) { + this.orgId = value; + return this; + } + + /** + * Gets the value of the fiId property. + * + * @return + * possible object is + * {@link BranchAndFinancialInstitutionIdentification8 } + * + */ + public BranchAndFinancialInstitutionIdentification8 getFIId() { + return fiId; + } + + /** + * Sets the value of the fiId property. + * + * @param value + * allowed object is + * {@link BranchAndFinancialInstitutionIdentification8 } + * + */ + public Party51Choice setFIId(BranchAndFinancialInstitutionIdentification8 value) { + this.fiId = value; + return this; + } + + @Override + public String toString() { + return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE); + } + + @Override + public boolean equals(Object that) { + return EqualsBuilder.reflectionEquals(this, that); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + +}