From b7223a1c9e99eb45d5e83bd041ca97c15b151a37 Mon Sep 17 00:00:00 2001 From: CGantert345 <57003061+CGantert345@users.noreply.github.com> Date: Mon, 12 Apr 2021 19:22:00 +0200 Subject: included open ticket test --- .../api/asn/omv1/IncludedOpenTicketType.java | 3 +- .../barcode/ticket/api/asn/omv1/VatDetailType.java | 1 - .../ticket/api/asn/omv2/CountermarkData.java | 2 +- .../barcode/ticket/api/asn/omv2/FIPTicketData.java | 2 +- .../api/asn/omv2/IncludedOpenTicketType.java | 5 +-- .../ticket/api/asn/omv2/OpenTicketData.java | 2 +- .../uic/barcode/ticket/api/asn/omv2/PassData.java | 2 +- .../ticket/api/asn/omv2/StationPassageData.java | 2 +- .../barcode/ticket/api/asn/omv2/TrainLinkType.java | 2 +- .../barcode/ticket/api/asn/omv2/TravelerType.java | 40 ++++++++++++++-------- .../ticket/api/asn/omv2/ValidityPeriodType.java | 4 +-- 11 files changed, 39 insertions(+), 26 deletions(-) (limited to 'src/main/java/org/uic') diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv1/IncludedOpenTicketType.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv1/IncludedOpenTicketType.java index 7ab0334..62e5a86 100644 --- a/src/main/java/org/uic/barcode/ticket/api/asn/omv1/IncludedOpenTicketType.java +++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv1/IncludedOpenTicketType.java @@ -72,6 +72,7 @@ public class IncludedOpenTicketType extends Object { @FieldOrder(order = 8) @IntRange(minValue=-1,maxValue=700) + @Asn1Default(value = "0") @Asn1Optional public Long validFromDay; @FieldOrder(order = 9) @@ -84,6 +85,7 @@ public class IncludedOpenTicketType extends Object { @FieldOrder(order = 11) @IntRange(minValue=0,maxValue=370) + @Asn1Default(value = "0") @Asn1Optional public Long validUntilDay; @FieldOrder(order = 12) @@ -95,7 +97,6 @@ public class IncludedOpenTicketType extends Object { @Asn1Optional public Long validUntilUTCOffset; @FieldOrder(order = 14) - @Asn1Default(value="second") @Asn1Optional public TravelClassType classCode; @FieldOrder(order = 15) diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv1/VatDetailType.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv1/VatDetailType.java index 82d8950..ab36642 100644 --- a/src/main/java/org/uic/barcode/ticket/api/asn/omv1/VatDetailType.java +++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv1/VatDetailType.java @@ -23,7 +23,6 @@ import org.uic.barcode.asn1.datatypes.Asn1BigInteger; import org.uic.barcode.asn1.datatypes.Asn1Optional; import org.uic.barcode.asn1.datatypes.CharacterRestriction; import org.uic.barcode.asn1.datatypes.FieldOrder; -import org.uic.barcode.asn1.datatypes.HasExtensionMarker; import org.uic.barcode.asn1.datatypes.IntRange; import org.uic.barcode.asn1.datatypes.RestrictedString; import org.uic.barcode.asn1.datatypes.Sequence; 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 435c6ef..aefdc3b 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 @@ -136,7 +136,7 @@ public class CountermarkData extends Object { @Asn1Optional public Long validFromUTCOffset; @FieldOrder(order = 25) - @IntRange(minValue=0,maxValue=370) + @IntRange(minValue=-1,maxValue=370) @Asn1Optional public Long validUntilDay; @FieldOrder(order = 26) diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/FIPTicketData.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/FIPTicketData.java index c6a98e4..447c994 100644 --- a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/FIPTicketData.java +++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/FIPTicketData.java @@ -70,7 +70,7 @@ public class FIPTicketData extends Object { @Asn1Optional public Long validFromDay; @FieldOrder(order = 7) - @IntRange(minValue=0,maxValue=370) + @IntRange(minValue=-1,maxValue=370) @Asn1Optional public Long validUntilDay; @FieldOrder(order = 8) 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 3b13d66..35a9c73 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 @@ -72,6 +72,7 @@ public class IncludedOpenTicketType extends Object { @FieldOrder(order = 8) @IntRange(minValue=-1,maxValue=700) + @Asn1Default(value = "0") @Asn1Optional public Long validFromDay; @FieldOrder(order = 9) @@ -83,7 +84,8 @@ public class IncludedOpenTicketType extends Object { @Asn1Optional public Long validFromUTCOffset; @FieldOrder(order = 11) - @IntRange(minValue=0,maxValue=370) + @IntRange(minValue=-1,maxValue=370) + @Asn1Default(value = "0") @Asn1Optional public Long validUntilDay; @FieldOrder(order = 12) @@ -95,7 +97,6 @@ public class IncludedOpenTicketType extends Object { @Asn1Optional public Long validUntilUTCOffset; @FieldOrder(order = 14) - @Asn1Default(value="second") @Asn1Optional public TravelClassType classCode; @FieldOrder(order = 15) 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 9900640..44a7188 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 @@ -129,7 +129,7 @@ public class OpenTicketData extends Object { @FieldOrder(order = 22) @Asn1Default(value = "0") - @IntRange(minValue=0,maxValue=370) + @IntRange(minValue=-1,maxValue=370) @Asn1Optional public Long validUntilDay; @FieldOrder(order = 23) 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 dbc81c3..dad76dc 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 @@ -91,7 +91,7 @@ public class PassData extends Object { @Asn1Optional public Long validFromUTCOffset; @FieldOrder(order = 12) - @IntRange(minValue=0,maxValue=370) + @IntRange(minValue=-1,maxValue=370) @Asn1Optional public Long validUntilDay; @FieldOrder(order = 13) 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 a378bb7..1e6c720 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 @@ -105,7 +105,7 @@ public class StationPassageData extends Object { @FieldOrder(order = 17) @Asn1Default(value="0") - @IntRange(minValue=0,maxValue=370) + @IntRange(minValue=-1,maxValue=370) @Asn1Optional public Long validUntilDay; @FieldOrder(order = 18) diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/TrainLinkType.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/TrainLinkType.java index 16a101e..4724db6 100644 --- a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/TrainLinkType.java +++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/TrainLinkType.java @@ -43,7 +43,7 @@ public class TrainLinkType extends Object { @Asn1Optional public String trainIA5; @FieldOrder(order = 2) - @IntRange(minValue=0,maxValue=370) + @IntRange(minValue=-1,maxValue=370) public Long travelDate; @FieldOrder(order = 3) diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/TravelerType.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/TravelerType.java index b0efae0..30a7dfc 100644 --- a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/TravelerType.java +++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/TravelerType.java @@ -78,31 +78,35 @@ public class TravelerType extends Object { @Asn1Optional public Long yearOfBirth; @FieldOrder(order = 10) - @IntRange(minValue=0,maxValue=366) - @Asn1Optional public Long dayOfBirth; - + @IntRange(minValue=1,maxValue=12) + @Asn1Optional public Long monthOfBirth; + @FieldOrder(order = 11) - public Boolean ticketHolder = true; + @IntRange(minValue=1,maxValue=31) + @Asn1Optional public Long dayOfBirth; @FieldOrder(order = 12) - @Asn1Optional public PassengerType passengerType; + public Boolean ticketHolder = true; @FieldOrder(order = 13) - @Asn1Optional public Boolean passengerWithReducedMobility; + @Asn1Optional public PassengerType passengerType; @FieldOrder(order = 14) + @Asn1Optional public Boolean passengerWithReducedMobility; + + @FieldOrder(order = 15) @IntRange(minValue=1,maxValue=999) @Asn1Optional public Long countryOfResidence; - @FieldOrder(order = 15) + @FieldOrder(order = 16) @IntRange(minValue=1,maxValue=999) @Asn1Optional public Long countryOfPassport; - @FieldOrder(order = 16) + @FieldOrder(order = 17) @IntRange(minValue=1,maxValue=999) @Asn1Optional public Long countryOfIdCard; - @FieldOrder(order = 17) + @FieldOrder(order = 18) @Asn1Optional public SequenceOfCustomerStatusType status; @@ -286,8 +290,14 @@ public class TravelerType extends Object { this.status = status; } - - + public Long getMonthOfBirth() { + return monthOfBirth; + } + + public void setMonthOfBirth(Long monthOfBirth) { + this.monthOfBirth = monthOfBirth; + } + public void setDateOfBirth(Date date){ if (date == null) return; @@ -296,9 +306,9 @@ public class TravelerType extends Object { cal.setTime(date); this.yearOfBirth = new Long( cal.get(Calendar.YEAR)); - this.dayOfBirth = new Long (cal.get(Calendar.DAY_OF_YEAR)); + this.monthOfBirth = new Long(cal.get(Calendar.MONTH) + 1); + this.dayOfBirth = new Long (cal.get(Calendar.DAY_OF_MONTH)); - } public Date getDateOfBirth() { @@ -310,13 +320,15 @@ public class TravelerType extends Object { cal.clear(); cal.setTimeZone(TimeZone.getTimeZone("UTC")); cal.set(Calendar.YEAR, this.yearOfBirth.intValue()); - cal.set(Calendar.DAY_OF_YEAR, this.dayOfBirth.intValue()); + cal.set(Calendar.MONTH, (int)(this.monthOfBirth - 1)); + cal.set(Calendar.DAY_OF_MONTH, this.dayOfBirth.intValue()); cal.set(Calendar.HOUR_OF_DAY,0); cal.set(Calendar.MINUTE,0); return cal.getTime(); } + } 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 7b08f73..e3b9aa6 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 @@ -34,7 +34,7 @@ public class ValidityPeriodType extends Object { } @FieldOrder(order = 0) - @IntRange(minValue=0,maxValue=700) + @IntRange(minValue=-1,maxValue=700) @Asn1Default(value="0") @Asn1Optional public Long validFromDay; @@ -47,7 +47,7 @@ public class ValidityPeriodType extends Object { @Asn1Optional public Long validFromUTCOffset; @FieldOrder(order = 3) - @IntRange(minValue=0,maxValue=370) + @IntRange(minValue=-1,maxValue=370) @Asn1Default(value="0") @Asn1Optional public Long validUntilDay; -- cgit v1.2.3