From dd54fb10787e7d776c89839a417bc01af10e183f Mon Sep 17 00:00:00 2001 From: CGantert345 <57003061+CGantert345@users.noreply.github.com> Date: Fri, 11 Aug 2023 10:00:26 +0200 Subject: default value 23:59 in case of missing valid until time added in all versions --- .../org/uic/barcode/ticket/api/asn/omv1/CountermarkData.java | 4 ++++ .../org/uic/barcode/ticket/api/asn/omv1/OpenTicketData.java | 6 ++++++ .../java/org/uic/barcode/ticket/api/asn/omv1/PassData.java | 6 +++++- .../uic/barcode/ticket/api/asn/omv1/StationPassageData.java | 4 ++++ .../uic/barcode/ticket/api/asn/omv1/ValidityPeriodType.java | 4 ++++ .../org/uic/barcode/ticket/api/asn/omv2/CountermarkData.java | 4 ++++ .../barcode/ticket/api/asn/omv2/IncludedOpenTicketType.java | 10 ++++++++-- .../org/uic/barcode/ticket/api/asn/omv2/OpenTicketData.java | 4 ++++ .../java/org/uic/barcode/ticket/api/asn/omv2/PassData.java | 4 ++++ .../uic/barcode/ticket/api/asn/omv2/StationPassageData.java | 4 ++++ .../uic/barcode/ticket/api/asn/omv2/ValidityPeriodType.java | 4 ++++ .../org/uic/barcode/ticket/api/asn/omv3/CountermarkData.java | 4 ++++ .../barcode/ticket/api/asn/omv3/IncludedOpenTicketType.java | 9 +++++++-- .../org/uic/barcode/ticket/api/asn/omv3/OpenTicketData.java | 4 ++++ .../java/org/uic/barcode/ticket/api/asn/omv3/PassData.java | 5 ++++- .../uic/barcode/ticket/api/asn/omv3/StationPassageData.java | 4 ++++ .../org/uic/barcode/ticket/api/asn/omv3/TrainValidityType.java | 4 ++++ .../uic/barcode/ticket/api/asn/omv3/ValidityPeriodType.java | 4 ++++ 18 files changed, 82 insertions(+), 6 deletions(-) (limited to 'src/main/java/org/uic') diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv1/CountermarkData.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv1/CountermarkData.java index a31f56d..4258b2e 100644 --- a/src/main/java/org/uic/barcode/ticket/api/asn/omv1/CountermarkData.java +++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv1/CountermarkData.java @@ -550,6 +550,10 @@ public class CountermarkData extends Object { return null; } + //set to 23:59 + if (this.getValidUntilTime() == null) { + this.setValidUntilTime(1439L); + } return DateTimeUtils.getDate(issuingDate, this.validFromDay + this.validUntilDay, this.validUntilTime); diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv1/OpenTicketData.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv1/OpenTicketData.java index 6f90f6f..0988675 100644 --- a/src/main/java/org/uic/barcode/ticket/api/asn/omv1/OpenTicketData.java +++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv1/OpenTicketData.java @@ -599,6 +599,12 @@ public class OpenTicketData extends Object { if (this.validUntilDay == null) { return null; } + + //set to 23:59 + if (this.getValidUntilTime() == null) { + this.setValidUntilTime(1439L); + } + return DateTimeUtils.getDate(issuingDate, this.validFromDay + this.validUntilDay, this.validUntilTime); } diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv1/PassData.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv1/PassData.java index 74e8e4d..55db30f 100644 --- a/src/main/java/org/uic/barcode/ticket/api/asn/omv1/PassData.java +++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv1/PassData.java @@ -889,7 +889,11 @@ public class PassData extends Object { return null; } - + //set to 23:59 + if (this.getValidUntilTime() == null) { + this.setValidUntilTime(1439L); + } + return DateTimeUtils.getDate(issuingDate, this.validFromDay + this.validUntilDay, this.validUntilTime); } diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv1/StationPassageData.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv1/StationPassageData.java index f04a835..34eadf1 100644 --- a/src/main/java/org/uic/barcode/ticket/api/asn/omv1/StationPassageData.java +++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv1/StationPassageData.java @@ -359,6 +359,10 @@ public class StationPassageData extends Object { return null; } + //set to 23:59 + if (this.getValidUntilTime() == null) { + this.setValidUntilTime(1439L); + } return DateTimeUtils.getDate(issuingDate, this.validFromDay + this.validUntilDay, this.validUntilTime); diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv1/ValidityPeriodType.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv1/ValidityPeriodType.java index 5667ad9..a72d55b 100644 --- a/src/main/java/org/uic/barcode/ticket/api/asn/omv1/ValidityPeriodType.java +++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv1/ValidityPeriodType.java @@ -139,6 +139,10 @@ public class ValidityPeriodType extends Object { return null; } + //set to 23:59 + if (this.getValidUntilTime() == null) { + this.setValidUntilTime(1439L); + } return DateTimeUtils.getDate(issuingDate, this.validFromDay + this.validUntilDay, this.validUntilTime); diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/CountermarkData.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/CountermarkData.java index 4c5a961..57d4a71 100644 --- a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/CountermarkData.java +++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/CountermarkData.java @@ -552,6 +552,10 @@ public class CountermarkData extends Object { return null; } + //set to 23:59 + if (this.getValidUntilTime() == null) { + this.setValidUntilTime(1439L); + } return DateTimeUtils.getDate(issuingDate, this.validFromDay + this.validUntilDay, this.validUntilTime); diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/IncludedOpenTicketType.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/IncludedOpenTicketType.java index e0465d9..4cfe708 100644 --- a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/IncludedOpenTicketType.java +++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/IncludedOpenTicketType.java @@ -417,6 +417,11 @@ public class IncludedOpenTicketType extends Object { return null; } + //set to 23:59 + if (this.getValidUntilTime() == null) { + this.setValidUntilTime(1439L); + } + return DateTimeUtils.getDate(issuingDate, this.validFromDay + this.validUntilDay, this.validUntilTime); } @@ -426,10 +431,11 @@ public class IncludedOpenTicketType extends Object { } public Date getUTCValidUntilDate(Date issuingDate){ + this.getValidUntilDate(issuingDate); if (this.validUntilUTCOffset == null) { - return DateTimeUtils.getUTCDate(issuingDate, this.validFromDay, this.validFromTime, this.validFromUTCOffset); + return DateTimeUtils.getUTCDate(issuingDate, this.validFromDay + this.validUntilDay, this.validUntilTime, this.validUntilUTCOffset); } else { - return DateTimeUtils.getUTCDate(issuingDate, this.validFromDay, this.validUntilTime, this.validFromUTCOffset); + return DateTimeUtils.getUTCDate(issuingDate, this.validFromDay + this.validUntilDay, this.validUntilTime, this.validFromUTCOffset); } } diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/OpenTicketData.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/OpenTicketData.java index f44d604..3b5ae99 100644 --- a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/OpenTicketData.java +++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/OpenTicketData.java @@ -598,6 +598,10 @@ public class OpenTicketData extends Object { return null; } + //set to 23:59 + if (this.getValidUntilTime() == null) { + this.setValidUntilTime(1439L); + } return DateTimeUtils.getDate(issuingDate, this.validFromDay + this.validUntilDay, this.validUntilTime); diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/PassData.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/PassData.java index dad76dc..3a8c3b1 100644 --- a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/PassData.java +++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/PassData.java @@ -513,6 +513,10 @@ public class PassData extends Object { return null; } + //set to 23:59 + if (this.getValidUntilTime() == null) { + this.setValidUntilTime(1439L); + } return DateTimeUtils.getDate(issuingDate, this.validFromDay + this.validUntilDay, this.validUntilTime); diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/StationPassageData.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/StationPassageData.java index 1e6c720..bbab6ac 100644 --- a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/StationPassageData.java +++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/StationPassageData.java @@ -359,6 +359,10 @@ public class StationPassageData extends Object { return null; } + //set to 23:59 + if (this.getValidUntilTime() == null) { + this.setValidUntilTime(1439L); + } return DateTimeUtils.getDate(issuingDate, this.validFromDay + this.validUntilDay, this.validUntilTime); diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/ValidityPeriodType.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/ValidityPeriodType.java index e3b9aa6..e22cf3b 100644 --- a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/ValidityPeriodType.java +++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/ValidityPeriodType.java @@ -139,6 +139,10 @@ public class ValidityPeriodType extends Object { return null; } + //set to 23:59 + if (this.getValidUntilTime() == null) { + this.setValidUntilTime(1439L); + } return DateTimeUtils.getDate(issuingDate, this.validFromDay + this.validUntilDay, this.validUntilTime); diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv3/CountermarkData.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv3/CountermarkData.java index 797f003..d0ce93a 100644 --- a/src/main/java/org/uic/barcode/ticket/api/asn/omv3/CountermarkData.java +++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv3/CountermarkData.java @@ -554,6 +554,10 @@ public class CountermarkData extends Object { return null; } + if (this.getValidUntilTime() == null) { + this.validUntilTime = 1439L; + } + return DateTimeUtils.getDate(issuingDate, this.validFromDay + this.validUntilDay, this.validUntilTime); diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv3/IncludedOpenTicketType.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv3/IncludedOpenTicketType.java index 72a4132..ce46a94 100644 --- a/src/main/java/org/uic/barcode/ticket/api/asn/omv3/IncludedOpenTicketType.java +++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv3/IncludedOpenTicketType.java @@ -417,6 +417,10 @@ public class IncludedOpenTicketType extends Object { return null; } + if (this.getValidUntilTime() == null) { + this.validUntilTime = 1439L; + } + return DateTimeUtils.getDate(issuingDate, this.validFromDay + this.validUntilDay, this.validUntilTime); } @@ -426,10 +430,11 @@ public class IncludedOpenTicketType extends Object { } public Date getUTCValidUntilDate(Date issuingDate){ + this.getValidUntilDate(issuingDate); if (this.validUntilUTCOffset == null) { - return DateTimeUtils.getUTCDate(issuingDate, this.validFromDay, this.validFromTime, this.validFromUTCOffset); + return DateTimeUtils.getUTCDate(issuingDate, this.validFromDay + this.validUntilDay, this.validFromTime, this.validFromUTCOffset); } else { - return DateTimeUtils.getUTCDate(issuingDate, this.validFromDay, this.validUntilTime, this.validFromUTCOffset); + return DateTimeUtils.getUTCDate(issuingDate, this.validFromDay + this.validUntilDay, this.validUntilTime, this.validFromUTCOffset); } } diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv3/OpenTicketData.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv3/OpenTicketData.java index 30bc918..b9bd214 100644 --- a/src/main/java/org/uic/barcode/ticket/api/asn/omv3/OpenTicketData.java +++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv3/OpenTicketData.java @@ -598,6 +598,10 @@ public class OpenTicketData extends Object { return null; } + //set to 23:59 + if (this.getValidUntilTime() == null) { + this.setValidUntilTime(1439L); + } return DateTimeUtils.getDate(issuingDate, this.validFromDay + this.validUntilDay, this.validUntilTime); diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv3/PassData.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv3/PassData.java index d84f868..9ef1acb 100644 --- a/src/main/java/org/uic/barcode/ticket/api/asn/omv3/PassData.java +++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv3/PassData.java @@ -511,11 +511,14 @@ public class PassData extends Object { this.validFromDay = 0L; } + if (this.validUntilTime == null) { + this.validUntilTime = 1439L; + } + if (this.validUntilDay == null) { return null; } - return DateTimeUtils.getDate(issuingDate, this.validFromDay + this.validUntilDay, this.validUntilTime); } diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv3/StationPassageData.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv3/StationPassageData.java index 88f390a..df2022a 100644 --- a/src/main/java/org/uic/barcode/ticket/api/asn/omv3/StationPassageData.java +++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv3/StationPassageData.java @@ -359,6 +359,10 @@ public class StationPassageData extends Object { return null; } + //set to 23:59 + if (this.getValidUntilTime() == null) { + this.setValidUntilTime(1439L); + } return DateTimeUtils.getDate(issuingDate, this.validFromDay + this.validUntilDay, this.validUntilTime); diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv3/TrainValidityType.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv3/TrainValidityType.java index e4060da..4f1bd72 100644 --- a/src/main/java/org/uic/barcode/ticket/api/asn/omv3/TrainValidityType.java +++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv3/TrainValidityType.java @@ -174,6 +174,10 @@ public class TrainValidityType extends Object { return null; } + //set to 23:59 + if (this.getValidUntilTime() == null) { + this.setValidUntilTime(1439L); + } return DateTimeUtils.getDate(issuingDate, this.validFromDay + this.validUntilDay, this.validUntilTime); diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv3/ValidityPeriodType.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv3/ValidityPeriodType.java index 2b9a459..79364a3 100644 --- a/src/main/java/org/uic/barcode/ticket/api/asn/omv3/ValidityPeriodType.java +++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv3/ValidityPeriodType.java @@ -139,6 +139,10 @@ public class ValidityPeriodType extends Object { return null; } + //set to 23:59 + if (this.getValidUntilTime() == null) { + this.setValidUntilTime(1439L); + } return DateTimeUtils.getDate(issuingDate, this.validFromDay + this.validUntilDay, this.validUntilTime); -- cgit v1.2.3