Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SRU2024 v10.2 #115

Open
wants to merge 19 commits into
base: SRU2024
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@ release.sh
.idea/sonarlint
*.hprof
.idea/copilot
.java-version
2 changes: 1 addition & 1 deletion .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 23 additions & 13 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
# Prowide ISO 20022 - CHANGELOG

#### 9.5.4 - August 2024
#### 10.2.3 - August 2024
* (PW-1958) Fixed the `DefaultMxMetadataStrategy` NPE issue when the amount values are null

#### 9.5.3 - August 2024
#### 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
* Add support for Business Application Header version head.001.001.04

#### 9.5.2 - June 2024
* (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

#### 9.5.1 - June 2024
#### 10.2.1 - June 2024
* Enhanced the AppHdrFactory to honor the business service set in the parameter MxId
* Enhanced the MxParseUtils#identifyMessage to set the business service in the MxId when present

#### 9.5.0 - May 2024
#### 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)
Expand All @@ -24,26 +23,37 @@
* Dependency update: commons-lang3 -> 3.14.0
* Dependency update: gson -> 2.11.0

#### 9.4.5 - May 2024
#### 10.1.6 - May 2024
* (PW-1875) Changed the BusinessApplicationHeaderV01 marshaller to always use Zulu timezone with "Z" indicator

#### 9.4.4 - January 2024

#### 10.1.5 - April 2024
* Update jaxb dependency from com.sun.xml.bind:jaxb-impl:4.0.2 to 4.0.5 containing several jaxb bugfixes

#### 10.1.4 - January 2024
* Enhanced the identifier extraction of the MxSwiftMessage to use the AppHdr when the Document namespace is missing
* Enhanced the generic AbstractMX#parse to detect the message type from the AppHdr when the Document namespace is missing
* Added default metadata extraction implementation for pacs and camt amounts and value dates
* Added default methods for sender, receiver, and identifier extraction to the MxSwiftMessage.
* Replaced the DistinguishedName parse logic with proprietary util class from the Prowide Core library

#### 9.4.3 - August 2023
#### 10.1.3 - August 2023
* (PW-1566) Fixed manipulation of nanoseconds in the OffsetTime and OffsetDateTime adapters
* Enhanced metadata extraction for xsys messages getting sender/receiver BICs from the RequestHeader element
* Make the message metadata extraction lenient, by fixing the XML instruction of the payload when it contains invalid case

#### 9.4.2 - July 2023
#### 10.1.2 - August 2023
* Added new utility class SupplementaryDataUtils to facilitate "SplmtryData" extraction from MX messages

#### 9.4.1 - June 2023
#### 10.1.1 - July 2023
* (PW-1392) Fixed the default escape handler when serializing model objects into XML, that was duplicated quote characters in the output

#### 10.1.0 - June 2023
* Migration to Java 11
* Migration to Jakarta EE 10
* XmlGregorianCalendar was replaced model-wide by the new java.time classes
* Fixed AppHdrFactory creation to use UTC in the header default creation date time
* Fixed the business application header V01 serialization to use Zulu time indicator instead of +00:00 offset

#### 9.4.0 - May 2023
* SWIFT Standard release update 2023 (live 19 November 2023)
* Yearly revision of deprecation phase (see https://dev.prowidesoftware.com/SRU2022/getting-started/deprecation/)
Expand Down
64 changes: 47 additions & 17 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ buildscript {
gradlePluginPortal()
}
dependencies {
classpath 'ru.vyarus:gradle-quality-plugin:4.7.0'
classpath 'pl.allegro.tech.build:axion-release-plugin:1.13.6'
classpath 'io.github.gradle-nexus:publish-plugin:2.0.0'
classpath 'com.diffplug.spotless:spotless-plugin-gradle:6.13.0' // above this version requires Java 11
classpath 'ru.vyarus:gradle-quality-plugin:4.9.0'
classpath 'pl.allegro.tech.build:axion-release-plugin:1.15.1'
classpath 'io.github.gradle-nexus:publish-plugin:1.3.0'
classpath 'com.diffplug.spotless:spotless-plugin-gradle:6.23.3'
}
}
apply plugin: 'pl.allegro.tech.build.axion-release'
Expand Down Expand Up @@ -40,7 +40,7 @@ allprojects {
options.encoding = 'UTF-8'
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(8))
languageVersion.set(JavaLanguageVersion.of(11))
}
}
doLast {
Expand Down Expand Up @@ -71,7 +71,11 @@ allprojects {
}
}

sourceSets.main.java.srcDirs = ['src/main/java', 'src/generated/java']
sourceSets.named('main') {
java {
setSrcDirs(['src/main/java', 'src/generated/java'])
}
}

tasks.withType(Jar) {
manifest.attributes(
Expand All @@ -82,8 +86,8 @@ allprojects {
'Implementation-Version': project.version,
'Implementation-Vendor': 'www.prowidesoftware.com',
'Built-OS': System.getProperty('os.name'),
'Source-Compatibility': project.sourceCompatibility,
'Target-Compatibility': project.targetCompatibility,
'Source-Compatibility': JavaVersion.VERSION_11,
'Target-Compatibility': JavaVersion.VERSION_11,
'Built-Date': new Date().format("yyyy-MM-dd"),
'Automatic-Module-Name': 'com.prowidesoftware.iso20022'
)
Expand All @@ -98,6 +102,9 @@ subprojects {
dependencies {
implementation 'org.apache.commons:commons-lang3:3.12.0'
implementation 'com.google.code.gson:gson:2.9.0'
implementation 'com.sun.xml.bind:jaxb-impl:4.0.5'
// bind-api is included transitively by jaxb-impl
// implementation 'jakarta.xml.bind:jakarta.xml.bind-api:4.0.2'
}

tasks.withType(Jar) {
Expand All @@ -118,8 +125,14 @@ configure(subprojects.findAll {it.name.endsWith('-mx')}) {
dependencies {
api project(':iso20022-core')
implementation project(specificTypesProject)

implementation 'org.apache.commons:commons-lang3:3.12.0'
implementation 'com.google.code.gson:gson:2.9.0'

implementation 'com.sun.xml.bind:jaxb-impl:4.0.5'
// bind-api is included transitively by jaxb-impl
// implementation 'jakarta.xml.bind:jakarta.xml.bind-api:4.0.2'

compileOnly 'javax.persistence:javax.persistence-api:2.2'
}
}
Expand All @@ -134,15 +147,15 @@ configure(subprojects.findAll {it.name.endsWith('-mx')}) {
project(':iso20022-core') {
dependencies {
// included build
api 'com.prowidesoftware:pw-swift-core:SRU2024-9.5.1'
api 'com.prowidesoftware:pw-swift-core:SRU2024-10.2.1'

implementation 'org.apache.commons:commons-lang3:3.14.0'
implementation 'com.google.code.gson:gson:2.11.0'

compileOnly 'javax.persistence:javax.persistence-api:2.2'
compileOnly 'javax.validation:validation-api:2.0.1.Final'
compileOnly 'jakarta.persistence:jakarta.persistence-api:3.1.0'
compileOnly 'jakarta.validation:jakarta.validation-api:3.0.2'

testImplementation 'javax.persistence:javax.persistence-api:2.2'
testImplementation 'jakarta.persistence:jakarta.persistence-api:3.1.0'
testImplementation 'org.junit.jupiter:junit-jupiter:5.10.2'
testImplementation 'com.google.guava:guava:33.2.0-jre'
testImplementation 'org.assertj:assertj-core:3.25.3'
Expand Down Expand Up @@ -194,7 +207,11 @@ jar {
archivesBaseName = 'pw-iso20022'
subprojects.each { subproject ->
from subproject.configurations.archives.allArtifacts.files.collect {
zipTree(it)
// filter out any artifacts that are not jars
if (it.name.endsWith('.jar')) {
println "Adding ${it.name} to fat jar"
zipTree(it)
}
}
}
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
Expand Down Expand Up @@ -313,9 +330,16 @@ artifacts {
// declared dependencies for pom generation
dependencies {
// included build (keep in sync with the latest Prowide Core version)
api 'com.prowidesoftware:pw-swift-core:SRU2024-9.5.1'
implementation 'org.apache.commons:commons-lang3:3.14.0'
implementation 'com.google.code.gson:gson:2.10'
api 'com.prowidesoftware:pw-swift-core:SRU2024-10.2.1'

// included transitive dependencies from Prowide Core
//implementation 'org.apache.commons:commons-lang3:3.14.0'
//implementation 'com.google.code.gson:gson:2.10'

// jaxb is required because it is no longer included in the JDK
implementation 'com.sun.xml.bind:jaxb-impl:4.0.5'
// bind-api is included transitively by jaxb-impl
// implementation 'jakarta.xml.bind:jakarta.xml.bind-api:4.0.2'
}

// repo for publishing
Expand Down Expand Up @@ -452,7 +476,7 @@ tasks.register('bundle', Jar) {
from ("$buildDir/libs") {
include '*.asc'
}
archiveName 'bundle.jar'
archiveFileName.set('bundle.jar')
}

tasks.withType(Test) {
Expand All @@ -473,6 +497,12 @@ task('testOn17', type: Test) {
}
}

task('testOn19', type: Test) {
javaLauncher = javaToolchains.launcherFor {
languageVersion = JavaLanguageVersion.of(19)
}
}

quality {
strict = false
// we limit this to spotbugs for the moment
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.prowidesoftware.swift.model.mx.*;
import jakarta.persistence.*;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.Objects;
import java.util.Optional;
import javax.persistence.*;
import org.apache.commons.lang3.StringUtils;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,18 @@
import com.prowidesoftware.swift.model.MessageStandardType;
import com.prowidesoftware.swift.model.MxId;
import com.prowidesoftware.swift.model.mt.AbstractMT;
import com.prowidesoftware.swift.model.mx.adapters.*;
import com.prowidesoftware.swift.utils.Lib;
import jakarta.xml.bind.JAXBContext;
import jakarta.xml.bind.annotation.XmlTransient;
import java.io.*;
import java.nio.charset.StandardCharsets;
import java.time.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.annotation.XmlTransient;
import javax.xml.datatype.XMLGregorianCalendar;
import javax.xml.transform.Source;
import javax.xml.transform.dom.DOMResult;
import javax.xml.transform.stream.StreamSource;
Expand Down Expand Up @@ -200,11 +201,7 @@ public static AbstractMX parse(final String xml, MxId id, final MxReadConfigurat
* @since 7.10.3
*/
protected static <T> T fromJson(String json, Class<T> classOfT) {
final Gson gson = new GsonBuilder()
.registerTypeAdapter(AbstractMX.class, new AbstractMXAdapter())
.registerTypeAdapter(XMLGregorianCalendar.class, new XMLGregorianCalendarAdapter())
.registerTypeAdapter(AppHdr.class, new AppHdrAdapter())
.create();
final Gson gson = getGsonBuilderWithCustomAdapters();
return gson.fromJson(json, classOfT);
}

Expand All @@ -216,11 +213,7 @@ protected static <T> T fromJson(String json, Class<T> classOfT) {
* @since 7.10.3
*/
public static AbstractMX fromJson(String json) {
final Gson gson = new GsonBuilder()
.registerTypeAdapter(AbstractMX.class, new AbstractMXAdapter())
.registerTypeAdapter(XMLGregorianCalendar.class, new XMLGregorianCalendarAdapter())
.registerTypeAdapter(AppHdr.class, new AppHdrAdapter())
.create();
final Gson gson = getGsonBuilderWithCustomAdapters();
return gson.fromJson(json, AbstractMX.class);
}

Expand Down Expand Up @@ -560,14 +553,23 @@ public Element element(JAXBContext inputContext) {
*/
@Override
public String toJson() {
// we use AbstractMX and not this.getClass() in order to force usage of the adapter
final Gson gson = getGsonBuilderWithCustomAdapters();
return gson.toJson(this, AbstractMX.class);
}

private static Gson getGsonBuilderWithCustomAdapters() {
final Gson gson = new GsonBuilder()
.registerTypeAdapter(AbstractMX.class, new AbstractMXAdapter())
.registerTypeHierarchyAdapter(XMLGregorianCalendar.class, new XMLGregorianCalendarAdapter())
.registerTypeAdapter(OffsetDateTime.class, new OffsetDateTimeJsonAdapter())
.registerTypeAdapter(OffsetTime.class, new OffsetTimeJsonAdapter())
.registerTypeAdapter(LocalDate.class, new LocalDateJsonAdapter())
.registerTypeAdapter(Year.class, new YearJsonAdapter())
.registerTypeAdapter(YearMonth.class, new YearMonthJsonAdapter())
.registerTypeAdapter(AppHdr.class, new AppHdrAdapter())
.setPrettyPrinting()
.create();
// we use AbstractMX and not this.getClass() in order to force usage of the adapter
return gson.toJson(this, AbstractMX.class);
return gson;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ class AbstractMXAdapter implements JsonSerializer<AbstractMX>, JsonDeserializer<
@Override
public JsonElement serialize(final AbstractMX mx, Type type, final JsonSerializationContext context) {
// default serialization
// in Integrator this will fill the JSON structure with the complete MX message model
JsonObject object = context.serialize(mx).getAsJsonObject();
object.addProperty("@xmlns", mx.getNamespace());
object.addProperty(IDENTIFIER, mx.getMxId().id());
Expand All @@ -53,7 +52,7 @@ public AbstractMX deserialize(JsonElement json, Type typeOfT, JsonDeserializatio
}
MxId id = new MxId(prim.getAsString());

Class<?> klass = null;
Class<?> klass;
try {
String className = "com.prowidesoftware.swift.model.mx.Mx" + id.camelized();
klass = Class.forName(className);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
import com.prowidesoftware.deprecation.DeprecationUtils;
import com.prowidesoftware.deprecation.ProwideDeprecated;
import com.prowidesoftware.deprecation.TargetYear;
import java.time.OffsetDateTime;
import java.util.Objects;
import javax.xml.datatype.XMLGregorianCalendar;
import org.w3c.dom.Element;

/**
Expand Down Expand Up @@ -96,7 +96,7 @@ public interface AppHdr {
*
* @return found date or null if the element is not found
*/
XMLGregorianCalendar creationDate();
OffsetDateTime creationDate();

/**
* Sets the creation date in the header object with current moment in UTC time zone.
Expand Down
Loading