From ad824e05c8f3bfc63add7cecbff1d66dd9614c60 Mon Sep 17 00:00:00 2001 From: Magnus Ree Torvadal Date: Fri, 1 Nov 2024 19:29:06 +0100 Subject: [PATCH] Update to verify with Jarkarta, remove unused javax dependencies --- README.md | 6 ++ pom.xml | 62 +++++++------------ .../schemas/api/adapters/DateTimeAdapter.java | 25 -------- .../api/adapters/LocalDateAdapter.java | 9 ++- .../ctr/schemas/api/adapters/LongAdapter.java | 4 +- .../api/adapters/ZonedDateTimeAdapter.java | 26 ++++++++ src/main/xjb/jaxb-bindings-wsimport.xjb | 22 ++++--- 7 files changed, 72 insertions(+), 82 deletions(-) delete mode 100644 src/main/java/dk/lmst/ctr/schemas/api/adapters/DateTimeAdapter.java create mode 100644 src/main/java/dk/lmst/ctr/schemas/api/adapters/ZonedDateTimeAdapter.java diff --git a/README.md b/README.md index 794dbd4..64523ce 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,12 @@ Contains the schemas and wsdl file used in the CTR project for the new DGWS inte Run `mvn clean package` to create a zip file of the wsdl and schema files in `ctr-schemas` repo. The zip file is located in the `target` folder. +## Verify + +Run `mvn clean verify` to verify that all the schemas are correct before making a release. The generated java classes can be found [here](target/generated-sources/wsimport/dk/lmst/ctr/xml_schema/_2022/_12/_01). + +If they don't exist it means that the verification failed + ## Upload zip file to Github When creating a release in Github of this project, the Github action workflow will automatically create a zip file and upload it to the Github packages. diff --git a/pom.xml b/pom.xml index 3da6e05..7493c8a 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ dk.lmst.ctr ctr-schemas - 1.1.18 + 1.1.19 ctr-schemas CTR schemas pom @@ -21,29 +21,9 @@ - - org.apache.maven.plugins - maven-assembly-plugin - 3.6.0 - - - resources - - single - - package - - - /src/main/assembly/resources.xml - - - - - org.apache.maven.plugins maven-dependency-plugin - 3.1.1 unpack-ctr @@ -95,9 +75,9 @@ - org.codehaus.mojo + com.sun.xml.ws jaxws-maven-plugin - 2.6 + 3.0.2 @@ -122,23 +102,25 @@ + + org.apache.maven.plugins + maven-assembly-plugin + 3.7.1 + + + resources + + single + + package + + + /src/main/assembly/resources.xml + + + + + - - - javax.xml.ws - jaxws-api - 2.3.1 - - - javax.jws - javax.jws-api - 1.1 - - - joda-time - joda-time - 2.12.5 - - diff --git a/src/main/java/dk/lmst/ctr/schemas/api/adapters/DateTimeAdapter.java b/src/main/java/dk/lmst/ctr/schemas/api/adapters/DateTimeAdapter.java deleted file mode 100644 index 319def8..0000000 --- a/src/main/java/dk/lmst/ctr/schemas/api/adapters/DateTimeAdapter.java +++ /dev/null @@ -1,25 +0,0 @@ -package dk.lmst.ctr.schemas.api.adapters; - -import org.joda.time.DateTime; - -import javax.xml.bind.annotation.adapters.XmlAdapter; - -public class DateTimeAdapter extends XmlAdapter { - - public DateTime unmarshal(String v) throws Exception { - if (v == null) { - return null; - } - if (v.endsWith("Z")) { - v = v.substring(0, v.length() - 1) + "+00:00"; - } - return new DateTime(v); - } - - public String marshal(DateTime v) throws Exception { - if (v == null) { - return null; - } - return v.toString(); - } -} diff --git a/src/main/java/dk/lmst/ctr/schemas/api/adapters/LocalDateAdapter.java b/src/main/java/dk/lmst/ctr/schemas/api/adapters/LocalDateAdapter.java index cd754d2..10caa69 100644 --- a/src/main/java/dk/lmst/ctr/schemas/api/adapters/LocalDateAdapter.java +++ b/src/main/java/dk/lmst/ctr/schemas/api/adapters/LocalDateAdapter.java @@ -1,8 +1,8 @@ -package dk.lmst.ctr.schemas.api.adapters; +package dk.fmkonline.jaxb.adapters; -import org.joda.time.LocalDate; +import java.time.LocalDate; -import javax.xml.bind.annotation.adapters.XmlAdapter; +import jakarta.xml.bind.annotation.adapters.XmlAdapter; public class LocalDateAdapter extends XmlAdapter { @@ -13,7 +13,7 @@ public LocalDate unmarshal(String v) throws Exception { if (v.endsWith("Z")) { v = v.substring(0, v.length() - 1); } - return new LocalDate(v); + return LocalDate.parse(v); } public String marshal(LocalDate v) throws Exception { @@ -22,5 +22,4 @@ public String marshal(LocalDate v) throws Exception { } return v.toString(); } - } diff --git a/src/main/java/dk/lmst/ctr/schemas/api/adapters/LongAdapter.java b/src/main/java/dk/lmst/ctr/schemas/api/adapters/LongAdapter.java index e0e558b..a4bf25d 100644 --- a/src/main/java/dk/lmst/ctr/schemas/api/adapters/LongAdapter.java +++ b/src/main/java/dk/lmst/ctr/schemas/api/adapters/LongAdapter.java @@ -1,6 +1,6 @@ -package dk.lmst.ctr.schemas.api.adapters; +package dk.fmkonline.jaxb.adapters; -import javax.xml.bind.annotation.adapters.XmlAdapter; +import jakarta.xml.bind.annotation.adapters.XmlAdapter; public class LongAdapter extends XmlAdapter { diff --git a/src/main/java/dk/lmst/ctr/schemas/api/adapters/ZonedDateTimeAdapter.java b/src/main/java/dk/lmst/ctr/schemas/api/adapters/ZonedDateTimeAdapter.java new file mode 100644 index 0000000..58123a1 --- /dev/null +++ b/src/main/java/dk/lmst/ctr/schemas/api/adapters/ZonedDateTimeAdapter.java @@ -0,0 +1,26 @@ +package dk.fmkonline.jaxb.adapters; + +import java.time.ZonedDateTime; +import java.time.format.DateTimeFormatter; + +import jakarta.xml.bind.annotation.adapters.XmlAdapter; + +/** + * A jaxb adapter that only accepts dateTimes with a timezone + */ +public class ZonedDateTimeAdapter extends XmlAdapter { + + public ZonedDateTime unmarshal(String zonedDateTimeString) throws Exception { + if (zonedDateTimeString == null) { + return null; + } + return ZonedDateTime.parse(zonedDateTimeString); + } + + public String marshal(ZonedDateTime zonedDateTime) throws Exception { + if (zonedDateTime == null) { + return null; + } + return zonedDateTime.format(DateTimeFormatter.ISO_OFFSET_DATE_TIME); + } +} diff --git a/src/main/xjb/jaxb-bindings-wsimport.xjb b/src/main/xjb/jaxb-bindings-wsimport.xjb index a9ed266..6f70bfb 100644 --- a/src/main/xjb/jaxb-bindings-wsimport.xjb +++ b/src/main/xjb/jaxb-bindings-wsimport.xjb @@ -1,23 +1,25 @@ - + - - - + + + - + - + - + - +